From 16b3d03efaebe1716d2d47876d4c8815bcc9ce6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Tue, 16 Jan 2024 09:36:20 +0100 Subject: [PATCH] Sync from SUSE:ALP:Source:Standard:1.0 gdb revision 3bcf2795561866793949a58c97f00a2f --- .gitattributes | 23 + README.qa | 117 + _constraints | 24 + _multibuild | 3 + aarch64-avoid-initializers-for-vlas.patch | 50 + ...anual-memory-management-in-go-lang.c.patch | 202 + baselibs.conf | 11 + clean.sh | 46 + fix-gdb.mi-new-ui-mi-sync.exp.patch | 23 + ...69-regression-on-aarch64-arm-pr30506.patch | 148 + ...-2-gdb-rhbz1553104-s390x-arch12-test.patch | 29 + fixup-gdb-6.3-attach-see-vdso-test.patch | 30 + fixup-gdb-6.3-gstack-20050411.patch | 25 + ...5-bz243845-stale-testing-zombie-test.patch | 35 + fixup-gdb-bz634108-solib_address.patch | 22 + fixup-gdb-glibc-strstr-workaround.patch | 19 + fixup-gdb-lineno-makeup-test.patch | 26 + fixup-gdb-linux_perf-bundle.patch | 24 + ...61564-aarch64-hw-watchpoint-test.pat.patch | 43 + fixup-gdb-rhbz1553104-s390x-arch12-test.patch | 19 + fixup-gdb-test-bt-cfi-without-die.patch | 38 + fixup-gdb-test-dw2-aranges.patch | 21 + gdb-13.2.tar.bz2 | 3 + gdb-6.3-attach-see-vdso-test.patch | 120 + gdb-6.3-bz202689-exec-from-pthread-test.patch | 109 + gdb-6.3-gstack-20050411.patch | 258 + gdb-6.3-mapping-zero-inode-test.patch | 247 + gdb-6.5-bz109921-DW_AT_decl_file-test.patch | 134 + ...337-resolve-tls-without-debuginfo-v2.patch | 264 + ...5-bz218379-ppc-solib-trampoline-test.patch | 107 + ...5-bz243845-stale-testing-zombie-test.patch | 89 + gdb-6.5-gcore-buffer-limit-test.patch | 154 + gdb-6.5-ia64-libunwind-leak-test.patch | 135 + gdb-6.5-last-address-space-byte-test.patch | 62 + gdb-6.5-missed-trap-on-step-test.patch | 95 + gdb-6.5-section-num-fixup-test.patch | 127 + gdb-6.5-sharedlibrary-path.patch | 193 + ...buildid-locate-rpm-librpm-workaround.patch | 19 + gdb-6.6-buildid-locate-rpm-suse.patch | 136 + gdb-6.6-buildid-locate-rpm.patch | 1082 ++++ ...6.6-buildid-locate-solib-missing-ids.patch | 238 + gdb-6.6-buildid-locate.patch | 1915 ++++++ gdb-6.6-bz229517-gcore-without-terminal.patch | 188 + ....6-bz237572-ppc-atomic-sequence-test.patch | 278 + gdb-6.6-testsuite-timeouts.patch | 32 + gdb-6.7-testsuite-stable-results.patch | 104 + gdb-6.8-bz442765-threaded-exec-test.patch | 181 + gdb-add-index.sh-fix-bashism.patch | 21 + gdb-archer-next-over-throw-cxx-exec.patch | 88 + gdb-binutils29988-read_indexed_address.patch | 24 + gdb-bz2237392-dwarf-obstack-allocation.patch | 68 + gdb-bz2237515-debuginfod-double-free.patch | 102 + gdb-bz634108-solib_address.patch | 41 + gdb-ccache-workaround.patch | 26 + gdb-cli-add-ignore-errors-command.patch | 192 + ...ending-c-after-rl_callback_read_char.patch | 69 + gdb-core-open-vdso-warning.patch | 58 + gdb-fedora-libncursesw.patch | 71 + ...ix-segfault-in-for_each_block-part-1.patch | 645 ++ ...ix-segfault-in-for_each_block-part-2.patch | 168 + gdb-gcore-bash.patch | 10 + gdb-glibc-strstr-workaround.patch | 132 + gdb-go-handle-v3-go_0-mangled-prefix.patch | 138 + gdb-gstack.man | 48 + gdb-lineno-makeup-test.patch | 165 + gdb-linux_perf-bundle.patch | 224 + gdb-opcodes-clflushopt-test.patch | 62 + gdb-orphanripper.c | 752 +++ gdb-python-finishbreakpoint-update.patch | 453 ++ ...3-set-solib-absolute-prefix-testcase.patch | 83 + ...07614-memleak-infpy_read_memory-test.patch | 170 + ...-s390x-wrong-prologue-skip-O2-g-3of3.patch | 235 + ...149205-catch-syscall-after-fork-test.patch | 123 + ...l-error-unqualified-name-re-set-test.patch | 135 + ...bz1261564-aarch64-hw-watchpoint-test.patch | 104 + gdb-rhbz1350436-type-printers-error.patch | 83 + gdb-rhbz1553104-s390x-arch12-test.patch | 81 + ...rhbz1773651-gdb-index-internal-error.patch | 105 + ...2160211-excessive-core-file-warnings.patch | 108 + gdb-rhbz2192105-ftbs-dangling-pointer | 107 + ...6395-debuginfod-legacy-openssl-crash.patch | 188 + gdb-rhbz2233961-CVE-2022-4806.patch | 50 + gdb-rhbz2233965-memory-leak.patch | 115 + ...dvar-assertion-frame-failed-testcase.patch | 147 + gdb-rhel5.9-testcase-xlf-var-inside-mod.patch | 731 +++ gdb-rpmlintrc | 16 + ...ltaneous-step-resume-breakpoint-test.patch | 162 + gdb-support-rseq-auxvs.patch | 45 + ...ptimized-out-static-var-to-cooked-in.patch | 299 + gdb-symtab-add-producer_is_gas.patch | 125 + ...t-deduplicate-variables-in-gdb-index.patch | 81 + ...-defer-backward-refs-inter-cu-intra-.patch | 74 + ...-factor-out-m_deferred_entries-usage.patch | 76 + ...tab-factor-out-m_die_range_map-usage.patch | 153 + ...main-language-without-symtab-expansi.patch | 202 + ...w_tag_inlined_subroutine-entries-in-.patch | 112 + ...ine-number-of-static-const-class-mem.patch | 84 + ...oo-many-symbols-in-gdbpy_lookup_stat.patch | 66 + ...e-nullptr-parent-in-parent_map-set_p.patch | 37 + ...ndle-pu-in-iterate_over_some_symtabs.patch | 59 + gdb-symtab-handle-self-reference-die.patch | 159 + ...e-self-reference-in-inherit_abstract.patch | 92 + ...track-of-all-parents-for-cooked-inde.patch | 38 + ...eep-track-of-processed-dies-in-shard.patch | 126 + ...se-into-c-dw_tag_subprogram-dies-for.patch | 31 + ...efactor-condition-in-scan_attributes.patch | 70 + ...ve-deferred-entries-inter-shard-case.patch | 502 ++ ...ve-deferred-entries-intra-shard-case.patch | 120 + ...set-default-dwarf-max-cache-age-1000.patch | 13 + gdb-symtab-work-around-gas-pr28629.patch | 278 + gdb-symtab-work-around-pr-gas-29517.patch | 255 + ...rch64-fix-frame-address-of-last-insn.patch | 140 + ...array-elements-in-ppc64_aggregate_ca.patch | 86 + gdb-test-bt-cfi-without-die.patch | 214 + gdb-test-dw2-aranges.patch | 220 + gdb-test-pid0-core.patch | 92 + gdb-testsuite-ada-pie.patch | 118 + ...testsuite-add-basic-lmap-for-tcl-8.6.patch | 80 + ...estsuite-add-gdb.suse-debranding.exp.patch | 68 + ...stsuite-add-gdb.suse-zypper-hint.exp.patch | 101 + gdb-testsuite-add-have_host_locale.patch | 148 + ...testsuite-add-kfail-for-pr-ada-30908.patch | 108 + ...d-wait_for_msg-arg-to-term-resize-fi.patch | 49 + ...d-xfail-case-in-gdb.python-py-record.patch | 57 + ...d-xfail-for-gdb-29965-in-gdb.threads.patch | 65 + ...-add-xfail-in-gdb.arch-i386-pkru.exp.patch | 154 + ...d-xfail-in-gdb.python-py-record-btra.patch | 98 + ...n-t-use-string-cat-in-gdb.dwarf2-dw2.patch | 39 + ...factor-out-proc-linux_kernel_version.patch | 81 + ...x-breakpoint-regexp-in-gdb.ada-out_o.patch | 50 + ...x-buffer-overflow-in-gdb.base-signed.patch | 120 + ...e-fix-gdb-server-ext-run-exp-for-obs.patch | 19 + ...x-gdb.ada-mi_task_arg.exp-with-newer.patch | 64 + ...x-gdb.arch-i386-signal.exp-on-x86_64.patch | 91 + ...p-over-syscall.exp-with-m32-amd-case.patch | 71 + ...x-gdb.cp-m-static.exp-regression-on-.patch | 76 + ...x-gdb.dwarf2-nullptr_t.exp-with-cc-w.patch | 38 + ...x-gdb.gdb-python-helper.exp-with-o2-.patch | 146 + ...x-gdb.python-py-breakpoint.exp-timeo.patch | 73 + ...x-gdb.python-py-breakpoint.exp-with-.patch | 65 + ...te-fix-gdb.rust-watch.exp-on-ppc64le.patch | 42 + ...x-gdb.threads-schedlock.exp-for-gcc-.patch | 68 + ...x-gdb.threads-schedlock.exp-on-fast-.patch | 97 + ...x-regexps-in-gdb.base-step-over-sysc.patch | 85 + ...ndle-missing-gdc-in-gdb.dlang-dlang-.patch | 77 + ...ndle-output-after-prompt-in-gdb.thre.patch | 53 + ...compilation-fails-with-unix-fpie-pie.patch | 131 + ...lax-breakpoint-count-check-in-gdb.py.patch | 73 + ...quire-syscall-time-in-gdb.reverse-ti.patch | 70 + ...mplify-gdb.arch-amd64-disp-step-avx..patch | 146 + ...mplify-gdb.base-unwind-on-each-insn..patch | 118 + ...ads-process-dies-while-detaching.exp.patch | 80 + ...allow-command-window-of-1-or-2-lines.patch | 80 + ...able-work-around-libncurses-segfault.patch | 47 + ...resizing-of-terminal-to-1-or-2-lines.patch | 147 + ...ault-in-tui_find_disassembly_address.patch | 148 + ...be-uninitialized-in-tui_find_disasse.patch | 57 + gdb.changes | 5435 +++++++++++++++++ gdb.spec | 1438 +++++ gdbinit | 8 + gdbinit.without-python | 5 + import-fedora.sh | 155 + import-patches.sh | 100 + move-step_until-procedure.patch | 162 + patchlist.pl | 74 + patchname_get.sh | 314 + ...gdb.reverse-finish-precsave.exp-and-.patch | 498 ++ ...ssion-fix-for-reverse-finish-command.patch | 74 + qa-local.sh | 252 + qa-remote.sh | 163 + qa.sh | 996 +++ ...some-unnecessary-includes-from-exp.y.patch | 171 + v2.0.5.tar.gz | 3 + ...werror-dangling-pointer-issue-with-m.patch | 139 + 174 files changed, 30882 insertions(+) create mode 100644 .gitattributes create mode 100644 README.qa create mode 100644 _constraints create mode 100644 _multibuild create mode 100644 aarch64-avoid-initializers-for-vlas.patch create mode 100644 avoid-manual-memory-management-in-go-lang.c.patch create mode 100644 baselibs.conf create mode 100644 clean.sh create mode 100644 fix-gdb.mi-new-ui-mi-sync.exp.patch create mode 100644 fix-pr30369-regression-on-aarch64-arm-pr30506.patch create mode 100644 fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch create mode 100644 fixup-gdb-6.3-attach-see-vdso-test.patch create mode 100644 fixup-gdb-6.3-gstack-20050411.patch create mode 100644 fixup-gdb-6.5-bz243845-stale-testing-zombie-test.patch create mode 100644 fixup-gdb-bz634108-solib_address.patch create mode 100644 fixup-gdb-glibc-strstr-workaround.patch create mode 100644 fixup-gdb-lineno-makeup-test.patch create mode 100644 fixup-gdb-linux_perf-bundle.patch create mode 100644 fixup-gdb-rhbz1261564-aarch64-hw-watchpoint-test.pat.patch create mode 100644 fixup-gdb-rhbz1553104-s390x-arch12-test.patch create mode 100644 fixup-gdb-test-bt-cfi-without-die.patch create mode 100644 fixup-gdb-test-dw2-aranges.patch create mode 100644 gdb-13.2.tar.bz2 create mode 100644 gdb-6.3-attach-see-vdso-test.patch create mode 100644 gdb-6.3-bz202689-exec-from-pthread-test.patch create mode 100644 gdb-6.3-gstack-20050411.patch create mode 100644 gdb-6.3-mapping-zero-inode-test.patch create mode 100644 gdb-6.5-bz109921-DW_AT_decl_file-test.patch create mode 100644 gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch create mode 100644 gdb-6.5-bz218379-ppc-solib-trampoline-test.patch create mode 100644 gdb-6.5-bz243845-stale-testing-zombie-test.patch create mode 100644 gdb-6.5-gcore-buffer-limit-test.patch create mode 100644 gdb-6.5-ia64-libunwind-leak-test.patch create mode 100644 gdb-6.5-last-address-space-byte-test.patch create mode 100644 gdb-6.5-missed-trap-on-step-test.patch create mode 100644 gdb-6.5-section-num-fixup-test.patch create mode 100644 gdb-6.5-sharedlibrary-path.patch create mode 100644 gdb-6.6-buildid-locate-rpm-librpm-workaround.patch create mode 100644 gdb-6.6-buildid-locate-rpm-suse.patch create mode 100644 gdb-6.6-buildid-locate-rpm.patch create mode 100644 gdb-6.6-buildid-locate-solib-missing-ids.patch create mode 100644 gdb-6.6-buildid-locate.patch create mode 100644 gdb-6.6-bz229517-gcore-without-terminal.patch create mode 100644 gdb-6.6-bz237572-ppc-atomic-sequence-test.patch create mode 100644 gdb-6.6-testsuite-timeouts.patch create mode 100644 gdb-6.7-testsuite-stable-results.patch create mode 100644 gdb-6.8-bz442765-threaded-exec-test.patch create mode 100644 gdb-add-index.sh-fix-bashism.patch create mode 100644 gdb-archer-next-over-throw-cxx-exec.patch create mode 100644 gdb-binutils29988-read_indexed_address.patch create mode 100644 gdb-bz2237392-dwarf-obstack-allocation.patch create mode 100644 gdb-bz2237515-debuginfod-double-free.patch create mode 100644 gdb-bz634108-solib_address.patch create mode 100644 gdb-ccache-workaround.patch create mode 100644 gdb-cli-add-ignore-errors-command.patch create mode 100644 gdb-cli-handle-pending-c-after-rl_callback_read_char.patch create mode 100644 gdb-core-open-vdso-warning.patch create mode 100644 gdb-fedora-libncursesw.patch create mode 100644 gdb-fix-segfault-in-for_each_block-part-1.patch create mode 100644 gdb-fix-segfault-in-for_each_block-part-2.patch create mode 100644 gdb-gcore-bash.patch create mode 100644 gdb-glibc-strstr-workaround.patch create mode 100644 gdb-go-handle-v3-go_0-mangled-prefix.patch create mode 100644 gdb-gstack.man create mode 100644 gdb-lineno-makeup-test.patch create mode 100644 gdb-linux_perf-bundle.patch create mode 100644 gdb-opcodes-clflushopt-test.patch create mode 100644 gdb-orphanripper.c create mode 100644 gdb-python-finishbreakpoint-update.patch create mode 100644 gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch create mode 100644 gdb-rhbz1007614-memleak-infpy_read_memory-test.patch create mode 100644 gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch create mode 100644 gdb-rhbz1149205-catch-syscall-after-fork-test.patch create mode 100644 gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch create mode 100644 gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch create mode 100644 gdb-rhbz1350436-type-printers-error.patch create mode 100644 gdb-rhbz1553104-s390x-arch12-test.patch create mode 100644 gdb-rhbz1773651-gdb-index-internal-error.patch create mode 100644 gdb-rhbz2160211-excessive-core-file-warnings.patch create mode 100644 gdb-rhbz2192105-ftbs-dangling-pointer create mode 100644 gdb-rhbz2196395-debuginfod-legacy-openssl-crash.patch create mode 100644 gdb-rhbz2233961-CVE-2022-4806.patch create mode 100644 gdb-rhbz2233965-memory-leak.patch create mode 100644 gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch create mode 100644 gdb-rhel5.9-testcase-xlf-var-inside-mod.patch create mode 100644 gdb-rpmlintrc create mode 100644 gdb-simultaneous-step-resume-breakpoint-test.patch create mode 100644 gdb-support-rseq-auxvs.patch create mode 100644 gdb-symtab-add-optimized-out-static-var-to-cooked-in.patch create mode 100644 gdb-symtab-add-producer_is_gas.patch create mode 100644 gdb-symtab-don-t-deduplicate-variables-in-gdb-index.patch create mode 100644 gdb-symtab-don-t-defer-backward-refs-inter-cu-intra-.patch create mode 100644 gdb-symtab-factor-out-m_deferred_entries-usage.patch create mode 100644 gdb-symtab-factor-out-m_die_range_map-usage.patch create mode 100644 gdb-symtab-find-main-language-without-symtab-expansi.patch create mode 100644 gdb-symtab-fix-dw_tag_inlined_subroutine-entries-in-.patch create mode 100644 gdb-symtab-fix-line-number-of-static-const-class-mem.patch create mode 100644 gdb-symtab-fix-too-many-symbols-in-gdbpy_lookup_stat.patch create mode 100644 gdb-symtab-handle-nullptr-parent-in-parent_map-set_p.patch create mode 100644 gdb-symtab-handle-pu-in-iterate_over_some_symtabs.patch create mode 100644 gdb-symtab-handle-self-reference-die.patch create mode 100644 gdb-symtab-handle-self-reference-in-inherit_abstract.patch create mode 100644 gdb-symtab-keep-track-of-all-parents-for-cooked-inde.patch create mode 100644 gdb-symtab-keep-track-of-processed-dies-in-shard.patch create mode 100644 gdb-symtab-recurse-into-c-dw_tag_subprogram-dies-for.patch create mode 100644 gdb-symtab-refactor-condition-in-scan_attributes.patch create mode 100644 gdb-symtab-resolve-deferred-entries-inter-shard-case.patch create mode 100644 gdb-symtab-resolve-deferred-entries-intra-shard-case.patch create mode 100644 gdb-symtab-set-default-dwarf-max-cache-age-1000.patch create mode 100644 gdb-symtab-work-around-gas-pr28629.patch create mode 100644 gdb-symtab-work-around-pr-gas-29517.patch create mode 100644 gdb-tdep-aarch64-fix-frame-address-of-last-insn.patch create mode 100644 gdb-tdep-fix-nr-array-elements-in-ppc64_aggregate_ca.patch create mode 100644 gdb-test-bt-cfi-without-die.patch create mode 100644 gdb-test-dw2-aranges.patch create mode 100644 gdb-test-pid0-core.patch create mode 100644 gdb-testsuite-ada-pie.patch create mode 100644 gdb-testsuite-add-basic-lmap-for-tcl-8.6.patch create mode 100644 gdb-testsuite-add-gdb.suse-debranding.exp.patch create mode 100644 gdb-testsuite-add-gdb.suse-zypper-hint.exp.patch create mode 100644 gdb-testsuite-add-have_host_locale.patch create mode 100644 gdb-testsuite-add-kfail-for-pr-ada-30908.patch create mode 100644 gdb-testsuite-add-wait_for_msg-arg-to-term-resize-fi.patch create mode 100644 gdb-testsuite-add-xfail-case-in-gdb.python-py-record.patch create mode 100644 gdb-testsuite-add-xfail-for-gdb-29965-in-gdb.threads.patch create mode 100644 gdb-testsuite-add-xfail-in-gdb.arch-i386-pkru.exp.patch create mode 100644 gdb-testsuite-add-xfail-in-gdb.python-py-record-btra.patch create mode 100644 gdb-testsuite-don-t-use-string-cat-in-gdb.dwarf2-dw2.patch create mode 100644 gdb-testsuite-factor-out-proc-linux_kernel_version.patch create mode 100644 gdb-testsuite-fix-breakpoint-regexp-in-gdb.ada-out_o.patch create mode 100644 gdb-testsuite-fix-buffer-overflow-in-gdb.base-signed.patch create mode 100644 gdb-testsuite-fix-gdb-server-ext-run-exp-for-obs.patch create mode 100644 gdb-testsuite-fix-gdb.ada-mi_task_arg.exp-with-newer.patch create mode 100644 gdb-testsuite-fix-gdb.arch-i386-signal.exp-on-x86_64.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.cp-m-static.exp-regression-on-.patch create mode 100644 gdb-testsuite-fix-gdb.dwarf2-nullptr_t.exp-with-cc-w.patch create mode 100644 gdb-testsuite-fix-gdb.gdb-python-helper.exp-with-o2-.patch create mode 100644 gdb-testsuite-fix-gdb.python-py-breakpoint.exp-timeo.patch create mode 100644 gdb-testsuite-fix-gdb.python-py-breakpoint.exp-with-.patch create mode 100644 gdb-testsuite-fix-gdb.rust-watch.exp-on-ppc64le.patch create mode 100644 gdb-testsuite-fix-gdb.threads-schedlock.exp-for-gcc-.patch create mode 100644 gdb-testsuite-fix-gdb.threads-schedlock.exp-on-fast-.patch create mode 100644 gdb-testsuite-fix-regexps-in-gdb.base-step-over-sysc.patch create mode 100644 gdb-testsuite-handle-missing-gdc-in-gdb.dlang-dlang-.patch create mode 100644 gdb-testsuite-handle-output-after-prompt-in-gdb.thre.patch create mode 100644 gdb-testsuite-prevent-compilation-fails-with-unix-fpie-pie.patch create mode 100644 gdb-testsuite-relax-breakpoint-count-check-in-gdb.py.patch create mode 100644 gdb-testsuite-require-syscall-time-in-gdb.reverse-ti.patch create mode 100644 gdb-testsuite-simplify-gdb.arch-amd64-disp-step-avx..patch create mode 100644 gdb-testsuite-simplify-gdb.base-unwind-on-each-insn..patch create mode 100644 gdb-testsuite-work-around-skip_prologue-problems-in-gdb.threads-process-dies-while-detaching.exp.patch create mode 100644 gdb-tui-allow-command-window-of-1-or-2-lines.patch create mode 100644 gdb-tui-enable-work-around-libncurses-segfault.patch create mode 100644 gdb-tui-fix-resizing-of-terminal-to-1-or-2-lines.patch create mode 100644 gdb-tui-fix-segfault-in-tui_find_disassembly_address.patch create mode 100644 gdb-tui-fix-wmaybe-uninitialized-in-tui_find_disasse.patch create mode 100644 gdb.changes create mode 100644 gdb.spec create mode 100644 gdbinit create mode 100644 gdbinit.without-python create mode 100644 import-fedora.sh create mode 100644 import-patches.sh create mode 100644 move-step_until-procedure.patch create mode 100644 patchlist.pl create mode 100644 patchname_get.sh create mode 100644 powerpc-fix-for-gdb.reverse-finish-precsave.exp-and-.patch create mode 100644 powerpc-regression-fix-for-reverse-finish-command.patch create mode 100644 qa-local.sh create mode 100644 qa-remote.sh create mode 100644 qa.sh create mode 100644 remove-some-unnecessary-includes-from-exp.y.patch create mode 100644 v2.0.5.tar.gz create mode 100644 xcoffread.c-fix-werror-dangling-pointer-issue-with-m.patch diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..fecc750 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/README.qa b/README.qa new file mode 100644 index 0000000..77e6949 --- /dev/null +++ b/README.qa @@ -0,0 +1,117 @@ +I. LOCAL QA. + + +0. Notes. + +Note that the configs are hardcoded in the script. F.i. atm SLE-11 is not +included, because the config is unresolvable on devel:gcc/gdb. Also Leap +15.2 is not included because of 'remote error: unknown repository type +UNDEFINED"'. + +The script tries to keep disk usage low by removing the buildroot after each +build, but that requires sudo rights, so the first thing the script does is +ask for sudo authentication. + + +1. Cleanup. + +Do: +... +$ bash qa-local.sh 1 +... + + +2. Build. + +Do: +... +$ bash qa-local.sh 2 +... + +This builds gdb for each x86_64 config, without running the testsuite. + +I did a timing run on my laptop (with 6 configs) and got: +... +real 66m17.689s +user 149m31.925s +sys 12m25.359s +... +so for a dual-core/4-SMT CPU, it's ~1h5m. + + +3. Build & test. + +Do: +... +$ bash qa-local.sh 3 +... + +This builds gdb and produces test results for each x86_64 config. + +I did a timing run on my laptop (with 6 configs) and got: +... +real 285m9.679s +user 683m16.769s +sys 133m58.287s +... +so for a dual-core/4-SMT CPU, it's ~4h45m. + +The resulting testlogs (with 6 configs) is 1.4GB. + + +4. Verify. + +Do: +... +$ bash qa-local.sh 4 +... + +This verifies the test results for each x86_64 config, using the qa.sh script. + + +5. Cleanup. + +Do: +... +$ rm -Rf tmp-qa-local +... +l + + +I. REMOTE QA. + + +1. Cleanup. + +Do: +... +$ bash qa-remote.sh 1 +... + + +2. Get test results. + +Do: +... +$ bash qa-remote.sh 2 +... + +This downloads the remote test results. + + +3. Verify. + +Do: +... +$ bash qa-remote.sh 3 +... +with m running from 1 to 5. + +This verifies the test results, using the qa.sh script. + +4. Cleanup. + +Do: +... +$ rm -Rf tmp-qa-remote +... diff --git a/_constraints b/_constraints new file mode 100644 index 0000000..c6df298 --- /dev/null +++ b/_constraints @@ -0,0 +1,24 @@ + + + + ppc64 + ppc64le + + + + 4 + + + + + + x86_64 + + + + 8 + + + + + diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..7c191e2 --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + testsuite + diff --git a/aarch64-avoid-initializers-for-vlas.patch b/aarch64-avoid-initializers-for-vlas.patch new file mode 100644 index 0000000..4f46dd3 --- /dev/null +++ b/aarch64-avoid-initializers-for-vlas.patch @@ -0,0 +1,50 @@ +From 0f363ed540fef466f45eab4570c23853e1f14898 Mon Sep 17 00:00:00 2001 +From: Roland McGrath +Date: Thu, 9 Feb 2023 10:47:17 -0800 +Subject: [PATCH] [aarch64] Avoid initializers for VLAs + +Clang doesn't accept initializer syntax for variable-length +arrays in C. Just use memset instead. +--- + gdb/aarch64-linux-nat.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c +index e4158236db2..ecb2eeb9540 100644 +--- a/gdb/aarch64-linux-nat.c ++++ b/gdb/aarch64-linux-nat.c +@@ -56,6 +56,8 @@ + + #include "nat/aarch64-mte-linux-ptrace.h" + ++#include ++ + #ifndef TRAP_HWBKPT + #define TRAP_HWBKPT 0x0004 + #endif +@@ -445,7 +447,9 @@ fetch_tlsregs_from_thread (struct regcache *regcache) + gdb_assert (regno != -1); + gdb_assert (tdep->tls_register_count > 0); + +- uint64_t tpidrs[tdep->tls_register_count] = { 0 }; ++ uint64_t tpidrs[tdep->tls_register_count]; ++ memset(tpidrs, 0, sizeof(tpidrs)); ++ + struct iovec iovec; + iovec.iov_base = tpidrs; + iovec.iov_len = sizeof (tpidrs); +@@ -471,7 +475,8 @@ store_tlsregs_to_thread (struct regcache *regcache) + gdb_assert (regno != -1); + gdb_assert (tdep->tls_register_count > 0); + +- uint64_t tpidrs[tdep->tls_register_count] = { 0 }; ++ uint64_t tpidrs[tdep->tls_register_count]; ++ memset(tpidrs, 0, sizeof(tpidrs)); + + for (int i = 0; i < tdep->tls_register_count; i++) + { + +base-commit: a39101060cdf2ee239833106fb3bdf9585f858aa +-- +2.35.3 + diff --git a/avoid-manual-memory-management-in-go-lang.c.patch b/avoid-manual-memory-management-in-go-lang.c.patch new file mode 100644 index 0000000..98089ba --- /dev/null +++ b/avoid-manual-memory-management-in-go-lang.c.patch @@ -0,0 +1,202 @@ +From 4e0e7ff14ba271576232160bf337639662a2ea23 Mon Sep 17 00:00:00 2001 +From: Tom Tromey +Date: Thu, 16 Feb 2023 17:36:29 -0700 +Subject: [PATCH 2/3] Avoid manual memory management in go-lang.c + +I noticed a couple of spots in go-lang.c that could be improved by +using unique_ptr. + +Reviewed-By: Andrew Burgess +--- + gdb/dwarf2/read.c | 2 +- + gdb/go-exp.c | 287 +++++++++++++++++++++++----------------------- + gdb/go-exp.y | 8 +- + gdb/go-lang.c | 40 +++---- + gdb/go-lang.h | 11 +- + 5 files changed, 173 insertions(+), 175 deletions(-) + +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index 8aa7f8c31e5..61f4bd75013 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -7890,7 +7890,7 @@ fixup_go_packaging (struct dwarf2_cu *cu) + && sym->aclass () == LOC_BLOCK) + { + gdb::unique_xmalloc_ptr this_package_name +- (go_symbol_package_name (sym)); ++ = go_symbol_package_name (sym); + + if (this_package_name == NULL) + continue; +diff --git a/gdb/go-exp.y b/gdb/go-exp.y +index cbaa79ee18c..542a06d06d6 100644 +--- a/gdb/go-exp.y ++++ b/gdb/go-exp.y +@@ -1393,16 +1393,16 @@ classify_name (struct parser_state *par_state, const struct block *block) + current package. */ + + { +- char *current_package_name = go_block_package_name (block); ++ gdb::unique_xmalloc_ptr current_package_name ++ = go_block_package_name (block); + + if (current_package_name != NULL) + { + struct stoken sval = +- build_packaged_name (current_package_name, +- strlen (current_package_name), ++ build_packaged_name (current_package_name.get (), ++ strlen (current_package_name.get ()), + copy.c_str (), copy.size ()); + +- xfree (current_package_name); + sym = lookup_symbol (sval.ptr, block, VAR_DOMAIN, + &is_a_field_of_this); + if (sym.symbol) +diff --git a/gdb/go-lang.c b/gdb/go-lang.c +index 7549f14dc63..f9176ace71d 100644 +--- a/gdb/go-lang.c ++++ b/gdb/go-lang.c +@@ -163,11 +163,8 @@ unpack_package_and_object (char *buf, + + Space for the resulting strings is malloc'd in one buffer. + PACKAGEP,OBJECTP,METHOD_TYPE* will (typically) point into this buffer. +- [There are a few exceptions, but the caller is still responsible for +- freeing the resulting pointer.] + A pointer to this buffer is returned, or NULL if symbol isn't a + mangled Go symbol. +- The caller is responsible for freeing the result. + + *METHOD_TYPE_IS_POINTERP is set to a boolean indicating if + the method type is a pointer. +@@ -180,7 +177,7 @@ unpack_package_and_object (char *buf, + If we ever need to unpack the method type, this routine should work + for that too. */ + +-static char * ++static gdb::unique_xmalloc_ptr + unpack_mangled_go_symbol (const char *mangled_name, + const char **packagep, + const char **objectp, +@@ -209,9 +206,10 @@ unpack_mangled_go_symbol (const char *mangled_name, + /* main.init is mangled specially. */ + if (strcmp (mangled_name, "__go_init_main") == 0) + { +- char *package = xstrdup ("main"); ++ gdb::unique_xmalloc_ptr package ++ = make_unique_xstrdup ("main"); + +- *packagep = package; ++ *packagep = package.get (); + *objectp = "init"; + return package; + } +@@ -219,9 +217,10 @@ unpack_mangled_go_symbol (const char *mangled_name, + /* main.main is mangled specially (missing prefix). */ + if (strcmp (mangled_name, "main.main") == 0) + { +- char *package = xstrdup ("main"); ++ gdb::unique_xmalloc_ptr package ++ = make_unique_xstrdup ("main"); + +- *packagep = package; ++ *packagep = package.get (); + *objectp = "main"; + return package; + } +@@ -261,7 +260,8 @@ unpack_mangled_go_symbol (const char *mangled_name, + + /* At this point we've decided we have a mangled Go symbol. */ + +- buf = xstrdup (mangled_name); ++ gdb::unique_xmalloc_ptr result = make_unique_xstrdup (mangled_name); ++ buf = result.get (); + + /* Search backwards looking for "N". */ + p = buf + len; +@@ -317,7 +317,7 @@ unpack_mangled_go_symbol (const char *mangled_name, + } + + unpack_package_and_object (buf, packagep, objectp); +- return buf; ++ return result; + } + + /* Implements the la_demangle language_defn routine for language Go. +@@ -381,10 +381,9 @@ go_language::demangle_symbol (const char *mangled_name, int options) const + return make_unique_xstrdup ((const char *) obstack_finish (&tempbuf)); + } + +-/* Given a Go symbol, return its package or NULL if unknown. +- Space for the result is malloc'd, caller must free. */ ++/* See go-lang.h. */ + +-char * ++gdb::unique_xmalloc_ptr + go_symbol_package_name (const struct symbol *sym) + { + const char *mangled_name = sym->linkage_name (); +@@ -393,8 +392,7 @@ go_symbol_package_name (const struct symbol *sym) + const char *method_type_package_name; + const char *method_type_object_name; + int method_type_is_pointer; +- char *name_buf; +- char *result; ++ gdb::unique_xmalloc_ptr name_buf; + + gdb_assert (sym->language () == language_go); + name_buf = unpack_mangled_go_symbol (mangled_name, +@@ -405,15 +403,12 @@ go_symbol_package_name (const struct symbol *sym) + /* Some Go symbols don't have mangled form we interpret (yet). */ + if (name_buf == NULL) + return NULL; +- result = xstrdup (package_name); +- xfree (name_buf); +- return result; ++ return make_unique_xstrdup (package_name); + } + +-/* Return the package that BLOCK is in, or NULL if there isn't one. +- Space for the result is malloc'd, caller must free. */ ++/* See go-lang.h. */ + +-char * ++gdb::unique_xmalloc_ptr + go_block_package_name (const struct block *block) + { + while (block != NULL) +@@ -422,7 +417,8 @@ go_block_package_name (const struct block *block) + + if (function != NULL) + { +- char *package_name = go_symbol_package_name (function); ++ gdb::unique_xmalloc_ptr package_name ++ = go_symbol_package_name (function); + + if (package_name != NULL) + return package_name; +diff --git a/gdb/go-lang.h b/gdb/go-lang.h +index f0929cc3ac5..8edfe6ed53a 100644 +--- a/gdb/go-lang.h ++++ b/gdb/go-lang.h +@@ -62,9 +62,14 @@ extern const char *go_main_name (void); + + extern enum go_type go_classify_struct_type (struct type *type); + +-extern char *go_symbol_package_name (const struct symbol *sym); +- +-extern char *go_block_package_name (const struct block *block); ++/* Given a Go symbol, return its package or nullptr if unknown. */ ++extern gdb::unique_xmalloc_ptr go_symbol_package_name ++ (const struct symbol *sym); ++ ++/* Return the package that BLOCK is in, or nullptr if there isn't ++ one. */ ++extern gdb::unique_xmalloc_ptr go_block_package_name ++ (const struct block *block); + + extern const struct builtin_go_type *builtin_go_type (struct gdbarch *); + +-- +2.35.3 + diff --git a/baselibs.conf b/baselibs.conf new file mode 100644 index 0000000..1078278 --- /dev/null +++ b/baselibs.conf @@ -0,0 +1,11 @@ +gdb + +/usr/bin/gdb -> /usr/bin/gdb + # kill package for i586 32bit + targetarch x86_64 block! + prereq -glibc-x86 +gdbserver + +/usr/bin/gdbserver -> /usr/bin/gdbserver + provides "gdb-:/usr/bin/gdbserver" + # kill package for i586 32bit + targetarch x86_64 block! + prereq -glibc-x86 diff --git a/clean.sh b/clean.sh new file mode 100644 index 0000000..ecd651d --- /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..6094ea5 --- /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-pr30369-regression-on-aarch64-arm-pr30506.patch b/fix-pr30369-regression-on-aarch64-arm-pr30506.patch new file mode 100644 index 0000000..42a4fe0 --- /dev/null +++ b/fix-pr30369-regression-on-aarch64-arm-pr30506.patch @@ -0,0 +1,148 @@ +From 11a41bc318ba0307248eadf29bf7d4a1af31d3a8 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Tue, 16 May 2023 17:00:51 +0100 +Subject: [PATCH 2/2] Fix PR30369 regression on aarch64/arm (PR30506) + +The gdb.dwarf2/dw2-prologue-end-2.exp test was failing for both AArch64 and +Arm. + +As Tom pointed out here (https://inbox.sourceware.org/gdb-patches/6663707c-4297-c2f2-a0bd-f3e84fc62aad@suse.de/), +there are issues with both the prologue skipper for AArch64 and Arm and an +incorrect assumption by the testcase. + +This patch fixes both of AArch64's and Arm's prologue skippers to not skip past +the end of a function. It also incorporates a fix to the testcase so it +doesn't assume the prologue skipper will stop at the first instruction of the +functions/labels. + +Regression-tested on aarch64-linux/arm-linux Ubuntu 20.04/22.04 and +x86_64-linux Ubuntu 20.04. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30506 + +Co-Authored-By: Tom de Vries +Co-Authored-By: Luis Machado +--- + gdb/aarch64-tdep.c | 10 +++++++-- + gdb/arm-tdep.c | 21 ++++++++++++++++--- + .../gdb.dwarf2/dw2-prologue-end-2.exp | 12 +++++------ + 3 files changed, 32 insertions(+), 11 deletions(-) + +diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c +index 499b87ef480..e21d18f5c8c 100644 +--- a/gdb/aarch64-tdep.c ++++ b/gdb/aarch64-tdep.c +@@ -896,12 +896,15 @@ aarch64_analyze_prologue_test (void) + static CORE_ADDR + aarch64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) + { +- CORE_ADDR func_addr, limit_pc; ++ CORE_ADDR func_addr, func_end_addr, limit_pc; + + /* See if we can determine the end of the prologue via the symbol + table. If so, then return either PC, or the PC after the + prologue, whichever is greater. */ +- if (find_pc_partial_function (pc, NULL, &func_addr, NULL)) ++ bool func_addr_found ++ = find_pc_partial_function (pc, NULL, &func_addr, &func_end_addr); ++ ++ if (func_addr_found) + { + CORE_ADDR post_prologue_pc + = skip_prologue_using_sal (gdbarch, func_addr); +@@ -921,6 +924,9 @@ aarch64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) + if (limit_pc == 0) + limit_pc = pc + 128; /* Magic. */ + ++ limit_pc ++ = func_end_addr == 0? limit_pc : std::min (limit_pc, func_end_addr - 4); ++ + /* Try disassembling prologue. */ + return aarch64_analyze_prologue (gdbarch, pc, limit_pc, NULL); + } +diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c +index 58b9c5f4bd8..ecffb9223e1 100644 +--- a/gdb/arm-tdep.c ++++ b/gdb/arm-tdep.c +@@ -1768,12 +1768,18 @@ arm_skip_stack_protector(CORE_ADDR pc, struct gdbarch *gdbarch) + static CORE_ADDR + arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) + { +- CORE_ADDR func_addr, limit_pc; ++ CORE_ADDR func_addr, func_end_addr, limit_pc; + + /* See if we can determine the end of the prologue via the symbol table. + If so, then return either PC, or the PC after the prologue, whichever + is greater. */ +- if (find_pc_partial_function (pc, NULL, &func_addr, NULL)) ++ bool func_addr_found ++ = find_pc_partial_function (pc, NULL, &func_addr, &func_end_addr); ++ ++ /* Whether the function is thumb mode or not. */ ++ bool func_is_thumb = false; ++ ++ if (func_addr_found) + { + CORE_ADDR post_prologue_pc + = skip_prologue_using_sal (gdbarch, func_addr); +@@ -1810,7 +1816,8 @@ arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) + associate prologue code with the opening brace; so this + lets us skip the first line if we think it is the opening + brace. */ +- if (arm_pc_is_thumb (gdbarch, func_addr)) ++ func_is_thumb = arm_pc_is_thumb (gdbarch, func_addr); ++ if (func_is_thumb) + analyzed_limit = thumb_analyze_prologue (gdbarch, func_addr, + post_prologue_pc, NULL); + else +@@ -1836,6 +1843,14 @@ arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) + if (limit_pc == 0) + limit_pc = pc + 64; /* Magic. */ + ++ /* Set the correct adjustment based on whether the function is thumb mode or ++ not. We use it to get the address of the last instruction in the ++ function (as opposed to the first address of the next function). */ ++ CORE_ADDR adjustment = func_is_thumb? 2 : 4; ++ ++ limit_pc ++ = func_end_addr == 0? limit_pc : std::min (limit_pc, ++ func_end_addr - adjustment); + + /* Check if this is Thumb code. */ + if (arm_pc_is_thumb (gdbarch, pc)) +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.exp +index 642b73fe2a1..da49902c13c 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.exp ++++ b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.exp +@@ -95,17 +95,17 @@ if { $break_addr == "" } { + return + } + +-# Get the "foo_label" address. ++# Get the "bar_label" address. + +-set foo_label_addr "" +-gdb_test_multiple "print /x &foo_label" "" { ++set bar_label_addr "" ++gdb_test_multiple "print /x &bar_label" "" { + -re -wrap "= ($hex)" { +- set foo_label_addr $expect_out(1,string) ++ set bar_label_addr $expect_out(1,string) + pass $gdb_test_name + } + } + +-if { $foo_label_addr == "" } { ++if { $bar_label_addr == "" } { + return + } + +@@ -117,4 +117,4 @@ gdb_test "print &foo_end == &bar_label" " = 1" + # Check that the breakpoint is set at the expected address. Regression test + # for PR30369. + +-gdb_assert { $break_addr == $foo_label_addr } ++gdb_assert { $break_addr < $bar_label_addr } +-- +2.35.3 + diff --git a/fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch b/fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch new file mode 100644 index 0000000..176f5d0 --- /dev/null +++ b/fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch @@ -0,0 +1,29 @@ +fixup-2-gdb-rhbz1553104-s390x-arch12-test + +--- + gdb/testsuite/gdb.arch/s390x-arch12.exp | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.exp b/gdb/testsuite/gdb.arch/s390x-arch12.exp +index 246c1e1c69a..7939a2d6932 100644 +--- a/gdb/testsuite/gdb.arch/s390x-arch12.exp ++++ b/gdb/testsuite/gdb.arch/s390x-arch12.exp +@@ -31,4 +31,18 @@ gdb_exit + gdb_start + gdb_load $ofile + ++set supported 0 ++gdb_test_multiple "show arch" "" { ++ -re -wrap "\"s390:64-bit\".*" { ++ set supported 1 ++ } ++ -re -wrap "" { ++ } ++} ++ ++if { ! $supported } { ++ unsupported "No s390x support" ++ return -1 ++} ++ + gdb_test "disas load_guarded" " <\\+28>:\tlgg\t%r1,0\\(%r1\\)\r\n\[^\r\n\]* <\\+34>:\tstg\t%r1,168\\(%r11\\)\r\n.*" diff --git a/fixup-gdb-6.3-attach-see-vdso-test.patch b/fixup-gdb-6.3-attach-see-vdso-test.patch new file mode 100644 index 0000000..f5cd8f3 --- /dev/null +++ b/fixup-gdb-6.3-attach-see-vdso-test.patch @@ -0,0 +1,30 @@ +From 19dc95258888a9e110ad54fa25a613611956a13f Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Tue, 13 Jun 2023 15:04:32 +0200 +Subject: [PATCH 5/6] fixup gdb-6.3-attach-see-vdso-test.patch + +--- + gdb/testsuite/gdb.base/attach-see-vdso.exp | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/attach-see-vdso.exp b/gdb/testsuite/gdb.base/attach-see-vdso.exp +index 5457ec4129d..35c49731f0b 100644 +--- a/gdb/testsuite/gdb.base/attach-see-vdso.exp ++++ b/gdb/testsuite/gdb.base/attach-see-vdso.exp +@@ -34,10 +34,11 @@ 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." ++ unsupported "Testcase nonthreaded compile failed, so all tests in this file will automatically fail." ++ return + } + +-if [get_compiler_info ${binfile}] { ++if [get_compiler_info] { + return -1 + } + +-- +2.35.3 + diff --git a/fixup-gdb-6.3-gstack-20050411.patch b/fixup-gdb-6.3-gstack-20050411.patch new file mode 100644 index 0000000..f3499a0 --- /dev/null +++ b/fixup-gdb-6.3-gstack-20050411.patch @@ -0,0 +1,25 @@ +From 8c0ae8c3c6fa34f046131f76871db13bc392a440 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Tue, 13 Jun 2023 14:56:55 +0200 +Subject: [PATCH 4/6] fixup gdb-6.3-gstack-20050411.patch + +--- + gdb/testsuite/gdb.base/gstack.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.base/gstack.exp b/gdb/testsuite/gdb.base/gstack.exp +index 089407ec04a..a5dacd582ff 100644 +--- a/gdb/testsuite/gdb.base/gstack.exp ++++ b/gdb/testsuite/gdb.base/gstack.exp +@@ -52,7 +52,7 @@ gdb_expect { + # exiting the function. Still we could retry the gstack command if we fail. + + set test "spawn gstack" +-set command "sh -c GDB=$GDB\\ GDBARGS=-data-directory\\\\\\ $BUILD_DATA_DIRECTORY\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END" ++set command "sh -c GDB=$GDB\\ GDBARGS=-data-directory\\\\\\ $GDB_DATA_DIRECTORY\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END" + set res [remote_spawn host $command]; + if { $res < 0 || $res == "" } { + perror "Spawning $command failed." +-- +2.35.3 + diff --git a/fixup-gdb-6.5-bz243845-stale-testing-zombie-test.patch b/fixup-gdb-6.5-bz243845-stale-testing-zombie-test.patch new file mode 100644 index 0000000..46202fe --- /dev/null +++ b/fixup-gdb-6.5-bz243845-stale-testing-zombie-test.patch @@ -0,0 +1,35 @@ +Fixup gdb.base/tracefork-zombie.exp + +Fix ERROR: +... +PASS: gdb.base/tracefork-zombie.exp: attach +ERROR: tcl error sourcing gdb/testsuite/gdb.base/tracefork-zombie.exp. +ERROR: tcl error code POSIX ESRCH {no such process} +ERROR: error reading "file12": no such process + while executing +"read $statusfi" + ("foreach" body line 5) + invoked from within +... + +--- + gdb/testsuite/gdb.base/tracefork-zombie.exp | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/tracefork-zombie.exp b/gdb/testsuite/gdb.base/tracefork-zombie.exp +index 03f790d4c5d..3e2e5517d46 100644 +--- a/gdb/testsuite/gdb.base/tracefork-zombie.exp ++++ b/gdb/testsuite/gdb.base/tracefork-zombie.exp +@@ -58,8 +58,10 @@ foreach procpid [glob -directory /proc -type d {[0-9]*}] { + if {[catch {open $procpid/status} statusfi]} { + continue + } +- set status [read $statusfi] +- close $statusfi ++ if {[catch {read $statusfi} status]} { ++ continue ++ } ++ catch {close $statusfi} + if {1 + && [regexp -line {^Name:\tgdb$} $status] + && [regexp -line {^PPid:\t1$} $status] diff --git a/fixup-gdb-bz634108-solib_address.patch b/fixup-gdb-bz634108-solib_address.patch new file mode 100644 index 0000000..6b372d8 --- /dev/null +++ b/fixup-gdb-bz634108-solib_address.patch @@ -0,0 +1,22 @@ +From 023314feb400836eb377a5bc9151850fcdd81b11 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Tue, 6 Jun 2023 09:43:36 +0200 +Subject: [PATCH 3/4] 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 99e6aaba831..ebf00babc34 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(0))" "None" "gdb.solib_name exists" +-- +2.35.3 + diff --git a/fixup-gdb-glibc-strstr-workaround.patch b/fixup-gdb-glibc-strstr-workaround.patch new file mode 100644 index 0000000..719d4bf --- /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-lineno-makeup-test.patch b/fixup-gdb-lineno-makeup-test.patch new file mode 100644 index 0000000..4e25cc9 --- /dev/null +++ b/fixup-gdb-lineno-makeup-test.patch @@ -0,0 +1,26 @@ +From 266359a17e77a53d4ebaa4f3b15c2ae39e43fca0 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Tue, 13 Jun 2023 15:07:22 +0200 +Subject: [PATCH 6/6] fixup gdb-lineno-makeup-test.patch + +--- + gdb/testsuite/gdb.base/lineno-makeup.exp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.base/lineno-makeup.exp b/gdb/testsuite/gdb.base/lineno-makeup.exp +index 9e11d78bf9c..d31e063bdc2 100644 +--- a/gdb/testsuite/gdb.base/lineno-makeup.exp ++++ b/gdb/testsuite/gdb.base/lineno-makeup.exp +@@ -21,7 +21,8 @@ set binfuncfile [standard_output_file ${testfile}-func.bin] + set binfile [standard_output_file ${testfile}] + + if { [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" "${objfuncfile}" object {}] != "" } { +- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." ++ unsupported "Testcase compile failed, so all tests in this file will automatically fail." ++ return + } + + set objcopy [catch "exec objcopy -O binary --only-section .text ${objfuncfile} ${binfuncfile}" output] +-- +2.35.3 + diff --git a/fixup-gdb-linux_perf-bundle.patch b/fixup-gdb-linux_perf-bundle.patch new file mode 100644 index 0000000..c7655c3 --- /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-rhbz1261564-aarch64-hw-watchpoint-test.pat.patch b/fixup-gdb-rhbz1261564-aarch64-hw-watchpoint-test.pat.patch new file mode 100644 index 0000000..b9c7f7a --- /dev/null +++ b/fixup-gdb-rhbz1261564-aarch64-hw-watchpoint-test.pat.patch @@ -0,0 +1,43 @@ +From e452307ba07f5d798edad73631182e137265da7d Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Tue, 13 Jun 2023 17:58:42 +0200 +Subject: [PATCH 9/9] fixup gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch + +--- + .../rhbz1261564-aarch64-watchpoint.exp | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp +index b1cf7115663..42ebc25cc49 100644 +--- a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp ++++ b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp +@@ -20,12 +20,22 @@ if { [prepare_for_testing rhbz1261564-aarch64-watchpoint.exp "rhbz1261564-aarch6 + if { ! [ runto main ] } then { return 0 } + + set test "rwatch aligned.var4" +-if [istarget "s390*-*-*"] { +- gdb_test $test {Target does not support this type of hardware watchpoint\.} +- untested "s390* does not support hw read watchpoint" ++ ++set supported 1 ++gdb_test_multiple $test "" { ++ -re -wrap "Hardware read watchpoint \[0-9\]+: aligned.var4" { ++ pass $gdb_test_name ++ } ++ -re -wrap "Target does not support this type of hardware watchpoint\\." { ++ set supported 0 ++ } ++} ++ ++if { !$supported } { ++ unsupported $test + return + } +-gdb_test $test "Hardware read watchpoint \[0-9\]+: aligned.var4" ++ + + proc checkvar { address } { + global gdb_prompt +-- +2.35.3 + diff --git a/fixup-gdb-rhbz1553104-s390x-arch12-test.patch b/fixup-gdb-rhbz1553104-s390x-arch12-test.patch new file mode 100644 index 0000000..bfb5263 --- /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-bt-cfi-without-die.patch b/fixup-gdb-test-bt-cfi-without-die.patch new file mode 100644 index 0000000..44592d8 --- /dev/null +++ b/fixup-gdb-test-bt-cfi-without-die.patch @@ -0,0 +1,38 @@ +fixup-gdb-test-bt-cfi-without-die.patch + +--- + gdb/testsuite/gdb.base/cfi-without-die.exp | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/cfi-without-die.exp b/gdb/testsuite/gdb.base/cfi-without-die.exp +index 5880d46f6d2..db1726646f8 100644 +--- a/gdb/testsuite/gdb.base/cfi-without-die.exp ++++ b/gdb/testsuite/gdb.base/cfi-without-die.exp +@@ -37,19 +37,22 @@ if ![runto callback] then { + fail "verify unwinding: Can't run to callback" + return 0 + } +-set test "verify unwinding breaks without CFI" +-gdb_test_multiple "bt" $test { ++ ++set as_expected 1 ++gdb_test_multiple "bt" "" { + -re " in \[?\]\[?\] .*\r\n$gdb_prompt $" { + # It may backtrace through some random frames even to main(). +- pass $test + } + -re " in main .*\r\n$gdb_prompt $" { +- fail $test ++ set as_expected 0 + } + -re "\r\n$gdb_prompt $" { +- pass $test + } + } ++if { ! $as_expected } { ++ untested ${testfile}.exp ++ return -1 ++} + + if { [gdb_compile "${srcdir}/${subdir}/${srccallerfile}" ${objcallerfile} \ + object [list {additional_flags=-fomit-frame-pointer -funwind-tables -fasynchronous-unwind-tables}]] != "" diff --git a/fixup-gdb-test-dw2-aranges.patch b/fixup-gdb-test-dw2-aranges.patch new file mode 100644 index 0000000..0174b52 --- /dev/null +++ b/fixup-gdb-test-dw2-aranges.patch @@ -0,0 +1,21 @@ +From 81a7585502092b3c133534ac6ecb34fd56d05337 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Thu, 16 Feb 2023 12:56:41 +0100 +Subject: [PATCH 09/11] fixup gdb-test-dw2-aranges.patch + +--- + gdb/testsuite/gdb.dwarf2/dw2-aranges.S | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.S b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S +index d5b9ca5a3c6..b811f6644cb 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-aranges.S ++++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S +@@ -138,3 +138,4 @@ main: + .byte 0 /* aranges segment_size */ + + .Laranges_end: ++ .section .note.GNU-stack,"",@progbits +-- +2.35.3 + diff --git a/gdb-13.2.tar.bz2 b/gdb-13.2.tar.bz2 new file mode 100644 index 0000000..7225316 --- /dev/null +++ b/gdb-13.2.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d110e9ebdf9b1ebef92382aba1258a377d0531d775a705c273870521ce0a8ac +size 31423251 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..daba42f --- /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-bz202689-exec-from-pthread-test.patch b/gdb-6.3-bz202689-exec-from-pthread-test.patch new file mode 100644 index 0000000..74684dd --- /dev/null +++ b/gdb-6.3-bz202689-exec-from-pthread-test.patch @@ -0,0 +1,109 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jan Kratochvil +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.3-bz202689-exec-from-pthread-test.patch + +;; Testcase for exec() from threaded program (BZ 202689). +;;=fedoratest + +2007-01-17 Jan Kratochvil + + * gdb.threads/threaded-exec.exp, gdb.threads/threaded-exec.c: New files. + +diff --git a/gdb/testsuite/gdb.threads/threaded-exec.c b/gdb/testsuite/gdb.threads/threaded-exec.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/threaded-exec.c +@@ -0,0 +1,46 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2007 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, ++ Boston, MA 02111-1307, USA. */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++ ++static void * ++threader (void *arg) ++{ ++ return NULL; ++} ++ ++int ++main (void) ++{ ++ pthread_t t1; ++ int i; ++ ++ i = pthread_create (&t1, NULL, threader, (void *) NULL); ++ assert (i == 0); ++ i = pthread_join (t1, NULL); ++ assert (i == 0); ++ ++ execl ("/bin/true", "/bin/true", NULL); ++ abort (); ++} +diff --git a/gdb/testsuite/gdb.threads/threaded-exec.exp b/gdb/testsuite/gdb.threads/threaded-exec.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/threaded-exec.exp +@@ -0,0 +1,41 @@ ++# threaded-exec.exp -- Check reset of the tracked threads on exec*(2) ++# Copyright (C) 2007 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++# Please email any bugs, comments, and/or additions to this file to: ++# bug-gdb@prep.ai.mit.edu ++ ++set testfile threaded-exec ++set srcfile ${testfile}.c ++set binfile [standard_output_file ${testfile}] ++ ++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable []] != "" } { ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++ ++gdb_load ${binfile} ++ ++gdb_run_cmd ++ ++gdb_test_multiple {} "Program exited" { ++ -re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" { ++ pass "Program exited" ++ } ++} diff --git a/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch new file mode 100644 index 0000000..ce9cd65 --- /dev/null +++ b/gdb-6.3-gstack-20050411.patch @@ -0,0 +1,258 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andrew Cagney +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.3-gstack-20050411.patch + +;; Add a wrapper script to GDB that implements pstack using the +;; --readnever option. +;;=push + +2004-11-23 Andrew Cagney + + * Makefile.in (uninstall-gstack, install-gstack): New rules, add + to install and uninstall. + * gstack.sh, gstack.1: New files. + +diff --git a/gdb/Makefile.in b/gdb/Makefile.in +--- a/gdb/Makefile.in ++++ b/gdb/Makefile.in +@@ -2011,7 +2011,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force + install: all + @$(MAKE) $(FLAGS_TO_PASS) install-only + +-install-only: $(CONFIG_INSTALL) ++install-only: install-gstack $(CONFIG_INSTALL) + transformed_name=`t='$(program_transform_name)'; \ + echo gdb | sed -e "$$t"` ; \ + if test "x$$transformed_name" = x; then \ +@@ -2061,7 +2061,25 @@ install-guile: + install-python: + $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb + +-uninstall: force $(CONFIG_UNINSTALL) ++GSTACK=gstack ++.PHONY: install-gstack ++install-gstack: ++ transformed_name=`t='$(program_transform_name)'; \ ++ echo $(GSTACK) | sed -e "$$t"` ; \ ++ if test "x$$transformed_name" = x; then \ ++ transformed_name=$(GSTACK) ; \ ++ else \ ++ true ; \ ++ fi ; \ ++ $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir) ; \ ++ $(INSTALL_PROGRAM) $(srcdir)/$(GSTACK).sh \ ++ $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \ ++ : $(SHELL) $(srcdir)/../mkinstalldirs \ ++ $(DESTDIR)$(man1dir) ; \ ++ : $(INSTALL_DATA) $(srcdir)/gstack.1 \ ++ $(DESTDIR)$(man1dir)/$$transformed_name.1 ++ ++uninstall: force uninstall-gstack $(CONFIG_UNINSTALL) + transformed_name=`t='$(program_transform_name)'; \ + echo gdb | sed -e $$t` ; \ + if test "x$$transformed_name" = x; then \ +@@ -2092,6 +2110,18 @@ uninstall: force $(CONFIG_UNINSTALL) + rm -f $(DESTDIR)$(bindir)/$$transformed_name + @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do + ++.PHONY: uninstall-gstack ++uninstall-gstack: ++ transformed_name=`t='$(program_transform_name)'; \ ++ echo $(GSTACK) | sed -e $$t` ; \ ++ if test "x$$transformed_name" = x; then \ ++ transformed_name=$(GSTACK) ; \ ++ else \ ++ true ; \ ++ fi ; \ ++ rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \ ++ $(DESTDIR)$(man1dir)/$$transformed_name.1 ++ + # The C++ name parser can be built standalone for testing. + test-cp-name-parser.o: cp-name-parser.c + $(COMPILE) -DTEST_CPNAMES cp-name-parser.c +diff --git a/gdb/gstack.sh b/gdb/gstack.sh +new file mode 100644 +--- /dev/null ++++ b/gdb/gstack.sh +@@ -0,0 +1,43 @@ ++#!/bin/sh ++ ++if test $# -ne 1; then ++ echo "Usage: `basename $0 .sh` " 1>&2 ++ exit 1 ++fi ++ ++if test ! -r /proc/$1; then ++ echo "Process $1 not found." 1>&2 ++ exit 1 ++fi ++ ++# GDB doesn't allow "thread apply all bt" when the process isn't ++# threaded; need to peek at the process to determine if that or the ++# simpler "bt" should be used. ++ ++backtrace="bt" ++if test -d /proc/$1/task ; then ++ # Newer kernel; has a task/ directory. ++ if test `/bin/ls /proc/$1/task | /usr/bin/wc -l` -gt 1 2>/dev/null ; then ++ backtrace="thread apply all bt" ++ fi ++elif test -f /proc/$1/maps ; then ++ # Older kernel; go by it loading libpthread. ++ if /bin/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then ++ backtrace="thread apply all bt" ++ fi ++fi ++ ++GDB=${GDB:-gdb} ++ ++# Run GDB, strip out unwanted noise. ++# --readnever is no longer used since .gdb_index is now in use. ++$GDB --quiet -nx $GDBARGS /proc/$1/exe $1 <&1 | ++set width 0 ++set height 0 ++set pagination no ++$backtrace ++EOF ++/bin/sed -n \ ++ -e 's/^\((gdb) \)*//' \ ++ -e '/^#/p' \ ++ -e '/^Thread/p' +diff --git a/gdb/testsuite/gdb.base/gstack.c b/gdb/testsuite/gdb.base/gstack.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/gstack.c +@@ -0,0 +1,43 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2005, 2007, 2008, 2009 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#include ++#include ++#include ++ ++void ++func (void) ++{ ++ const char msg[] = "looping\n"; ++ ++ /* Use the most simple notification not to get caught by attach on exiting ++ the function. */ ++ write (1, msg, strlen (msg)); ++ ++ for (;;); ++} ++ ++int ++main (void) ++{ ++ alarm (60); ++ nice (100); ++ ++ func (); ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/gstack.exp b/gdb/testsuite/gdb.base/gstack.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/gstack.exp +@@ -0,0 +1,84 @@ ++# Copyright (C) 2012 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++set testfile gstack ++set executable ${testfile} ++set binfile [standard_output_file $executable] ++if {[build_executable ${testfile} ${executable} "" {debug}] == -1} { ++ return -1 ++} ++ ++set test "spawn inferior" ++set command "${binfile}" ++set res [remote_spawn host $command]; ++if { $res < 0 || $res == "" } { ++ perror "Spawning $command failed." ++ fail $test ++ return ++} ++ ++# The spawn id of the test inferior. ++set test_spawn_id $res ++ ++set use_gdb_stub 1 ++set pid [exp_pid -i $res] ++gdb_expect { ++ -re "looping\r\n" { ++ pass $test ++ } ++ eof { ++ fail "$test (eof)" ++ return ++ } ++ timeout { ++ fail "$test (timeout)" ++ return ++ } ++} ++ ++# Testcase uses the most simple notification not to get caught by attach on ++# exiting the function. Still we could retry the gstack command if we fail. ++ ++set test "spawn gstack" ++set command "sh -c GDB=$GDB\\ GDBARGS=-data-directory\\\\\\ $BUILD_DATA_DIRECTORY\\ sh\\ ${srcdir}/../gstack.sh\\ $pid\\;echo\\ GSTACK-END" ++set res [remote_spawn host $command]; ++if { $res < 0 || $res == "" } { ++ perror "Spawning $command failed." ++ fail $test ++} ++ ++set gdb_spawn_id $res ++ ++gdb_test_multiple "" $test { ++ -re "^#0 +(0x\[0-9a-f\]+ in )?\\.?func \\(\\) at \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in \\.?main \\(\\) at \[^\r\n\]*\r\nGSTACK-END\r\n\$" { ++ pass $test ++ } ++} ++ ++gdb_test_multiple "" "gstack exits" { ++ eof { ++ set result [wait -i $gdb_spawn_id] ++ verbose $result ++ ++ gdb_assert { [lindex $result 2] == 0 } "gstack exits with no error" ++ gdb_assert { [lindex $result 3] == 0 } "gstack's exit status is 0" ++ ++ remote_close host ++ clear_gdb_spawn_id ++ } ++} ++ ++# Kill the test inferior. ++kill_wait_spawned_process $test_spawn_id diff --git a/gdb-6.3-mapping-zero-inode-test.patch b/gdb-6.3-mapping-zero-inode-test.patch new file mode 100644 index 0000000..32b62d5 --- /dev/null +++ b/gdb-6.3-mapping-zero-inode-test.patch @@ -0,0 +1,247 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.3-mapping-zero-inode-test.patch + +;; Test GCORE for shmid 0 shared memory mappings. +;;=fedoratest: But it is broken anyway, sometimes the case being tested is not reproducible. + +diff --git a/gdb/testsuite/gdb.base/gcore-shmid0.c b/gdb/testsuite/gdb.base/gcore-shmid0.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/gcore-shmid0.c +@@ -0,0 +1,128 @@ ++/* Copyright 2007, 2009 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, ++ Boston, MA 02111-1307, USA. */ ++ ++/* ++ * Test GDB's handling of gcore for mapping with a name but zero inode. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* The same test running in a parallel testsuite may steal us the zero SID, ++ even if we never get any EEXIST. Just try a while. */ ++ ++#define TIMEOUT_SEC 10 ++ ++static volatile int v; ++ ++static void ++initialized (void) ++{ ++ v++; ++} ++ ++static void ++unresolved (void) ++{ ++ v++; ++} ++ ++int ++main (void) ++{ ++ int sid; ++ unsigned int *addr = (void *) -1L; ++ int attempt, round = 0; ++ time_t ts_start, ts; ++ ++ if (time (&ts_start) == (time_t) -1) ++ { ++ printf ("time (): %m\n"); ++ exit (1); ++ } ++ ++ /* The generated SID will cycle with an increment of 32768, attempt until it ++ * wraps to 0. */ ++ ++ for (attempt = 0; addr == (void *) -1L; attempt++) ++ { ++ /* kernel-2.6.25-8.fc9.x86_64 just never returns the value 0 by ++ shmget(2). shmget returns SID range 0..1<<31 in steps of 32768, ++ 0x1000 should be enough but wrap the range it to be sure. */ ++ ++ if (attempt > 0x21000) ++ { ++ if (time (&ts) == (time_t) -1) ++ { ++ printf ("time (): %m\n"); ++ exit (1); ++ } ++ ++ if (ts >= ts_start && ts < ts_start + TIMEOUT_SEC) ++ { ++ attempt = 0; ++ round++; ++ continue; ++ } ++ ++ printf ("Problem is not reproducible on this kernel (attempt %d, " ++ "round %d)\n", attempt, round); ++ unresolved (); ++ exit (1); ++ } ++ ++ sid = shmget ((key_t) rand (), 0x1000, IPC_CREAT | IPC_EXCL | 0777); ++ if (sid == -1) ++ { ++ if (errno == EEXIST) ++ continue; ++ ++ printf ("shmget (%d, 0x1000, IPC_CREAT): errno %d\n", 0, errno); ++ exit (1); ++ } ++ ++ /* Use SID only if it is 0, retry it otherwise. */ ++ ++ if (sid == 0) ++ { ++ addr = shmat (sid, NULL, SHM_RND); ++ if (addr == (void *) -1L) ++ { ++ printf ("shmat (%d, NULL, SHM_RND): errno %d\n", sid, ++ errno); ++ exit (1); ++ } ++ } ++ if (shmctl (sid, IPC_RMID, NULL) != 0) ++ { ++ printf ("shmctl (%d, IPC_RMID, NULL): errno %d\n", sid, errno); ++ exit (1); ++ } ++ } ++ ++ initialized (); ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/gcore-shmid0.exp b/gdb/testsuite/gdb.base/gcore-shmid0.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/gcore-shmid0.exp +@@ -0,0 +1,101 @@ ++# Copyright 2007, 2009 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++# Test GDB's handling of gcore for mapping with a name but zero inode. ++ ++if { [prepare_for_testing gcore-shmid0.exp gcore-shmid0] } { ++ return -1 ++} ++ ++# Does this gdb support gcore? ++set test "help gcore" ++gdb_test_multiple $test $test { ++ -re "Undefined command: .gcore.*$gdb_prompt $" { ++ # gcore command not supported -- nothing to test here. ++ unsupported "gdb does not support gcore on this target" ++ return -1; ++ } ++ -re "Save a core file .*$gdb_prompt $" { ++ pass $test ++ } ++} ++ ++if { ! [ runto_main ] } then { ++ untested gcore-shmid0.exp ++ return -1 ++} ++ ++gdb_breakpoint "initialized" ++gdb_breakpoint "unresolved" ++ ++set oldtimeout $timeout ++set timeout [expr $oldtimeout + 120] ++ ++set test "Continue to initialized." ++gdb_test_multiple "continue" $test { ++ -re "Breakpoint .*, initialized .* at .*\r\n$gdb_prompt $" { ++ pass $test ++ } ++ -re "Breakpoint .*, unresolved .* at .*\r\n$gdb_prompt $" { ++ set timeout $oldtimeout ++ unsupported $test ++ return -1 ++ } ++} ++set timeout $oldtimeout ++ ++set escapedfilename [string_to_regexp [standard_output_file gcore-shmid0.test]] ++ ++set test "save a corefile" ++gdb_test_multiple "gcore [standard_output_file gcore-shmid0.test]" $test { ++ -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" { ++ pass $test ++ } ++ -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" { ++ unsupported $test ++ } ++} ++ ++# Be sure to remove the handle first. ++# But it would get removed even on a kill by GDB as the handle is already ++# deleted, just it is still attached. ++gdb_continue_to_end "finish" ++ ++set test "core-file command" ++gdb_test_multiple "core-file [standard_output_file gcore-shmid0.test]" $test { ++ -re ".* program is being debugged already.*y or n. $" { ++ # gdb_load may connect us to a gdbserver. ++ send_gdb "y\n" ++ exp_continue; ++ } ++ -re "Core was generated by .*\r\n\#0 .*\\\(\\\).*\r\n$gdb_prompt $" { ++ # The filename does not fit there anyway so do not check it. ++ pass $test ++ } ++ -re ".*registers from core file: File in wrong format.* $" { ++ fail "core-file command (could not read registers from core file)" ++ } ++} ++ ++set test "backtrace" ++gdb_test_multiple "bt" $test { ++ -re "#0 *initialized \\\(\\\) at .*#1 .* main \\\(.*$gdb_prompt $" { ++ pass $test ++ } ++ -re "#0 *initialized \\\(\\\) at .*Cannot access memory at address .*$gdb_prompt $" { ++ fail $test ++ } ++} diff --git a/gdb-6.5-bz109921-DW_AT_decl_file-test.patch b/gdb-6.5-bz109921-DW_AT_decl_file-test.patch new file mode 100644 index 0000000..8d03e3f --- /dev/null +++ b/gdb-6.5-bz109921-DW_AT_decl_file-test.patch @@ -0,0 +1,134 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jan Kratochvil +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.5-bz109921-DW_AT_decl_file-test.patch + +;; Find symbols properly at their original (included) file (BZ 109921). +;;=fedoratest + +https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109921 + +It is duplicite to its upstream variant: +http://sourceware.org/ml/gdb-cvs/2007-01/msg00157.html +http://sourceware.org/ml/gdb-patches/2007-01/msg00434.html +2007-01-21 Jan Kratochvil + Daniel Jacobowitz + + * gdb.base/included.c, gdb.base/included.exp, + gdb.base/included.h: New files. + +------------------------------------------------------------------------------ + +2007-01-09 Jan Kratochvil + + * gdb.dwarf2/dw2-included.exp, gdb.dwarf2/dw2-included.c, + gdb.dwarf2/dw2-included.h: New files. + +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-included.c b/gdb/testsuite/gdb.dwarf2/dw2-included.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/dw2-included.c +@@ -0,0 +1,26 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2006 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++ USA. */ ++ ++#include "dw2-included.h" ++ ++int ++main() ++{ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-included.exp b/gdb/testsuite/gdb.dwarf2/dw2-included.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/dw2-included.exp +@@ -0,0 +1,47 @@ ++# Copyright 2006 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++# Minimal DWARF-2 unit test ++ ++# This test can only be run on targets which support DWARF-2. ++# For now pick a sampling of likely targets. ++if {![istarget *-*-linux*] ++ && ![istarget *-*-gnu*] ++ && ![istarget *-*-elf*] ++ && ![istarget *-*-openbsd*] ++ && ![istarget arm-*-eabi*] ++ && ![istarget powerpc-*-eabi*]} { ++ return 0 ++} ++ ++set testfile "dw2-included" ++set srcfile ${testfile}.c ++set binfile [standard_output_file ${testfile}] ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++gdb_test "set listsize 1" "" ++gdb_test "list integer" "int integer;\r" ++gdb_test "ptype integer" "type = int\r" ++# Path varies depending on the build location. ++gdb_test "info variables integer" "\r\nFile \[^\r\n\]*/gdb.dwarf2/dw2-included.h:\r\n${decimal}:.*int integer;\r" +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-included.h b/gdb/testsuite/gdb.dwarf2/dw2-included.h +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/dw2-included.h +@@ -0,0 +1,20 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2006 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ++ USA. */ ++ ++int integer; diff --git a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch new file mode 100644 index 0000000..6a9fcad --- /dev/null +++ b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch @@ -0,0 +1,264 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jan Kratochvil +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch + +;; Support TLS symbols (+`errno' suggestion if no pthread is found) (BZ 185337). +;;=push+jan: It should be replaced by Infinity project. + +https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185337 + +2008-02-24 Jan Kratochvil + + Port to GDB-6.8pre. + +currently for trivial nonthreaded helloworld with no debug info up to -ggdb2 you +will get: + (gdb) p errno + [some error] + +* with -ggdb2 and less "errno" in fact does not exist anywhere as it was + compiled to "(*__errno_location ())" and the macro definition is not present. + Unfortunately gdb will find the TLS symbol and it will try to access it but + as the program has been compiled without -lpthread the TLS base register + (%gs on i386) is not setup and it will result in: + Cannot access memory at address 0x8 + +Attached suggestion patch how to deal with the most common "errno" symbol +for the most common under-ggdb3 compiled programs. + +Original patch hooked into target_translate_tls_address. But its inferior +call invalidates `struct frame *' in the callers - RH BZ 690908. + +https://bugzilla.redhat.com/show_bug.cgi?id=1166549 + +2007-11-03 Jan Kratochvil + + * ./gdb/dwarf2read.c (read_partial_die, dwarf2_linkage_name): Prefer + DW_AT_MIPS_linkage_name over DW_AT_name now only for non-C. + +glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug: + <81a2> DW_AT_name : (indirect string, offset: 0x280e): __errno_location + <81a8> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2808): *__GI___errno_location + +diff --git a/gdb/printcmd.c b/gdb/printcmd.c +--- a/gdb/printcmd.c ++++ b/gdb/printcmd.c +@@ -1300,6 +1300,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) ++ exp = "*(*(int *(*)(void)) __errno_location) ()"; + /* 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 ++++ b/gdb/testsuite/gdb.dwarf2/dw2-errno.c +@@ -0,0 +1,28 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2005, 2007 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . ++ ++ Please email any bugs, comments, and/or additions to this file to: ++ bug-gdb@prep.ai.mit.edu */ ++ ++#include ++ ++int main() ++{ ++ errno = 42; ++ ++ return 0; /* breakpoint */ ++} +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno.exp b/gdb/testsuite/gdb.dwarf2/dw2-errno.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/dw2-errno.exp +@@ -0,0 +1,60 @@ ++# Copyright 2007 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++set testfile dw2-errno ++set srcfile ${testfile}.c ++set binfile [standard_output_file ${testfile}] ++ ++proc prep {} { ++ global srcdir subdir binfile ++ gdb_exit ++ gdb_start ++ gdb_reinitialize_dir $srcdir/$subdir ++ gdb_load ${binfile} ++ ++ runto_main ++ ++ gdb_breakpoint [gdb_get_line_number "breakpoint"] ++ gdb_continue_to_breakpoint "breakpoint" ++} ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g2"] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++prep ++gdb_test "print errno" ".* = 42" "errno with macros=N threads=N" ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g3"] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++prep ++gdb_test "print errno" ".* = 42" "errno with macros=Y threads=N" ++ ++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g2"] != "" } { ++ return -1 ++} ++prep ++gdb_test "print errno" ".* = 42" "errno with macros=N threads=Y" ++ ++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "additional_flags=-g3"] != "" } { ++ return -1 ++} ++prep ++gdb_test "print errno" ".* = 42" "errno with macros=Y threads=Y" ++ ++# TODO: Test the error on resolving ERRNO with only libc loaded. ++# Just how to find the current libc filename? +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno2.c b/gdb/testsuite/gdb.dwarf2/dw2-errno2.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/dw2-errno2.c +@@ -0,0 +1,28 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2005, 2007 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . ++ ++ Please email any bugs, comments, and/or additions to this file to: ++ bug-gdb@prep.ai.mit.edu */ ++ ++#include ++ ++int main() ++{ ++ errno = 42; ++ ++ return 0; /* breakpoint */ ++} +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-errno2.exp b/gdb/testsuite/gdb.dwarf2/dw2-errno2.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/dw2-errno2.exp +@@ -0,0 +1,71 @@ ++# Copyright 2007 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++set testfile dw2-errno2 ++set srcfile ${testfile}.c ++set binfile [standard_output_file ${testfile}] ++ ++proc prep { message {do_xfail 0} } { with_test_prefix $message { ++ global srcdir subdir binfile variant ++ gdb_exit ++ gdb_start ++ gdb_reinitialize_dir $srcdir/$subdir ++ gdb_load ${binfile}${variant} ++ ++ runto_main ++ ++ gdb_breakpoint [gdb_get_line_number "breakpoint"] ++ gdb_continue_to_breakpoint "breakpoint" ++ ++ gdb_test "gcore ${binfile}${variant}.core" "\r\nSaved corefile .*" "gcore $variant" ++ ++ gdb_test "print errno" ".* = 42" ++ ++ gdb_test "kill" ".*" "kill" {Kill the program being debugged\? \(y or n\) } "y" ++ gdb_test "core-file ${binfile}${variant}.core" "\r\nCore was generated by .*" "core-file" ++ if $do_xfail { ++ setup_xfail "*-*-*" ++ } ++ gdb_test "print (int) errno" ".* = 42" "print errno for core" ++}} ++ ++set variant g2thrN ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g2"] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++prep "macros=N threads=N" 1 ++ ++set variant g3thrN ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g3"] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++prep "macros=Y threads=N" 1 ++ ++set variant g2thrY ++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g2"] != "" } { ++ return -1 ++} ++prep "macros=N threads=Y" ++ ++set variant g3thrY ++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g3"] != "" } { ++ return -1 ++} ++prep "macros=Y threads=Y" 1 ++ ++# TODO: Test the error on resolving ERRNO with only libc loaded. ++# Just how to find the current libc filename? diff --git a/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch b/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch new file mode 100644 index 0000000..db4229d --- /dev/null +++ b/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch @@ -0,0 +1,107 @@ +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-ppc-solib-trampoline-test.patch + +;; Test sideeffects of skipping ppc .so libs trampolines (BZ 218379). +;;=fedoratest + +https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379 + +diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.c b/gdb/testsuite/gdb.base/step-over-trampoline.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/step-over-trampoline.c +@@ -0,0 +1,28 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2006 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++ Please email any bugs, comments, and/or additions to this file to: ++ bug-gdb@prep.ai.mit.edu */ ++ ++#include ++ ++int main (void) ++{ ++ puts ("hello world"); ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.exp b/gdb/testsuite/gdb.base/step-over-trampoline.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/step-over-trampoline.exp +@@ -0,0 +1,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. ++ ++if {[use_gdb_stub]} { ++ untested "skipping test because of use_gdb_stub" ++ return -1 ++} ++ ++if $tracelevel then { ++ strace $tracelevel ++} ++ ++set testfile step-over-trampoline ++set srcfile ${testfile}.c ++set binfile [standard_output_file ${testfile}] ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++ ++# Get things started. ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++# For C programs, "start" should stop in main(). ++ ++gdb_test "start" \ ++ "main \\(\\) at .*$srcfile.*" \ ++ "start" ++ ++# main () at hello2.c:5 ++# 5 puts("hello world\n"); ++# (gdb) next ++# 0x100007e0 in call___do_global_ctors_aux () ++ ++gdb_test_multiple "next" "invalid `next' output" { ++ -re "\nhello world.*return 0;.*" { ++ pass "stepped over" ++ } ++ -re " in call___do_global_ctors_aux \\(\\).*" { ++ fail "stepped into trampoline" ++ } ++} diff --git a/gdb-6.5-bz243845-stale-testing-zombie-test.patch b/gdb-6.5-bz243845-stale-testing-zombie-test.patch new file mode 100644 index 0000000..2d62949 --- /dev/null +++ b/gdb-6.5-bz243845-stale-testing-zombie-test.patch @@ -0,0 +1,89 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.5-bz243845-stale-testing-zombie-test.patch + +;; Test leftover zombie process (BZ 243845). +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.base/tracefork-zombie.exp b/gdb/testsuite/gdb.base/tracefork-zombie.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/tracefork-zombie.exp +@@ -0,0 +1,76 @@ ++# Copyright 2007 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ++ ++# are we on a target board ++if {[use_gdb_stub]} { ++ untested "skipping test because of use_gdb_stub" ++ return -1 ++} ++ ++# Start the program running and then wait for a bit, to be sure ++# that it can be attached to. ++ ++gdb_exit ++gdb_start ++gdb_load sleep ++ ++set gdb_pid [exp_pid -i [board_info host fileid]] ++set test "identified the child GDB" ++if {$gdb_pid != "" && $gdb_pid > 0} { ++ pass $test ++ verbose -log "Child GDB PID $gdb_pid" ++} else { ++ fail $test ++} ++ ++set testpid [eval exec sleep 10 &] ++exec sleep 2 ++ ++set test "attach" ++gdb_test_multiple "attach $testpid" "$test" { ++ -re "Attaching to program.*`?.*'?, process $testpid..*$gdb_prompt $" { ++ pass "$test" ++ } ++ -re "Attaching to program.*`?.*\.exe'?, process $testpid.*\[Switching to thread $testpid\..*\].*$gdb_prompt $" { ++ # Response expected on Cygwin ++ pass "$test" ++ } ++} ++ ++# Some time to let GDB spawn its testing child. ++exec sleep 2 ++ ++set found none ++foreach procpid [glob -directory /proc -type d {[0-9]*}] { ++ if {[catch {open $procpid/status} statusfi]} { ++ continue ++ } ++ set status [read $statusfi] ++ close $statusfi ++ if {1 ++ && [regexp -line {^Name:\tgdb$} $status] ++ && [regexp -line {^PPid:\t1$} $status] ++ && [regexp -line "^TracerPid:\t$gdb_pid$" $status]} { ++ set found $procpid ++ verbose -log "Found linux_test_for_tracefork zombie PID $procpid" ++ } ++} ++set test "linux_test_for_tracefork leaves no zombie" ++if {$found eq {none}} { ++ pass $test ++} else { ++ fail $test ++} diff --git a/gdb-6.5-gcore-buffer-limit-test.patch b/gdb-6.5-gcore-buffer-limit-test.patch new file mode 100644 index 0000000..07ba1e9 --- /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 new file mode 100644 index 0000000..6efdca9 --- /dev/null +++ b/gdb-6.5-ia64-libunwind-leak-test.patch @@ -0,0 +1,135 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.5-ia64-libunwind-leak-test.patch + +;; Test ia64 memory leaks of the code using libunwind. +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.base/unwind-leak.c b/gdb/testsuite/gdb.base/unwind-leak.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/unwind-leak.c +@@ -0,0 +1,29 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2007 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++ Please email any bugs, comments, and/or additions to this file to: ++ bug-gdb@prep.ai.mit.edu */ ++ ++#include ++ ++int main() ++{ ++ for (;;) ++ alarm (0); ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/unwind-leak.exp b/gdb/testsuite/gdb.base/unwind-leak.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/unwind-leak.exp +@@ -0,0 +1,88 @@ ++# Copyright 2007 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++if {[use_gdb_stub]} { ++ untested "skipping test because of use_gdb_stub" ++ return -1 ++} ++ ++set testfile unwind-leak ++set srcfile ${testfile}.c ++set shfile [standard_output_file ${testfile}-gdb.sh] ++set binfile [standard_output_file ${testfile}] ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++ ++# Get things started. ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++set pid [exp_pid -i [board_info host fileid]] ++ ++# For C programs, "start" should stop in main(). ++ ++gdb_test "start" \ ++ "main \\(\\) at .*$srcfile.*" \ ++ "start" ++ ++set loc [gdb_get_line_number "alarm"] ++gdb_breakpoint $loc ++ ++proc memory_get {} { ++ global pid ++ set fd [open "/proc/$pid/statm"] ++ gets $fd line ++ close $fd ++ # number of pages of data/stack ++ scan $line "%*d%*d%*d%*d%*d%d" drs ++ return $drs ++} ++ ++set cycles 100 ++# For 100 cycles it was 1308: from = 363 KB, to = 1671 KB ++set permit_kb 100 ++verbose -log "cycles = $cycles, permit_kb = $permit_kb" ++ ++set fail 0 ++set test "breakpoint stop/continue cycles" ++for {set i $cycles} {$i > 0} {set i [expr {$i - 1}]} { ++ gdb_test_multiple "continue" $test { ++ -re "Breakpoint 2, main .*alarm .*.*${gdb_prompt} $" { ++ } ++ -re "Segmentation fault" { ++ fail $test ++ set i 0 ++ set fail 1 ++ } ++ } ++ if ![info exists from] { ++ set from [memory_get] ++ } ++} ++set to [memory_get] ++if {!$fail} { ++ verbose -log "from = $from KB, to = $to KB" ++ if {$from > 0 && $to > 10 && $to < $from + $permit_kb} { ++ pass $test ++ } else { ++ fail $test ++ } ++} diff --git a/gdb-6.5-last-address-space-byte-test.patch b/gdb-6.5-last-address-space-byte-test.patch new file mode 100644 index 0000000..e99d811 --- /dev/null +++ b/gdb-6.5-last-address-space-byte-test.patch @@ -0,0 +1,62 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.5-last-address-space-byte-test.patch + +;; Testcase for deadlocking on last address space byte; for corrupted backtraces. +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.base/largecore-last-address-lock.exp b/gdb/testsuite/gdb.base/largecore-last-address-lock.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/largecore-last-address-lock.exp +@@ -0,0 +1,49 @@ ++# Copyright 2006 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++if $tracelevel then { ++ strace $tracelevel ++} ++ ++# Get things started. ++ ++gdb_exit ++gdb_start ++ ++# i386 (32-bit) only: gdb with Red Hat largecore patch did lock up: ++# https://enterprise.redhat.com/issue-tracker/?module=issues&action=view&tid=103263 ++# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=210614 ++ ++# i386: Bug exists when the `target_xfer_memory' condition ++# `(memaddr + len < region->hi)' operates on 64-bit operands on ++# largecore-patched with 32-bit addresses and so it can get `false' with ++# arbitrary `len'. ++ ++# x86_64: The bug is not present as the operands and calculations have the same ++# bit size. Would would still need to pass there the highest address ++# (`memaddr == 0xffffffffffffffff') but we would need to pass `len == 0' ++# to make the condition `(memaddr + len < region->hi)' false. ++# `len == 0' would get caught eariler. ++ ++# Error in the success case is immediate. ++set timeoutold ${timeout} ++set timeout 10 ++ ++gdb_test "x/xb 0xffffffff" \ ++ "Cannot access memory at address 0xffffffff" \ ++ "Read the last address space byte" ++ ++set timeout ${timeoutold} diff --git a/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..0ad8ad1 --- /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-section-num-fixup-test.patch b/gdb-6.5-section-num-fixup-test.patch new file mode 100644 index 0000000..2fa3995 --- /dev/null +++ b/gdb-6.5-section-num-fixup-test.patch @@ -0,0 +1,127 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.5-section-num-fixup-test.patch + +;; Test a crash on libraries missing the .text section. +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.base/datalib-lib.c b/gdb/testsuite/gdb.base/datalib-lib.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/datalib-lib.c +@@ -0,0 +1,22 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2008 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++ Please email any bugs, comments, and/or additions to this file to: ++ bug-gdb@prep.ai.mit.edu */ ++ ++int var; +diff --git a/gdb/testsuite/gdb.base/datalib-main.c b/gdb/testsuite/gdb.base/datalib-main.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/datalib-main.c +@@ -0,0 +1,26 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2008 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++ Please email any bugs, comments, and/or additions to this file to: ++ bug-gdb@prep.ai.mit.edu */ ++ ++int ++main (void) ++{ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/datalib.exp b/gdb/testsuite/gdb.base/datalib.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/datalib.exp +@@ -0,0 +1,56 @@ ++# Copyright 2008 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++if {[use_gdb_stub]} { ++ untested "skipping test because of use_gdb_stub" ++ return -1 ++} ++ ++set testfile datalib ++set srcfilemain ${testfile}-main.c ++set srcfilelib ${testfile}-lib.c ++set libfile [standard_output_file ${testfile}-lib.so] ++set binfile [standard_output_file ${testfile}-main] ++if { [gdb_compile "${srcdir}/${subdir}/${srcfilelib}" "${libfile}" executable [list debug {additional_flags=-shared -nostdlib}]] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++if { [gdb_compile "${srcdir}/${subdir}/${srcfilemain}" "${binfile} ${libfile}" executable {debug}] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++ ++# Get things started. ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++# We must use a separate library as the main executable is compiled to the ++# address 0 by default and it would get fixed up already at the end of ++# INIT_OBJFILE_SECT_INDICES. We also cannot PRELINK it as PRELINK is missing ++# on ia64. The library must be NOSTDLIB as otherwise some stub code would ++# create the `.text' section there. Also DEBUG option is useful as some of ++# the crashes occur in dwarf2read.c. ++ ++# FAIL case: ++# ../../gdb/ia64-tdep.c:2838: internal-error: sect_index_text not initialized ++# A problem internal to GDB has been detected, ++ ++gdb_test "start" \ ++ "main \\(\\) at .*${srcfilemain}.*" \ ++ "start" diff --git a/gdb-6.5-sharedlibrary-path.patch b/gdb-6.5-sharedlibrary-path.patch new file mode 100644 index 0000000..360e5d3 --- /dev/null +++ b/gdb-6.5-sharedlibrary-path.patch @@ -0,0 +1,193 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jan Kratochvil +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.5-sharedlibrary-path.patch + +;; Fix TLS symbols resolving for shared libraries with a relative pathname. +;; The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'. +;;=fedoratest: One should recheck if it is really fixed upstream. + +If you provided some relative path to the shared library, such as with + export LD_LIBRARY_PATH=. +then gdb would fail to match the shared library name during the TLS lookup. + +Dropped the workaround/fix for gdb-6.8.50.20081128 - is it still needed? + +The testsuite needs `gdb-6.3-bz146810-solib_absolute_prefix_is_empty.patch'. +The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'. + +2006-09-01 Jan Kratochvil + + * solib-svr4.c (svr4_fetch_objfile_link_map): Match even absolute + requested pathnames to the internal loaded relative pathnames. + +2007-10-16 Jan Kratochvil + + Port to GDB-6.7. + +2008-02-27 Jan Kratochvil + + Port to gdb-6.7.50.20080227. + +diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-main.c b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c +@@ -0,0 +1,31 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2006 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++ Please email any bugs, comments, and/or additions to this file to: ++ bug-gdb@prep.ai.mit.edu */ ++ ++#include ++ ++extern __thread int var; ++ ++int main() ++{ ++ /* Ensure we link against pthreads even with --as-needed. */ ++ pthread_testcancel(); ++ return var; ++} +diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c b/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/tls-sepdebug-shared.c +@@ -0,0 +1,22 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2006 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++ Please email any bugs, comments, and/or additions to this file to: ++ bug-gdb@prep.ai.mit.edu */ ++ ++__thread int var = 42; +diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug.exp b/gdb/testsuite/gdb.threads/tls-sepdebug.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/tls-sepdebug.exp +@@ -0,0 +1,94 @@ ++# Copyright 2006 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++# This test uses gdb_exit and gdb_start, which are not supported ++# on non-extended-remote sessions. ++if {[use_gdb_stub]} { ++ untested "skipping test because of stub" ++ return 0 ++} ++ ++if $tracelevel then { ++ strace $tracelevel ++} ++ ++set testfile tls-sepdebug ++set srcmainfile ${testfile}-main.c ++set srcsharedfile ${testfile}-shared.c ++ ++set binmainfile [standard_output_file ${testfile}-main] ++set binsharedbase ${testfile}-shared.so ++set binsharedfile [standard_output_file ${binsharedbase}] ++set binshareddebugfile [standard_output_file ${binsharedbase}.debug] ++ ++# Use explicit -soname as otherwise the full path to the library would get ++# encoded into ${binmainfile} making LD_LIBRARY_PATH tests useless. ++ ++# FIXME: gcc dependency (-Wl,-soname). ++ ++if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" [list debug additional_flags=-Wl,-soname=${binsharedbase}]] != "" } { ++ untested "Couldn't compile test library" ++ return -1 ++} ++ ++# eu-strip(1) works fine but it is a part of `elfutils', not `binutils'. ++if 0 then { ++ remote_exec build "eu-strip -f ${binshareddebugfile} ${binsharedfile}" ++} else { ++ remote_exec build "objcopy --only-keep-debug ${binsharedfile} ${binshareddebugfile}" ++ remote_exec build "objcopy --strip-debug ${binsharedfile}" ++ remote_exec build "objcopy --add-gnu-debuglink=${binshareddebugfile} ${binsharedfile}" ++} ++ ++# Do not use `shlib=' as it will automatically add also -rpath for gcc. ++ ++if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcmainfile} ${binsharedfile}" "${binmainfile}" executable {debug}] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++ ++# Get things started. ++ ++# Test also the proper resolving of relative library names to absolute ones. ++# \$PWD is easy - it is the absolute way ++# ${subdir} would fail on "print var" ++ ++set absdir [file dirname [standard_output_file ${binsharedbase}]] ++foreach ld_library_path [list $absdir [relative_filename [pwd] $absdir]] name { absolute relative } { ++ ++ gdb_exit ++ gdb_start ++ ###gdb_reinitialize_dir $srcdir/$subdir ++ ++ gdb_test "set env LD_LIBRARY_PATH=$ld_library_path" \ ++ "" \ ++ "set env LD_LIBRARY_PATH is $name" ++ ++ gdb_load ${binmainfile} ++ ++ # For C programs, "start" should stop in main(). ++ ++ gdb_test "start" \ ++ "main \\(\\) at .*${srcmainfile}.*" \ ++ "start" ++ ++ # Check for: Cannot find shared library `/usr/lib/debug/lib/libc-2.4.90.so.debug' in dynamic linker's load module list ++ # as happens with TLS variables and `separate_debug_objfile_backlink'. ++ ++ gdb_test "print var" \ ++ "\\\$1 = \[0-9\].*" \ ++ "print TLS variable from a shared library with $name-directory separate debug info file" ++} diff --git a/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch b/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch new file mode 100644 index 0000000..2b862a0 --- /dev/null +++ b/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch @@ -0,0 +1,19 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch + +;; Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879). +;;=push+jan + +diff --git a/gdb/proc-service.list b/gdb/proc-service.list +--- a/gdb/proc-service.list ++++ b/gdb/proc-service.list +@@ -37,4 +37,7 @@ + ps_pstop; + ps_ptread; + ps_ptwrite; ++ ++ /* gdb-6.6-buildid-locate-rpm.patch */ ++ rpmsqEnable; + }; diff --git a/gdb-6.6-buildid-locate-rpm-suse.patch b/gdb-6.6-buildid-locate-rpm-suse.patch new file mode 100644 index 0000000..80ced78 --- /dev/null +++ b/gdb-6.6-buildid-locate-rpm-suse.patch @@ -0,0 +1,136 @@ +From 444f438fe775a9480b93dc7d63418e0e169b4fbd Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Fri, 21 Apr 2023 09:08:03 +0200 +Subject: [PATCH 1/5] gdb-6.6-buildid-locate-rpm-suse.patch + +--- + gdb/build-id.c | 71 +++++++++----------------------------------------- + 1 file changed, 13 insertions(+), 58 deletions(-) + +diff --git a/gdb/build-id.c b/gdb/build-id.c +index 86dfc8409b5..29aa10d8225 100644 +--- a/gdb/build-id.c ++++ b/gdb/build-id.c +@@ -863,10 +863,8 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor) + #endif + { + Header h; +- char *debuginfo, **slot, *s, *s2; ++ char *debuginfo, **slot; + errmsg_t err; +- size_t srcrpmlen = sizeof (".src.rpm") - 1; +- size_t debuginfolen = sizeof ("-debuginfo") - 1; + rpmdbMatchIterator mi_debuginfo; + + h = rpmdbNextIterator_p (mi); +@@ -875,7 +873,9 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor) + + /* Verify the debuginfo file is not already installed. */ + +- debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}", ++ /* The allocated memory gets utilized below for MISSING_RPM_HASH. */ ++ debuginfo = headerFormat_p (h, ++ "%{name}-debuginfo-%{version}-%{release}.%{arch}", + &err); + if (!debuginfo) + { +@@ -883,60 +883,19 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor) + err); + continue; + } +- /* s = `.src.rpm-debuginfo.%{arch}' */ +- s = strrchr (debuginfo, '-') - srcrpmlen; +- s2 = NULL; +- if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0) +- { +- /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */ +- s2 = (char *) memrchr (debuginfo, '-', s - debuginfo); +- } +- if (s2) +- { +- /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */ +- s2 = (char *) memrchr (debuginfo, '-', s2 - debuginfo); +- } +- if (!s2) +- { +- warning (_("Error querying the rpm file `%s': %s"), filename, +- debuginfo); +- xfree (debuginfo); +- continue; +- } +- /* s = `.src.rpm-debuginfo.%{arch}' */ +- /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */ +- memmove (s2 + debuginfolen, s2, s - s2); +- memcpy (s2, "-debuginfo", debuginfolen); +- /* s = `XXXX.%{arch}' */ +- /* strlen ("XXXX") == srcrpmlen + debuginfolen */ +- /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */ +- /* strlen ("XX") == srcrpmlen */ +- memmove (s + debuginfolen, s + srcrpmlen + debuginfolen, +- strlen (s + srcrpmlen + debuginfolen) + 1); +- /* s = `-debuginfo-%{version}-%{release}.%{arch}' */ + ++ /* Verify the debuginfo file is not already installed. */ + /* RPMDBI_PACKAGES requires keylen == sizeof (int). */ + /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */ + mi_debuginfo = rpmtsInitIterator_p (ts, (rpmDbiTagVal) RPMDBI_LABEL, debuginfo, 0); +- xfree (debuginfo); + if (mi_debuginfo) + { ++ xfree (debuginfo); + rpmdbFreeIterator_p (mi_debuginfo); + count = 0; + break; + } + +- /* The allocated memory gets utilized below for MISSING_RPM_HASH. */ +- debuginfo = headerFormat_p (h, +- "%{name}-%{version}-%{release}.%{arch}", +- &err); +- if (!debuginfo) +- { +- warning (_("Error querying the rpm file `%s': %s"), filename, +- err); +- continue; +- } +- + /* Base package name for `debuginfo-install'. We do not use the + `yum' command directly as the line + yum --enablerepo='*debug*' install NAME-debuginfo.ARCH +@@ -1085,10 +1044,7 @@ missing_rpm_list_print (void) + missing_rpm_list_entries = 0; + + gdb_printf (_("Missing separate debuginfos, use: %s"), +-#ifdef DNF_DEBUGINFO_INSTALL +- "dnf " +-#endif +- "debuginfo-install"); ++ "zypper install"); + for (const char *el : array) + { + gdb_printf (" %s", el); +@@ -1295,13 +1251,12 @@ debug_print_missing (const char *binary, const char *debug) + gdb_printf (gdb_stdlog, + _("Missing separate debuginfo for %s\n"), binary); + if (debug != NULL) +- gdb_printf (gdb_stdlog, _("Try: %s %s\n"), +-#ifdef DNF_DEBUGINFO_INSTALL +- "dnf" +-#else +- "yum" +-#endif +- " --enablerepo='*debug*' install", debug); ++ { ++ const char *p = strrchr (debug, '/'); ++ gdb_printf (gdb_stdlog, _("Try: %s%.2s%.38s\"\n"), ++ "zypper install -C \"debuginfo(build-id)=", ++ p - 2, p + 1); ++ } + } + } + + +base-commit: 91ac179279557e27e6a149cbb78e4052a348f109 +-- +2.35.3 + diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch new file mode 100644 index 0000000..051f3cb --- /dev/null +++ b/gdb-6.6-buildid-locate-rpm.patch @@ -0,0 +1,1082 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Wed, 22 Feb 2023 22:30:40 -0700 +Subject: gdb-6.6-buildid-locate-rpm.patch + +;;=push+jan + +diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 +--- a/gdb/aclocal.m4 ++++ b/gdb/aclocal.m4 +@@ -11,7 +11,223 @@ + # even the implied warranty of MERCHANTABILITY or FITNESS FOR A + # PARTICULAR PURPOSE. + ++# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- ++# serial 1 (pkg-config-0.24) ++# ++# Copyright © 2004 Scott James Remnant . ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, but ++# WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++# General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++# ++# As a special exception to the GNU General Public License, if you ++# distribute this file as part of a program that contains a ++# configuration script generated by Autoconf, you may include it under ++# the same distribution terms that you use for the rest of that program. ++ ++# PKG_PROG_PKG_CONFIG([MIN-VERSION]) ++# ---------------------------------- ++AC_DEFUN([PKG_PROG_PKG_CONFIG], ++[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) ++m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) ++m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) ++AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) ++AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) ++AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) ++ ++if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then ++ AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) ++fi ++if test -n "$PKG_CONFIG"; then ++ _pkg_min_version=m4_default([$1], [0.9.0]) ++ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) ++ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then ++ AC_MSG_RESULT([yes]) ++ else ++ AC_MSG_RESULT([no]) ++ PKG_CONFIG="" ++ fi ++fi[]dnl ++])# PKG_PROG_PKG_CONFIG ++ ++# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) ++# ++# Check to see whether a particular set of modules exists. Similar ++# to PKG_CHECK_MODULES(), but does not set variables or print errors. ++# ++# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) ++# only at the first occurence in configure.ac, so if the first place ++# it's called might be skipped (such as if it is within an "if", you ++# have to call PKG_CHECK_EXISTS manually ++# -------------------------------------------------------------- ++AC_DEFUN([PKG_CHECK_EXISTS], ++[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl ++if test -n "$PKG_CONFIG" && \ ++ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then ++ m4_default([$2], [:]) ++m4_ifvaln([$3], [else ++ $3])dnl ++fi]) ++ ++# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) ++# --------------------------------------------- ++m4_define([_PKG_CONFIG], ++[if test -n "$$1"; then ++ pkg_cv_[]$1="$$1" ++ elif test -n "$PKG_CONFIG"; then ++ PKG_CHECK_EXISTS([$3], ++ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ], ++ [pkg_failed=yes]) ++ else ++ pkg_failed=untried ++fi[]dnl ++])# _PKG_CONFIG ++ ++# _PKG_SHORT_ERRORS_SUPPORTED ++# ----------------------------- ++AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], ++[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) ++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then ++ _pkg_short_errors_supported=yes ++else ++ _pkg_short_errors_supported=no ++fi[]dnl ++])# _PKG_SHORT_ERRORS_SUPPORTED ++ ++ ++# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], ++# [ACTION-IF-NOT-FOUND]) ++# ++# ++# Note that if there is a possibility the first call to ++# PKG_CHECK_MODULES might not happen, you should be sure to include an ++# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac ++# ++# ++# -------------------------------------------------------------- ++AC_DEFUN([PKG_CHECK_MODULES], ++[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl ++AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl ++AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl ++ ++pkg_failed=no ++AC_MSG_CHECKING([for $1]) ++ ++_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) ++_PKG_CONFIG([$1][_LIBS], [libs], [$2]) ++ ++m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS ++and $1[]_LIBS to avoid the need to call pkg-config. ++See the pkg-config man page for more details.]) ++ ++if test $pkg_failed = yes; then ++ AC_MSG_RESULT([no]) ++ _PKG_SHORT_ERRORS_SUPPORTED ++ if test $_pkg_short_errors_supported = yes; then ++ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` ++ else ++ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` ++ fi ++ # Put the nasty error message in config.log where it belongs ++ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD ++ ++ m4_default([$4], [AC_MSG_ERROR( ++[Package requirements ($2) were not met: ++ ++$$1_PKG_ERRORS ++ ++Consider adjusting the PKG_CONFIG_PATH environment variable if you ++installed software in a non-standard prefix. ++ ++_PKG_TEXT])[]dnl ++ ]) ++elif test $pkg_failed = untried; then ++ AC_MSG_RESULT([no]) ++ m4_default([$4], [AC_MSG_FAILURE( ++[The pkg-config script could not be found or is too old. Make sure it ++is in your PATH or set the PKG_CONFIG environment variable to the full ++path to pkg-config. ++ ++_PKG_TEXT ++ ++To get pkg-config, see .])[]dnl ++ ]) ++else ++ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS ++ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS ++ AC_MSG_RESULT([yes]) ++ $3 ++fi[]dnl ++])# PKG_CHECK_MODULES ++ ++ ++# PKG_INSTALLDIR(DIRECTORY) ++# ------------------------- ++# Substitutes the variable pkgconfigdir as the location where a module ++# should install pkg-config .pc files. By default the directory is ++# $libdir/pkgconfig, but the default can be changed by passing ++# DIRECTORY. The user can override through the --with-pkgconfigdir ++# parameter. ++AC_DEFUN([PKG_INSTALLDIR], ++[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) ++m4_pushdef([pkg_description], ++ [pkg-config installation directory @<:@]pkg_default[@:>@]) ++AC_ARG_WITH([pkgconfigdir], ++ [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, ++ [with_pkgconfigdir=]pkg_default) ++AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) ++m4_popdef([pkg_default]) ++m4_popdef([pkg_description]) ++]) dnl PKG_INSTALLDIR ++ ++ ++# PKG_NOARCH_INSTALLDIR(DIRECTORY) ++# ------------------------- ++# Substitutes the variable noarch_pkgconfigdir as the location where a ++# module should install arch-independent pkg-config .pc files. By ++# default the directory is $datadir/pkgconfig, but the default can be ++# changed by passing DIRECTORY. The user can override through the ++# --with-noarch-pkgconfigdir parameter. ++AC_DEFUN([PKG_NOARCH_INSTALLDIR], ++[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) ++m4_pushdef([pkg_description], ++ [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) ++AC_ARG_WITH([noarch-pkgconfigdir], ++ [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, ++ [with_noarch_pkgconfigdir=]pkg_default) ++AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) ++m4_popdef([pkg_default]) ++m4_popdef([pkg_description]) ++]) dnl PKG_NOARCH_INSTALLDIR ++ ++ ++# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, ++# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) ++# ------------------------------------------- ++# Retrieves the value of the pkg-config variable for the given module. ++AC_DEFUN([PKG_CHECK_VAR], ++[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl ++AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl ++ ++_PKG_CONFIG([$1], [variable="][$3]["], [$2]) ++AS_VAR_COPY([$1], [pkg_cv_][$1]) ++ ++AS_VAR_IF([$1], [""], [$5], [$4])dnl ++])# PKG_CHECK_VAR ++ + m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) ++ + # AM_AUX_DIR_EXPAND -*- Autoconf -*- + + # Copyright (C) 2001-2017 Free Software Foundation, Inc. +diff --git a/gdb/build-id.c b/gdb/build-id.c +--- a/gdb/build-id.c ++++ b/gdb/build-id.c +@@ -771,10 +771,10 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor) + static rpmts (*rpmtsCreate_p) (void); + extern rpmts rpmtsFree(rpmts ts); + static rpmts (*rpmtsFree_p) (rpmts ts); +- extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++ extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, + const void * keyp, size_t keylen); + static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts, +- rpmTag rpmtag, ++ rpmDbiTagVal rpmtag, + const void *keyp, + size_t keylen); + #else /* !DLOPEN_LIBRPM */ +@@ -829,7 +829,7 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor) + && (rpmdbNextIterator_p = (Header (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbNextIterator")) + && (rpmtsCreate_p = (rpmts (*) (void)) dlsym (h, "rpmtsCreate")) + && (rpmtsFree_p = (rpmts (*) (rpmts ts)) dlsym (h, "rpmtsFree")) +- && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator")))) ++ && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmDbiTagVal rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator")))) + { + warning (_("Opened library \"%s\" is incompatible (%s), " + "missing debuginfos notifications will not be displayed"), +@@ -917,7 +917,7 @@ missing_rpm_enlist_1 (const char *filename, int verify_vendor) + + /* RPMDBI_PACKAGES requires keylen == sizeof (int). */ + /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */ +- mi_debuginfo = rpmtsInitIterator_p (ts, (rpmTag) RPMDBI_LABEL, debuginfo, 0); ++ mi_debuginfo = rpmtsInitIterator_p (ts, (rpmDbiTagVal) RPMDBI_LABEL, debuginfo, 0); + xfree (debuginfo); + if (mi_debuginfo) + { +diff --git a/gdb/config.in b/gdb/config.in +--- a/gdb/config.in ++++ b/gdb/config.in +@@ -39,6 +39,9 @@ + /* Handle .ctf type-info sections */ + #undef ENABLE_LIBCTF + ++/* librpm version specific library name to dlopen. */ ++#undef DLOPEN_LIBRPM ++ + /* Define to 1 if translation of program messages to the user's native + language is requested. */ + #undef ENABLE_NLS +@@ -259,6 +262,9 @@ + /* Define if you have the mpfr library. */ + #undef HAVE_LIBMPFR + ++/* Define if librpm library is being used. */ ++#undef HAVE_LIBRPM ++ + /* Define to 1 if you have the header file. */ + #undef HAVE_LIBUNWIND_IA64_H + +diff --git a/gdb/configure b/gdb/configure +--- a/gdb/configure ++++ b/gdb/configure +@@ -783,6 +783,11 @@ TARGET_OBS + ENABLE_BFD_64_BIT_FALSE + ENABLE_BFD_64_BIT_TRUE + subdirs ++RPM_LIBS ++RPM_CFLAGS ++PKG_CONFIG_LIBDIR ++PKG_CONFIG_PATH ++PKG_CONFIG + GDB_DATADIR + DEBUGDIR + MAKEINFO_EXTRA_FLAGS +@@ -912,6 +917,7 @@ with_gdb_datadir + with_relocated_sources + with_auto_load_dir + with_auto_load_safe_path ++with_rpm + enable_targets + enable_64_bit_bfd + enable_gdbmi +@@ -992,6 +998,8 @@ PKG_CONFIG_PATH + PKG_CONFIG_LIBDIR + DEBUGINFOD_CFLAGS + DEBUGINFOD_LIBS ++RPM_CFLAGS ++RPM_LIBS + YACC + YFLAGS + ZSTD_CFLAGS +@@ -1678,6 +1686,8 @@ Optional Packages: + do not restrict auto-loaded files locations + --with-debuginfod Enable debuginfo lookups with debuginfod + (auto/yes/no) ++ --with-rpm query rpm database for missing debuginfos (yes/no, ++ def. auto=librpm.so) + --with-libunwind-ia64 use libunwind frame unwinding for ia64 targets + --with-curses use the curses library instead of the termcap + library +@@ -1761,6 +1771,8 @@ Some influential environment variables: + C compiler flags for DEBUGINFOD, overriding pkg-config + DEBUGINFOD_LIBS + linker flags for DEBUGINFOD, overriding pkg-config ++ RPM_CFLAGS C compiler flags for RPM, overriding pkg-config ++ RPM_LIBS linker flags for RPM, overriding pkg-config + YACC The `Yet Another Compiler Compiler' implementation to use. + Defaults to the first program found out of: `bison -y', `byacc', + `yacc'. +@@ -17848,6 +17860,494 @@ _ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5 + $as_echo "$with_auto_load_safe_path" >&6; } + ++# Integration with rpm library to support missing debuginfo suggestions. ++# --without-rpm: Disable any rpm support. ++# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime. ++# Even with runtime missing `libname.so' GDB will still other run correctly. ++# Missing `libname.so' during ./configure will abort the configuration. ++# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific ++# minor version first such as `librpm-4.6.so' as minor version differences ++# mean API+ABI incompatibility. If the specific match versioned library name ++# could not be found still open dynamically at least `librpm.so'. ++# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try ++# to find librpm for compilation-time linking by pkg-config. GDB binary will ++# be probably linked with the version specific library (as `librpm-4.6.so'). ++# Failure to find librpm by pkg-config will abort the configuration. ++# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config ++# cannot find librpm use to the rpmless compilation (like `--without-rpm'). ++ ++ ++# Check whether --with-rpm was given. ++if test "${with_rpm+set}" = set; then : ++ withval=$with_rpm; ++else ++ with_rpm="auto" ++fi ++ ++ ++ ++ ++if test "x$with_rpm" != "xno"; then ++ if test "x$with_rpm" = "xyes"; then ++ LIBRPM="librpm.so" ++ RPM_REQUIRE=true ++ DLOPEN_REQUIRE=false ++ elif test "x$with_rpm" = "xauto"; then ++ LIBRPM="librpm.so" ++ RPM_REQUIRE=false ++ DLOPEN_REQUIRE=false ++ else ++ LIBRPM="$with_rpm" ++ RPM_REQUIRE=true ++ DLOPEN_REQUIRE=true ++ fi ++ LIBRPM_STRING='"'"$LIBRPM"'"' ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking specific librpm version" >&5 ++$as_echo_n "checking specific librpm version... " >&6; } ++ HAVE_DLOPEN_LIBRPM=false ++ save_LIBS="$LIBS" ++ LIBS="$LIBS -ldl" ++ if test "$cross_compiling" = yes; then : ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 ++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} ++as_fn_error "cannot run test program while cross compiling ++See \`config.log' for more details." "$LINENO" 5; } ++else ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++#include ++#include ++#include ++ ++int ++main () ++{ ++ ++ void *h; ++ const char *const *rpmverp; ++ FILE *f; ++ ++ f = fopen ("conftest.out", "w"); ++ if (!f) ++ { ++ fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out", ++ strerror (errno)); ++ return 1; ++ } ++ h = dlopen ($LIBRPM_STRING, RTLD_LAZY); ++ if (!h) ++ { ++ fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ()); ++ return 1; ++ } ++ rpmverp = dlsym (h, "RPMVERSION"); ++ if (!rpmverp) ++ { ++ fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ()); ++ return 1; ++ } ++ fprintf (stderr, "RPMVERSION is: \""); ++ fprintf (stderr, "%s\"\n", *rpmverp); ++ ++ /* Try to find the specific librpm version only for "librpm.so" as we do ++ not know how to assemble the version string otherwise. */ ++ ++ if (strcmp ("librpm.so", $LIBRPM_STRING) != 0) ++ { ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ else ++ { ++ char *h2_name; ++ void *h2; ++ int major, minor; ++ ++ if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2) ++ { ++ fprintf (stderr, "Unable to parse RPMVERSION.\n"); ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ /* Avoid the square brackets by malloc. */ ++ h2_name = malloc (64); ++ sprintf (h2_name, "librpm-%d.%d.so", major, minor); ++ h2 = dlopen (h2_name, RTLD_LAZY); ++ if (!h2) ++ { ++ fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ()); ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ if (h2 != h) ++ { ++ fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n", ++ $LIBRPM_STRING, h2_name); ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ /* Found the valid .so name with a specific version. */ ++ fprintf (f, "%s\n", h2_name); ++ return 0; ++ } ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_run "$LINENO"; then : ++ ++ DLOPEN_LIBRPM="`cat conftest.out`" ++ if test "x$DLOPEN_LIBRPM" != "x"; then ++ HAVE_DLOPEN_LIBRPM=true ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLOPEN_LIBRPM" >&5 ++$as_echo "$DLOPEN_LIBRPM" >&6; } ++ fi ++ ++fi ++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ ++ conftest.$ac_objext conftest.beam conftest.$ac_ext ++fi ++ ++ rm -f conftest.out ++ ++ ++ ++ if $HAVE_DLOPEN_LIBRPM; then ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5 ++$as_echo_n "checking rpm library API compatibility... " >&6; } ++ # The compilation requires -Werror to verify anything. ++ save_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS -Werror" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Duplicate here the declarations to verify they match "elfread.c". */ ++#include ++#include ++#include ++#include ++extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); ++extern int rpmReadConfigFiles(const char * file, const char * target); ++extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); ++extern Header rpmdbNextIterator(rpmdbMatchIterator mi); ++extern rpmts rpmtsCreate(void); ++extern rpmts rpmtsFree(rpmts ts); ++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, ++ const void * keyp, size_t keylen); ++ ++int ++main () ++{ ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO"; then : ++ ++ LIBRPM_COMPAT=true ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ ++else ++ ++ LIBRPM_COMPAT=false ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++ CFLAGS="$save_CFLAGS" ++ ++ if ! $LIBRPM_COMPAT; then ++ HAVE_DLOPEN_LIBRPM=false ++ fi ++ fi ++ ++ if $HAVE_DLOPEN_LIBRPM; then ++ DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"' ++ ++cat >>confdefs.h <<_ACEOF ++#define DLOPEN_LIBRPM $DLOPEN_LIBRPM_STRING ++_ACEOF ++ ++ ++$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h ++ ++ else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ LIBS="$save_LIBS" ++ if $DLOPEN_REQUIRE; then ++ as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5 ++ fi ++ ++ ++ ++ ++ ++ ++ ++if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then ++ if test -n "$ac_tool_prefix"; then ++ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. ++set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : ++ $as_echo_n "(cached) " >&6 ++else ++ case $PKG_CONFIG in ++ [\\/]* | ?:[\\/]*) ++ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ++ ;; ++ *) ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ++ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++ ;; ++esac ++fi ++PKG_CONFIG=$ac_cv_path_PKG_CONFIG ++if test -n "$PKG_CONFIG"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 ++$as_echo "$PKG_CONFIG" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ ++fi ++if test -z "$ac_cv_path_PKG_CONFIG"; then ++ ac_pt_PKG_CONFIG=$PKG_CONFIG ++ # Extract the first word of "pkg-config", so it can be a program name with args. ++set dummy pkg-config; ac_word=$2 ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 ++$as_echo_n "checking for $ac_word... " >&6; } ++if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : ++ $as_echo_n "(cached) " >&6 ++else ++ case $ac_pt_PKG_CONFIG in ++ [\\/]* | ?:[\\/]*) ++ ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ++ ;; ++ *) ++ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR ++for as_dir in $PATH ++do ++ IFS=$as_save_IFS ++ test -z "$as_dir" && as_dir=. ++ for ac_exec_ext in '' $ac_executable_extensions; do ++ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ++ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" ++ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 ++ break 2 ++ fi ++done ++ done ++IFS=$as_save_IFS ++ ++ ;; ++esac ++fi ++ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG ++if test -n "$ac_pt_PKG_CONFIG"; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 ++$as_echo "$ac_pt_PKG_CONFIG" >&6; } ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++fi ++ ++ if test "x$ac_pt_PKG_CONFIG" = x; then ++ PKG_CONFIG="" ++ else ++ case $cross_compiling:$ac_tool_warned in ++yes:) ++{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 ++$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ++ac_tool_warned=yes ;; ++esac ++ PKG_CONFIG=$ac_pt_PKG_CONFIG ++ fi ++else ++ PKG_CONFIG="$ac_cv_path_PKG_CONFIG" ++fi ++ ++fi ++if test -n "$PKG_CONFIG"; then ++ _pkg_min_version=0.9.0 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 ++$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } ++ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ PKG_CONFIG="" ++ fi ++fi ++ ++pkg_failed=no ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RPM" >&5 ++$as_echo_n "checking for RPM... " >&6; } ++ ++if test -n "$RPM_CFLAGS"; then ++ pkg_cv_RPM_CFLAGS="$RPM_CFLAGS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "rpm") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_RPM_CFLAGS=`$PKG_CONFIG --cflags "rpm" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++if test -n "$RPM_LIBS"; then ++ pkg_cv_RPM_LIBS="$RPM_LIBS" ++ elif test -n "$PKG_CONFIG"; then ++ if test -n "$PKG_CONFIG" && \ ++ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"rpm\""; } >&5 ++ ($PKG_CONFIG --exists --print-errors "rpm") 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 ++ test $ac_status = 0; }; then ++ pkg_cv_RPM_LIBS=`$PKG_CONFIG --libs "rpm" 2>/dev/null` ++ test "x$?" != "x0" && pkg_failed=yes ++else ++ pkg_failed=yes ++fi ++ else ++ pkg_failed=untried ++fi ++ ++ ++ ++if test $pkg_failed = yes; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then ++ _pkg_short_errors_supported=yes ++else ++ _pkg_short_errors_supported=no ++fi ++ if test $_pkg_short_errors_supported = yes; then ++ RPM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "rpm" 2>&1` ++ else ++ RPM_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "rpm" 2>&1` ++ fi ++ # Put the nasty error message in config.log where it belongs ++ echo "$RPM_PKG_ERRORS" >&5 ++ ++ HAVE_LIBRPM=false ++elif test $pkg_failed = untried; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ HAVE_LIBRPM=false ++else ++ RPM_CFLAGS=$pkg_cv_RPM_CFLAGS ++ RPM_LIBS=$pkg_cv_RPM_LIBS ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ HAVE_LIBRPM=true ++fi ++ ++ if $HAVE_LIBRPM; then ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking rpm library API compatibility" >&5 ++$as_echo_n "checking rpm library API compatibility... " >&6; } ++ # The compilation requires -Werror to verify anything. ++ save_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS -Werror" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Duplicate here the declarations to verify they match "elfread.c". */ ++#include ++#include ++#include ++#include ++extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); ++extern int rpmReadConfigFiles(const char * file, const char * target); ++extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); ++extern Header rpmdbNextIterator(rpmdbMatchIterator mi); ++extern rpmts rpmtsCreate(void); ++extern rpmts rpmtsFree(rpmts ts); ++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, ++ const void * keyp, size_t keylen); ++ ++int ++main () ++{ ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO"; then : ++ ++ LIBRPM_COMPAT=true ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 ++$as_echo "yes" >&6; } ++ ++else ++ ++ LIBRPM_COMPAT=false ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 ++$as_echo "no" >&6; } ++ ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++ CFLAGS="$save_CFLAGS" ++ ++ if ! $LIBRPM_COMPAT; then ++ HAVE_LIBRPM=false ++ RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB" ++ fi ++ fi ++ ++ if $HAVE_LIBRPM; then ++ ++$as_echo "#define HAVE_LIBRPM 1" >>confdefs.h ++ ++ CFLAGS="$CFLAGS $RPM_CFLAGS" ++ LIBS="$LIBS $RPM_LIBS" ++ else ++ if $RPM_REQUIRE; then ++ as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5 ++ else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5 ++$as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;} ++ fi ++ fi ++ fi ++fi ++ + + + subdirs="$subdirs testsuite" +diff --git a/gdb/configure.ac b/gdb/configure.ac +--- a/gdb/configure.ac ++++ b/gdb/configure.ac +@@ -160,6 +160,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir, + [Directories safe to hold auto-loaded files.]) + AC_MSG_RESULT([$with_auto_load_safe_path]) + ++# Integration with rpm library to support missing debuginfo suggestions. ++# --without-rpm: Disable any rpm support. ++# --with-rpm=libname.so: Try to dynamically open `libname.so' during runtime. ++# Even with runtime missing `libname.so' GDB will still other run correctly. ++# Missing `libname.so' during ./configure will abort the configuration. ++# --with-rpm=librpm.so: Like `--with-rpm=libname.so' but try to find specific ++# minor version first such as `librpm-4.6.so' as minor version differences ++# mean API+ABI incompatibility. If the specific match versioned library name ++# could not be found still open dynamically at least `librpm.so'. ++# --with-rpm: Like `--with-rpm=librpm.so' but if any of its detection fails try ++# to find librpm for compilation-time linking by pkg-config. GDB binary will ++# be probably linked with the version specific library (as `librpm-4.6.so'). ++# Failure to find librpm by pkg-config will abort the configuration. ++# (default) --with-rpm=auto: Like `--with-rpm=librpm.so' but if even pkg-config ++# cannot find librpm use to the rpmless compilation (like `--without-rpm'). ++ ++AC_ARG_WITH([rpm], ++ [AS_HELP_STRING([--with-rpm], ++ [query rpm database for missing debuginfos (yes/no, def. auto=librpm.so)])], [], [with_rpm="auto"]) ++ ++m4_pattern_allow([^AC_MSG_ERROR$]) ++m4_pattern_allow([^AC_MSG_WARN$]) ++if test "x$with_rpm" != "xno"; then ++ if test "x$with_rpm" = "xyes"; then ++ LIBRPM="librpm.so" ++ RPM_REQUIRE=true ++ DLOPEN_REQUIRE=false ++ elif test "x$with_rpm" = "xauto"; then ++ LIBRPM="librpm.so" ++ RPM_REQUIRE=false ++ DLOPEN_REQUIRE=false ++ else ++ LIBRPM="$with_rpm" ++ RPM_REQUIRE=true ++ DLOPEN_REQUIRE=true ++ fi ++ LIBRPM_STRING='"'"$LIBRPM"'"' ++ ++ AC_MSG_CHECKING([specific librpm version]) ++ HAVE_DLOPEN_LIBRPM=false ++ save_LIBS="$LIBS" ++ LIBS="$LIBS -ldl" ++ AC_RUN_IFELSE(AC_LANG_PROGRAM([[ ++#include ++#include ++#include ++ ]], [[ ++ void *h; ++ const char *const *rpmverp; ++ FILE *f; ++ ++ f = fopen ("conftest.out", "w"); ++ if (!f) ++ { ++ fprintf (stderr, "Cannot write \"%s\": %s\n", "conftest.out", ++ strerror (errno)); ++ return 1; ++ } ++ h = dlopen ($LIBRPM_STRING, RTLD_LAZY); ++ if (!h) ++ { ++ fprintf (stderr, "dlopen (\"%s\"): %s\n", $LIBRPM_STRING, dlerror ()); ++ return 1; ++ } ++ rpmverp = dlsym (h, "RPMVERSION"); ++ if (!rpmverp) ++ { ++ fprintf (stderr, "dlsym (\"RPMVERSION\"): %s\n", dlerror ()); ++ return 1; ++ } ++ fprintf (stderr, "RPMVERSION is: \""); ++ fprintf (stderr, "%s\"\n", *rpmverp); ++ ++ /* Try to find the specific librpm version only for "librpm.so" as we do ++ not know how to assemble the version string otherwise. */ ++ ++ if (strcmp ("librpm.so", $LIBRPM_STRING) != 0) ++ { ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ else ++ { ++ char *h2_name; ++ void *h2; ++ int major, minor; ++ ++ if (sscanf (*rpmverp, "%d.%d", &major, &minor) != 2) ++ { ++ fprintf (stderr, "Unable to parse RPMVERSION.\n"); ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ /* Avoid the square brackets by malloc. */ ++ h2_name = malloc (64); ++ sprintf (h2_name, "librpm-%d.%d.so", major, minor); ++ h2 = dlopen (h2_name, RTLD_LAZY); ++ if (!h2) ++ { ++ fprintf (stderr, "dlopen (\"%s\"): %s\n", h2_name, dlerror ()); ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ if (h2 != h) ++ { ++ fprintf (stderr, "dlopen of \"%s\" and \"%s\" are different.\n", ++ $LIBRPM_STRING, h2_name); ++ fprintf (f, "%s\n", $LIBRPM_STRING); ++ return 0; ++ } ++ /* Found the valid .so name with a specific version. */ ++ fprintf (f, "%s\n", h2_name); ++ return 0; ++ } ++ ]]), [ ++ DLOPEN_LIBRPM="`cat conftest.out`" ++ if test "x$DLOPEN_LIBRPM" != "x"; then ++ HAVE_DLOPEN_LIBRPM=true ++ AC_MSG_RESULT($DLOPEN_LIBRPM) ++ fi ++ ]) ++ rm -f conftest.out ++ ++ m4_define([CHECK_LIBRPM_COMPAT], [ ++ AC_MSG_CHECKING([rpm library API compatibility]) ++ # The compilation requires -Werror to verify anything. ++ save_CFLAGS="$CFLAGS" ++ CFLAGS="$CFLAGS -Werror" ++ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[ ++/* Duplicate here the declarations to verify they match "elfread.c". */ ++#include ++#include ++#include ++#include ++extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); ++extern int rpmReadConfigFiles(const char * file, const char * target); ++extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); ++extern Header rpmdbNextIterator(rpmdbMatchIterator mi); ++extern rpmts rpmtsCreate(void); ++extern rpmts rpmtsFree(rpmts ts); ++extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag, ++ const void * keyp, size_t keylen); ++ ]]), [ ++ LIBRPM_COMPAT=true ++ AC_MSG_RESULT(yes) ++ ], [ ++ LIBRPM_COMPAT=false ++ AC_MSG_RESULT(no) ++ ]) ++ CFLAGS="$save_CFLAGS" ++ ]) ++ ++ if $HAVE_DLOPEN_LIBRPM; then ++ CHECK_LIBRPM_COMPAT ++ if ! $LIBRPM_COMPAT; then ++ HAVE_DLOPEN_LIBRPM=false ++ fi ++ fi ++ ++ if $HAVE_DLOPEN_LIBRPM; then ++ DLOPEN_LIBRPM_STRING='"'"$DLOPEN_LIBRPM"'"' ++ AC_DEFINE_UNQUOTED(DLOPEN_LIBRPM, $DLOPEN_LIBRPM_STRING, [librpm version specific library name to dlopen.]) ++ AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.]) ++ else ++ AC_MSG_RESULT(no) ++ LIBS="$save_LIBS" ++ if $DLOPEN_REQUIRE; then ++ AC_MSG_ERROR([Specific name $LIBRPM was requested but it could not be opened.]) ++ fi ++ PKG_CHECK_MODULES(RPM, rpm, [HAVE_LIBRPM=true], [HAVE_LIBRPM=false]) ++ ++ if $HAVE_LIBRPM; then ++ CHECK_LIBRPM_COMPAT ++ if ! $LIBRPM_COMPAT; then ++ HAVE_LIBRPM=false ++ RPM_PKG_ERRORS="Found $LIBRPM API is incompatibile with this GDB" ++ fi ++ fi ++ ++ if $HAVE_LIBRPM; then ++ AC_DEFINE(HAVE_LIBRPM, 1, [Define if librpm library is being used.]) ++ CFLAGS="$CFLAGS $RPM_CFLAGS" ++ LIBS="$LIBS $RPM_LIBS" ++ else ++ if $RPM_REQUIRE; then ++ AC_MSG_ERROR($RPM_PKG_ERRORS) ++ else ++ AC_MSG_WARN($RPM_PKG_ERRORS) ++ fi ++ fi ++ fi ++fi ++ + AC_CONFIG_SUBDIRS(testsuite) + + # Check whether to support alternative target configurations +diff --git a/gdb/event-top.c b/gdb/event-top.c +--- a/gdb/event-top.c ++++ b/gdb/event-top.c +@@ -43,6 +43,7 @@ + #include "async-event.h" + #include "bt-utils.h" + #include "pager.h" ++#include "symfile.h" + + /* readline include files. */ + #include "readline/readline.h" +@@ -391,6 +392,8 @@ display_gdb_prompt (const char *new_prompt) + /* Reset the nesting depth used when trace-commands is set. */ + reset_command_nest_depth (); + ++ debug_flush_missing (); ++ + /* Do not call the python hook on an explicit prompt change as + passed to this function, as this forms a secondary/local prompt, + IE, displayed but not set. */ +@@ -852,7 +855,10 @@ command_line_handler (gdb::unique_xmalloc_ptr &&rl) + command_handler (cmd); + + if (ui->prompt_state != PROMPTED) +- display_gdb_prompt (0); ++ { ++ debug_flush_missing (); ++ display_gdb_prompt (0); ++ } + } + } + +diff --git a/gdb/symfile.h b/gdb/symfile.h +--- a/gdb/symfile.h ++++ b/gdb/symfile.h +@@ -352,6 +352,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 minidebug.c. */ diff --git a/gdb-6.6-buildid-locate-solib-missing-ids.patch b/gdb-6.6-buildid-locate-solib-missing-ids.patch new file mode 100644 index 0000000..3b641f8 --- /dev/null +++ b/gdb-6.6-buildid-locate-solib-missing-ids.patch @@ -0,0 +1,238 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.6-buildid-locate-solib-missing-ids.patch + +;; Fix loading of core files without build-ids but with build-ids in executables. +;; Load strictly build-id-checked core files only if no executable is specified +;; (Jan Kratochvil, RH BZ 1339862). +;;=push+jan + +gdb returns an incorrect back trace when applying a debuginfo +https://bugzilla.redhat.com/show_bug.cgi?id=1339862 + +diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c +--- a/gdb/solib-svr4.c ++++ b/gdb/solib-svr4.c +@@ -1321,14 +1321,28 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, + } + + { +- struct bfd_build_id *build_id; ++ struct bfd_build_id *build_id = NULL; + + strncpy (newobj->so_original_name, buffer.get (), SO_NAME_MAX_PATH_SIZE - 1); + newobj->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; + /* May get overwritten below. */ + strcpy (newobj->so_name, newobj->so_original_name); + +- build_id = build_id_addr_get (((lm_info_svr4 *) newobj->lm_info)->l_ld); ++ /* In the case the main executable was found according to its build-id ++ (from a core file) prevent loading a different build of a library ++ with accidentally the same SO_NAME. ++ ++ It suppresses bogus backtraces (and prints "??" there instead) if ++ the on-disk files no longer match the running program version. ++ ++ If the main executable was not loaded according to its build-id do ++ not do any build-id checking of the libraries. There may be missing ++ build-ids dumped in the core file and we would map all the libraries ++ to the only existing file loaded that time - the executable. */ ++ if (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; +@@ -1343,23 +1357,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, + xfree (name); + } + else +- { +- debug_print_missing (newobj->so_name, build_id_filename); +- +- /* In the case the main executable was found according to +- its build-id (from a core file) prevent loading +- a different build of a library with accidentally the +- same SO_NAME. +- +- It suppresses bogus backtraces (and prints "??" there +- instead) if the on-disk files no longer match the +- running program version. */ +- +- if (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; +- } ++ debug_print_missing (newobj->so_name, build_id_filename); + + xfree (build_id_filename); + xfree (build_id); +diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-lib.c +@@ -0,0 +1,21 @@ ++/* Copyright 2010 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++void ++lib (void) ++{ ++} +diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib-main.c +@@ -0,0 +1,25 @@ ++/* Copyright 2010 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++extern void lib (void); ++ ++int ++main (void) ++{ ++ lib (); ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/gcore-buildid-exec-but-not-solib.exp +@@ -0,0 +1,105 @@ ++# Copyright 2016 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++if {[skip_shlib_tests]} { ++ return 0 ++} ++ ++set testfile "gcore-buildid-exec-but-not-solib" ++set srcmainfile ${testfile}-main.c ++set srclibfile ${testfile}-lib.c ++set libfile [standard_output_file ${testfile}-lib.so] ++set objfile [standard_output_file ${testfile}-main.o] ++set executable ${testfile}-main ++set binfile [standard_output_file ${executable}] ++set gcorefile [standard_output_file ${executable}.gcore] ++set outdir [file dirname $binfile] ++ ++if { [gdb_compile_shlib ${srcdir}/${subdir}/${srclibfile} ${libfile} "debug additional_flags=-Wl,--build-id"] != "" ++ || [gdb_compile ${srcdir}/${subdir}/${srcmainfile} ${objfile} object {debug}] != "" } { ++ unsupported "-Wl,--build-id compilation failed" ++ return -1 ++} ++set opts [list debug shlib=${libfile} "additional_flags=-Wl,--build-id"] ++if { [gdb_compile ${objfile} ${binfile} executable $opts] != "" } { ++ unsupported "-Wl,--build-id compilation failed" ++ return -1 ++} ++ ++clean_restart $executable ++gdb_load_shlib $libfile ++ ++# Does this gdb support gcore? ++set test "help gcore" ++gdb_test_multiple $test $test { ++ -re "Undefined command: .gcore.*\r\n$gdb_prompt $" { ++ # gcore command not supported -- nothing to test here. ++ unsupported "gdb does not support gcore on this target" ++ return -1; ++ } ++ -re "Save a core file .*\r\n$gdb_prompt $" { ++ pass $test ++ } ++} ++ ++if { ![runto lib] } then { ++ return -1 ++} ++ ++set escapedfilename [string_to_regexp ${gcorefile}] ++ ++set test "save a corefile" ++gdb_test_multiple "gcore ${gcorefile}" $test { ++ -re "Saved corefile ${escapedfilename}\r\n$gdb_prompt $" { ++ pass $test ++ } ++ -re "Can't create a corefile\r\n$gdb_prompt $" { ++ unsupported $test ++ return -1 ++ } ++} ++ ++# Now restart gdb and load the corefile. ++ ++clean_restart $executable ++gdb_load_shlib $libfile ++ ++set buildid [build_id_debug_filename_get $libfile] ++ ++regsub {\.debug$} $buildid {} buildid ++ ++set debugdir [standard_output_file ${testfile}-debugdir] ++file delete -force -- $debugdir ++ ++file mkdir $debugdir/[file dirname $libfile] ++file copy $libfile $debugdir/${libfile} ++ ++file mkdir $debugdir/[file dirname $buildid] ++file copy $libfile $debugdir/${buildid} ++ ++remote_exec build "ln -s /lib ${debugdir}/" ++remote_exec build "ln -s /lib64 ${debugdir}/" ++# /usr is not needed, all the libs are in /lib64: libm.so.6 libc.so.6 ld-linux-x86-64.so.2 ++ ++gdb_test "set solib-absolute-prefix $debugdir" ++ ++gdb_test_no_output "set debug-file-directory $debugdir" "set debug-file-directory" ++ ++gdb_test "core ${gcorefile}" "Core was generated by .*" "re-load generated corefile" ++ ++gdb_test "frame" "#0 \[^\r\n\]* lib .*" "library got loaded" ++ ++gdb_test "bt" ++gdb_test "info shared" diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch new file mode 100644 index 0000000..a3c6494 --- /dev/null +++ b/gdb-6.6-buildid-locate.patch @@ -0,0 +1,1915 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.6-buildid-locate.patch + +;; New locating of the matching binaries from the pure core file (build-id). +;;=push+jan + +diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h +--- a/bfd/libbfd-in.h ++++ b/bfd/libbfd-in.h +@@ -115,7 +115,7 @@ static inline char * + bfd_strdup (const char *str) + { + size_t len = strlen (str) + 1; +- char *buf = bfd_malloc (len); ++ char *buf = (char *) bfd_malloc (len); + if (buf != NULL) + memcpy (buf, str, len); + return buf; +diff --git a/bfd/libbfd.h b/bfd/libbfd.h +--- a/bfd/libbfd.h ++++ b/bfd/libbfd.h +@@ -121,7 +121,7 @@ static inline char * + bfd_strdup (const char *str) + { + size_t len = strlen (str) + 1; +- char *buf = bfd_malloc (len); ++ char *buf = (char *) bfd_malloc (len); + if (buf != NULL) + memcpy (buf, str, len); + return buf; +diff --git a/gdb/build-id.c b/gdb/build-id.c +--- a/gdb/build-id.c ++++ b/gdb/build-id.c +@@ -24,13 +24,71 @@ + #include "gdbsupport/gdb_vecs.h" + #include "symfile.h" + #include "objfiles.h" ++#include ++#include "elf-bfd.h" ++#include "elf/common.h" ++#include "elf/external.h" ++#include "elf/internal.h" + #include "filenames.h" ++#include "gdb_bfd.h" ++#include "gdbcmd.h" + #include "gdbcore.h" ++#include "inferior.h" ++#include "objfiles.h" ++#include "observable.h" ++#include "symfile.h" ++ ++#define BUILD_ID_VERBOSE_NONE 0 ++#define BUILD_ID_VERBOSE_FILENAMES 1 ++#define BUILD_ID_VERBOSE_BINARY_PARSE 2 ++static int build_id_verbose = BUILD_ID_VERBOSE_FILENAMES; ++static void ++show_build_id_verbose (struct ui_file *file, int from_tty, ++ struct cmd_list_element *c, const char *value) ++{ ++ gdb_printf (file, _("Verbosity level of the build-id locator is %s.\n"), ++ value); ++} ++/* Locate NT_GNU_BUILD_ID and return its matching debug filename. ++ FIXME: NOTE decoding should be unified with the BFD core notes decoding. */ ++ ++static struct bfd_build_id * ++build_id_buf_get (bfd *templ, gdb_byte *buf, bfd_size_type size) ++{ ++ bfd_byte *p; ++ ++ p = buf; ++ while (p < buf + size) ++ { ++ /* FIXME: bad alignment assumption. */ ++ Elf_External_Note *xnp = (Elf_External_Note *) p; ++ size_t namesz = H_GET_32 (templ, xnp->namesz); ++ size_t descsz = H_GET_32 (templ, xnp->descsz); ++ bfd_byte *descdata = (gdb_byte *) xnp->name + BFD_ALIGN (namesz, 4); ++ ++ if (H_GET_32 (templ, xnp->type) == NT_GNU_BUILD_ID ++ && namesz == sizeof "GNU" ++ && memcmp (xnp->name, "GNU", sizeof "GNU") == 0) ++ { ++ size_t sz = descsz; ++ gdb_byte *data = (gdb_byte *) descdata; ++ struct bfd_build_id *retval; ++ ++ retval = (struct bfd_build_id *) xmalloc (sizeof *retval - 1 + sz); ++ retval->size = sz; ++ memcpy (retval->data, data, sz); ++ ++ return retval; ++ } ++ p = descdata + BFD_ALIGN (descsz, 4); ++ } ++ return NULL; ++} + + /* See build-id.h. */ + + const struct bfd_build_id * +-build_id_bfd_get (bfd *abfd) ++build_id_bfd_shdr_get (bfd *abfd) + { + if (!bfd_check_format (abfd, bfd_object) + && !bfd_check_format (abfd, bfd_core)) +@@ -43,6 +101,348 @@ build_id_bfd_get (bfd *abfd) + return NULL; + } + ++/* Core files may have missing (corrupt) SHDR but PDHR is correct there. ++ bfd_elf_bfd_from_remote_memory () has too much overhead by ++ allocating/reading all the available ELF PT_LOADs. */ ++ ++static struct bfd_build_id * ++build_id_phdr_get (bfd *templ, bfd_vma loadbase, unsigned e_phnum, ++ Elf_Internal_Phdr *i_phdr) ++{ ++ int i; ++ struct bfd_build_id *retval = NULL; ++ ++ for (i = 0; i < e_phnum; i++) ++ if (i_phdr[i].p_type == PT_NOTE && i_phdr[i].p_filesz > 0) ++ { ++ Elf_Internal_Phdr *hdr = &i_phdr[i]; ++ gdb_byte *buf; ++ int err; ++ ++ buf = (gdb_byte *) xmalloc (hdr->p_filesz); ++ err = target_read_memory (loadbase + i_phdr[i].p_vaddr, buf, ++ hdr->p_filesz); ++ if (err == 0) ++ retval = build_id_buf_get (templ, buf, hdr->p_filesz); ++ else ++ retval = NULL; ++ xfree (buf); ++ if (retval != NULL) ++ break; ++ } ++ return retval; ++} ++ ++/* First we validate the file by reading in the ELF header and checking ++ the magic number. */ ++ ++static inline bfd_boolean ++elf_file_p (Elf64_External_Ehdr *x_ehdrp64) ++{ ++ gdb_assert (sizeof (Elf64_External_Ehdr) >= sizeof (Elf32_External_Ehdr)); ++ gdb_assert (offsetof (Elf64_External_Ehdr, e_ident) ++ == offsetof (Elf32_External_Ehdr, e_ident)); ++ gdb_assert (sizeof (((Elf64_External_Ehdr *) 0)->e_ident) ++ == sizeof (((Elf32_External_Ehdr *) 0)->e_ident)); ++ ++ return ((x_ehdrp64->e_ident[EI_MAG0] == ELFMAG0) ++ && (x_ehdrp64->e_ident[EI_MAG1] == ELFMAG1) ++ && (x_ehdrp64->e_ident[EI_MAG2] == ELFMAG2) ++ && (x_ehdrp64->e_ident[EI_MAG3] == ELFMAG3)); ++} ++ ++/* Translate an ELF file header in external format into an ELF file header in ++ internal format. */ ++ ++#define H_GET_WORD(bfd, ptr) (is64 ? H_GET_64 (bfd, (ptr)) \ ++ : H_GET_32 (bfd, (ptr))) ++#define H_GET_SIGNED_WORD(bfd, ptr) (is64 ? H_GET_S64 (bfd, (ptr)) \ ++ : H_GET_S32 (bfd, (ptr))) ++ ++static void ++elf_swap_ehdr_in (bfd *abfd, ++ const Elf64_External_Ehdr *src64, ++ Elf_Internal_Ehdr *dst) ++{ ++ int is64 = bfd_get_arch_size (abfd) == 64; ++#define SRC(field) (is64 ? src64->field \ ++ : ((const Elf32_External_Ehdr *) src64)->field) ++ ++ int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma; ++ memcpy (dst->e_ident, SRC (e_ident), EI_NIDENT); ++ dst->e_type = H_GET_16 (abfd, SRC (e_type)); ++ dst->e_machine = H_GET_16 (abfd, SRC (e_machine)); ++ dst->e_version = H_GET_32 (abfd, SRC (e_version)); ++ if (signed_vma) ++ dst->e_entry = H_GET_SIGNED_WORD (abfd, SRC (e_entry)); ++ else ++ dst->e_entry = H_GET_WORD (abfd, SRC (e_entry)); ++ dst->e_phoff = H_GET_WORD (abfd, SRC (e_phoff)); ++ dst->e_shoff = H_GET_WORD (abfd, SRC (e_shoff)); ++ dst->e_flags = H_GET_32 (abfd, SRC (e_flags)); ++ dst->e_ehsize = H_GET_16 (abfd, SRC (e_ehsize)); ++ dst->e_phentsize = H_GET_16 (abfd, SRC (e_phentsize)); ++ dst->e_phnum = H_GET_16 (abfd, SRC (e_phnum)); ++ dst->e_shentsize = H_GET_16 (abfd, SRC (e_shentsize)); ++ dst->e_shnum = H_GET_16 (abfd, SRC (e_shnum)); ++ dst->e_shstrndx = H_GET_16 (abfd, SRC (e_shstrndx)); ++ ++#undef SRC ++} ++ ++/* Translate an ELF program header table entry in external format into an ++ ELF program header table entry in internal format. */ ++ ++static void ++elf_swap_phdr_in (bfd *abfd, ++ const Elf64_External_Phdr *src64, ++ Elf_Internal_Phdr *dst) ++{ ++ int is64 = bfd_get_arch_size (abfd) == 64; ++#define SRC(field) (is64 ? src64->field \ ++ : ((const Elf32_External_Phdr *) src64)->field) ++ ++ int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma; ++ ++ dst->p_type = H_GET_32 (abfd, SRC (p_type)); ++ dst->p_flags = H_GET_32 (abfd, SRC (p_flags)); ++ dst->p_offset = H_GET_WORD (abfd, SRC (p_offset)); ++ if (signed_vma) ++ { ++ dst->p_vaddr = H_GET_SIGNED_WORD (abfd, SRC (p_vaddr)); ++ dst->p_paddr = H_GET_SIGNED_WORD (abfd, SRC (p_paddr)); ++ } ++ else ++ { ++ dst->p_vaddr = H_GET_WORD (abfd, SRC (p_vaddr)); ++ dst->p_paddr = H_GET_WORD (abfd, SRC (p_paddr)); ++ } ++ dst->p_filesz = H_GET_WORD (abfd, SRC (p_filesz)); ++ dst->p_memsz = H_GET_WORD (abfd, SRC (p_memsz)); ++ dst->p_align = H_GET_WORD (abfd, SRC (p_align)); ++ ++#undef SRC ++} ++ ++#undef H_GET_SIGNED_WORD ++#undef H_GET_WORD ++ ++static Elf_Internal_Phdr * ++elf_get_phdr (bfd *templ, bfd_vma ehdr_vma, unsigned *e_phnum_pointer, ++ bfd_vma *loadbase_pointer) ++{ ++ /* sizeof (Elf64_External_Ehdr) >= sizeof (Elf32_External_Ehdr) */ ++ Elf64_External_Ehdr x_ehdr64; /* Elf file header, external form */ ++ Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form */ ++ bfd_size_type x_phdrs_size; ++ gdb_byte *x_phdrs_ptr; ++ Elf_Internal_Phdr *i_phdrs; ++ int err; ++ unsigned int i; ++ bfd_vma loadbase; ++ int loadbase_set; ++ ++ gdb_assert (templ != NULL); ++ gdb_assert (sizeof (Elf64_External_Ehdr) >= sizeof (Elf32_External_Ehdr)); ++ ++ /* Read in the ELF header in external format. */ ++ err = target_read_memory (ehdr_vma, (bfd_byte *) &x_ehdr64, sizeof x_ehdr64); ++ if (err) ++ { ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Error reading ELF header at address 0x%lx"), ++ (unsigned long) ehdr_vma); ++ return NULL; ++ } ++ ++ /* Now check to see if we have a valid ELF file, and one that BFD can ++ make use of. The magic number must match, the address size ('class') ++ and byte-swapping must match our XVEC entry. */ ++ ++ if (! elf_file_p (&x_ehdr64) ++ || x_ehdr64.e_ident[EI_VERSION] != EV_CURRENT ++ || !((bfd_get_arch_size (templ) == 64 ++ && x_ehdr64.e_ident[EI_CLASS] == ELFCLASS64) ++ || (bfd_get_arch_size (templ) == 32 ++ && x_ehdr64.e_ident[EI_CLASS] == ELFCLASS32))) ++ { ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Unrecognized ELF header at address 0x%lx"), ++ (unsigned long) ehdr_vma); ++ return NULL; ++ } ++ ++ /* Check that file's byte order matches xvec's */ ++ switch (x_ehdr64.e_ident[EI_DATA]) ++ { ++ case ELFDATA2MSB: /* Big-endian */ ++ if (! bfd_header_big_endian (templ)) ++ { ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Unrecognized " ++ "big-endian ELF header at address 0x%lx"), ++ (unsigned long) ehdr_vma); ++ return NULL; ++ } ++ break; ++ case ELFDATA2LSB: /* Little-endian */ ++ if (! bfd_header_little_endian (templ)) ++ { ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Unrecognized " ++ "little-endian ELF header at address 0x%lx"), ++ (unsigned long) ehdr_vma); ++ return NULL; ++ } ++ break; ++ case ELFDATANONE: /* No data encoding specified */ ++ default: /* Unknown data encoding specified */ ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Unrecognized " ++ "ELF header endianity at address 0x%lx"), ++ (unsigned long) ehdr_vma); ++ return NULL; ++ } ++ ++ elf_swap_ehdr_in (templ, &x_ehdr64, &i_ehdr); ++ ++ /* The file header tells where to find the program headers. ++ These are what we use to actually choose what to read. */ ++ ++ if (i_ehdr.e_phentsize != (bfd_get_arch_size (templ) == 64 ++ ? sizeof (Elf64_External_Phdr) ++ : sizeof (Elf32_External_Phdr)) ++ || i_ehdr.e_phnum == 0) ++ { ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Invalid ELF program headers from the ELF header " ++ "at address 0x%lx"), (unsigned long) ehdr_vma); ++ return NULL; ++ } ++ ++ x_phdrs_size = (bfd_get_arch_size (templ) == 64 ? sizeof (Elf64_External_Phdr) ++ : sizeof (Elf32_External_Phdr)); ++ ++ i_phdrs = (Elf_Internal_Phdr *) xmalloc (i_ehdr.e_phnum * (sizeof *i_phdrs + x_phdrs_size)); ++ x_phdrs_ptr = (gdb_byte *) &i_phdrs[i_ehdr.e_phnum]; ++ err = target_read_memory (ehdr_vma + i_ehdr.e_phoff, (bfd_byte *) x_phdrs_ptr, ++ i_ehdr.e_phnum * x_phdrs_size); ++ if (err) ++ { ++ free (i_phdrs); ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Error reading " ++ "ELF program headers at address 0x%lx"), ++ (unsigned long) (ehdr_vma + i_ehdr.e_phoff)); ++ return NULL; ++ } ++ ++ loadbase = ehdr_vma; ++ loadbase_set = 0; ++ for (i = 0; i < i_ehdr.e_phnum; ++i) ++ { ++ elf_swap_phdr_in (templ, (Elf64_External_Phdr *) ++ (x_phdrs_ptr + i * x_phdrs_size), &i_phdrs[i]); ++ /* IA-64 vDSO may have two mappings for one segment, where one mapping ++ is executable only, and one is read only. We must not use the ++ executable one (PF_R is the first one, PF_X the second one). */ ++ if (i_phdrs[i].p_type == PT_LOAD && (i_phdrs[i].p_flags & PF_R)) ++ { ++ /* Only the first PT_LOAD segment indicates the file bias. ++ Next segments may have P_VADDR arbitrarily higher. ++ If the first segment has P_VADDR zero any next segment must not ++ confuse us, the first one sets LOADBASE certainly enough. */ ++ if (!loadbase_set && i_phdrs[i].p_offset == 0) ++ { ++ loadbase = ehdr_vma - i_phdrs[i].p_vaddr; ++ loadbase_set = 1; ++ } ++ } ++ } ++ ++ if (build_id_verbose >= BUILD_ID_VERBOSE_BINARY_PARSE) ++ warning (_("build-id: Found ELF header at address 0x%lx, loadbase 0x%lx"), ++ (unsigned long) ehdr_vma, (unsigned long) loadbase); ++ ++ *e_phnum_pointer = i_ehdr.e_phnum; ++ *loadbase_pointer = loadbase; ++ return i_phdrs; ++} ++ ++/* BUILD_ID_ADDR_GET gets ADDR located somewhere in the object. ++ Find the first section before ADDR containing an ELF header. ++ We rely on the fact the sections from multiple files do not mix. ++ FIXME: We should check ADDR is contained _inside_ the section with possibly ++ missing content (P_FILESZ < P_MEMSZ). These omitted sections are currently ++ hidden by _BFD_ELF_MAKE_SECTION_FROM_PHDR. */ ++ ++static CORE_ADDR build_id_addr; ++struct build_id_addr_sect ++ { ++ struct build_id_addr_sect *next; ++ asection *sect; ++ }; ++static struct build_id_addr_sect *build_id_addr_sect; ++ ++static void build_id_addr_candidate (bfd *abfd, asection *sect, void *obj) ++{ ++ if (build_id_addr >= bfd_section_vma (sect)) ++ { ++ struct build_id_addr_sect *candidate; ++ ++ candidate = (struct build_id_addr_sect *) xmalloc (sizeof *candidate); ++ candidate->next = build_id_addr_sect; ++ build_id_addr_sect = candidate; ++ candidate->sect = sect; ++ } ++} ++ ++struct bfd_build_id * ++build_id_addr_get (CORE_ADDR addr) ++{ ++ struct build_id_addr_sect *candidate; ++ struct bfd_build_id *retval = NULL; ++ Elf_Internal_Phdr *i_phdr = NULL; ++ bfd_vma loadbase = 0; ++ unsigned e_phnum = 0; ++ ++ if (core_bfd == NULL) ++ return NULL; ++ ++ build_id_addr = addr; ++ gdb_assert (build_id_addr_sect == NULL); ++ bfd_map_over_sections (core_bfd, build_id_addr_candidate, NULL); ++ ++ /* Sections are sorted in the high-to-low VMAs order. ++ Stop the search on the first ELF header we find. ++ Do not continue the search even if it does not contain NT_GNU_BUILD_ID. */ ++ ++ for (candidate = build_id_addr_sect; candidate != NULL; ++ candidate = candidate->next) ++ { ++ i_phdr = elf_get_phdr (core_bfd, ++ bfd_section_vma (candidate->sect), ++ &e_phnum, &loadbase); ++ if (i_phdr != NULL) ++ break; ++ } ++ ++ if (i_phdr != NULL) ++ { ++ retval = build_id_phdr_get (core_bfd, loadbase, e_phnum, i_phdr); ++ xfree (i_phdr); ++ } ++ ++ while (build_id_addr_sect != NULL) ++ { ++ candidate = build_id_addr_sect; ++ build_id_addr_sect = candidate->next; ++ xfree (candidate); ++ } ++ ++ return retval; ++} ++ + /* See build-id.h. */ + + int +@@ -51,7 +451,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) + const struct bfd_build_id *found; + int retval = 0; + +- found = build_id_bfd_get (abfd); ++ found = build_id_bfd_shdr_get (abfd); + + if (found == NULL) + warning (_("File \"%s\" has no build-id, file skipped"), +@@ -66,63 +466,166 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) + return retval; + } + ++static char * ++link_resolve (const char *symlink, int level) ++{ ++ char buf[PATH_MAX + 1], *retval; ++ gdb::unique_xmalloc_ptr target; ++ ssize_t got; ++ ++ if (level > 10) ++ return xstrdup (symlink); ++ ++ got = readlink (symlink, buf, sizeof (buf)); ++ if (got < 0 || got >= sizeof (buf)) ++ return xstrdup (symlink); ++ buf[got] = '\0'; ++ ++ if (IS_ABSOLUTE_PATH (buf)) ++ target = make_unique_xstrdup (buf); ++ else ++ { ++ const std::string dir (ldirname (symlink)); ++ ++ target = xstrprintf ("%s" ++#ifndef HAVE_DOS_BASED_FILE_SYSTEM ++ "/" ++#else /* HAVE_DOS_BASED_FILE_SYSTEM */ ++ "\\" ++#endif /* HAVE_DOS_BASED_FILE_SYSTEM */ ++ "%s", dir.c_str(), buf); ++ } ++ ++ retval = link_resolve (target.get (), level + 1); ++ return retval; ++} ++ + /* Helper for build_id_to_debug_bfd. LINK is a path to a potential + build-id-based separate debug file, potentially a symlink to the real file. + If the file exists and matches BUILD_ID, return a BFD reference to it. */ + + static gdb_bfd_ref_ptr +-build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len, +- const bfd_byte *build_id) ++build_id_to_debug_bfd_1 (const std::string &orig_link, size_t build_id_len, ++ const bfd_byte *build_id, char **link_return) + { ++ gdb_bfd_ref_ptr ret_bfd = {}; ++ std::string ret_link; ++ + if (separate_debug_file_debug) + { +- gdb_printf (gdb_stdlog, _(" Trying %s..."), link.c_str ()); +- gdb_flush (gdb_stdlog); ++ gdb_printf (gdb_stdlog, _(" Trying %s..."), orig_link.c_str ()); ++ gdb_flush (gdb_stdout); + } + +- /* lrealpath() is expensive even for the usually non-existent files. */ +- gdb::unique_xmalloc_ptr filename_holder; +- const char *filename = nullptr; +- if (startswith (link, TARGET_SYSROOT_PREFIX)) +- filename = link.c_str (); +- else if (access (link.c_str (), F_OK) == 0) ++ for (unsigned seqno = 0;; seqno++) + { +- filename_holder.reset (lrealpath (link.c_str ())); +- filename = filename_holder.get (); +- } ++ std::string link = orig_link; + +- if (filename == NULL) +- { +- if (separate_debug_file_debug) +- gdb_printf (gdb_stdlog, +- _(" no, unable to compute real path\n")); ++ if (seqno > 0) ++ { ++ /* There can be multiple build-id symlinks pointing to real files ++ with the same build-id (such as hard links). Some of the real ++ files may not be installed. */ + +- return {}; +- } ++ string_appendf (link, ".%u", seqno); ++ } + +- /* We expect to be silent on the non-existing files. */ +- gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename, gnutarget); ++ ret_link = link; + +- if (debug_bfd == NULL) +- { +- if (separate_debug_file_debug) +- gdb_printf (gdb_stdlog, _(" no, unable to open.\n")); ++ struct stat statbuf_trash; ++ ++ /* `access' automatically dereferences LINK. */ ++ if (lstat (link.c_str (), &statbuf_trash) != 0) ++ { ++ /* Stop increasing SEQNO. */ ++ break; ++ } ++ ++ /* lrealpath() is expensive even for the usually non-existent files. */ ++ gdb::unique_xmalloc_ptr filename_holder; ++ const char *filename = nullptr; ++ if (startswith (link, TARGET_SYSROOT_PREFIX)) ++ filename = link.c_str (); ++ else if (access (link.c_str (), F_OK) == 0) ++ { ++ filename_holder.reset (lrealpath (link.c_str ())); ++ filename = filename_holder.get (); ++ } ++ ++ if (filename == NULL) ++ { ++ if (separate_debug_file_debug) ++ gdb_printf (gdb_stdlog, ++ _(" no, unable to compute real path\n")); ++ ++ continue; ++ } ++ ++ /* We expect to be silent on the non-existing files. */ ++ gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename, gnutarget); ++ ++ if (debug_bfd == NULL) ++ { ++ if (separate_debug_file_debug) ++ gdb_printf (gdb_stdlog, _(" no, unable to open.\n")); + +- return {}; ++ continue; ++ } ++ ++ if (!build_id_verify (debug_bfd.get(), build_id_len, build_id)) ++ { ++ if (separate_debug_file_debug) ++ gdb_printf (gdb_stdlog, ++ _(" no, build-id does not match.\n")); ++ ++ continue; ++ } ++ ++ ret_bfd = debug_bfd; ++ break; + } + +- if (!build_id_verify (debug_bfd.get(), build_id_len, build_id)) ++ std::string link_all; ++ ++ if (ret_bfd != NULL) + { + if (separate_debug_file_debug) +- gdb_printf (gdb_stdlog, _(" no, build-id does not match.\n")); ++ gdb_printf (gdb_stdlog, _(" yes!\n")); ++ } ++ else ++ { ++ /* If none of the real files is found report as missing file ++ always the non-.%u-suffixed file. */ ++ std::string link0 = orig_link; + +- return {}; ++ /* If the symlink has target request to install the target. ++ BASE-debuginfo.rpm contains the symlink but BASE.rpm may be missing. ++ https://bugzilla.redhat.com/show_bug.cgi?id=981154 */ ++ std::string link0_resolved (link_resolve (link0.c_str (), 0)); ++ ++ if (link_all.empty ()) ++ link_all = link0_resolved; ++ else ++ { ++ /* Use whitespace instead of DIRNAME_SEPARATOR to be compatible with ++ its possible use as an argument for installation command. */ ++ link_all += " " + link0_resolved; ++ } + } + +- if (separate_debug_file_debug) +- gdb_printf (gdb_stdlog, _(" yes!\n")); ++ if (link_return != NULL) ++ { ++ if (ret_bfd != NULL) ++ { ++ *link_return = xstrdup (ret_link.c_str ()); ++ } ++ else ++ { ++ *link_return = xstrdup (link_all.c_str ()); ++ } ++ } + +- return debug_bfd; ++ return ret_bfd; + } + + /* Common code for finding BFDs of a given build-id. This function +@@ -131,7 +634,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len, + + static gdb_bfd_ref_ptr + build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, +- const char *suffix) ++ const char *suffix, char **link_return) + { + /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will + cause "/.build-id/..." lookups. */ +@@ -154,16 +657,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, + if (size > 0) + { + size--; +- string_appendf (link, "%02x/", (unsigned) *data++); ++ string_appendf (link, "%02x", (unsigned) *data++); + } +- ++ if (size > 0) ++ link += "/"; + while (size-- > 0) + string_appendf (link, "%02x", (unsigned) *data++); + + link += suffix; + + gdb_bfd_ref_ptr debug_bfd +- = build_id_to_debug_bfd_1 (link, build_id_len, build_id); ++ = build_id_to_debug_bfd_1 (link, build_id_len, build_id, link_return); + if (debug_bfd != NULL) + return debug_bfd; + +@@ -174,7 +678,7 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, + if (!gdb_sysroot.empty ()) + { + link = gdb_sysroot + link; +- debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id); ++ debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id, NULL); + if (debug_bfd != NULL) + return debug_bfd; + } +@@ -183,30 +687,655 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, + return {}; + } + ++char * ++build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) ++{ ++ gdb_bfd_ref_ptr abfd; ++ char *result; ++ ++ abfd = build_id_to_exec_bfd (build_id->size, build_id->data, link_return); ++ if (abfd == NULL) ++ return NULL; ++ ++ result = xstrdup (bfd_get_filename (abfd.get ())); ++ return result; ++} ++ ++#ifdef HAVE_LIBRPM ++ ++#include ++#include ++#include ++#include ++#ifdef DLOPEN_LIBRPM ++#include ++#endif ++ ++/* Workarodun https://bugzilla.redhat.com/show_bug.cgi?id=643031 ++ librpm must not exit() an application on SIGINT ++ ++ Enable or disable a signal handler. SIGNUM: signal to enable (or disable ++ if negative). HANDLER: sa_sigaction handler (or NULL to use ++ rpmsqHandler()). Returns: no. of refs, -1 on error. */ ++extern int rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler); ++int ++rpmsqEnable (int signum, /* rpmsqAction_t handler */ void *handler) ++{ ++ return 0; ++} ++ ++/* This MISSING_RPM_HASH tracker is used to collect all the missing rpm files ++ and avoid their duplicities during a single inferior run. */ ++ ++static struct htab *missing_rpm_hash; ++ ++/* This MISSING_RPM_LIST tracker is used to collect and print as a single line ++ all the rpms right before the nearest GDB prompt. It gets cleared after ++ each such print (it is questionable if we should clear it after the print). ++ */ ++ ++struct missing_rpm ++ { ++ struct missing_rpm *next; ++ char rpm[1]; ++ }; ++static struct missing_rpm *missing_rpm_list; ++static int missing_rpm_list_entries; ++ ++/* Returns the count of newly added rpms. */ ++ ++static int ++#ifndef GDB_INDEX_VERIFY_VENDOR ++missing_rpm_enlist (const char *filename) ++#else ++missing_rpm_enlist_1 (const char *filename, int verify_vendor) ++#endif ++{ ++ static int rpm_init_done = 0; ++ rpmts ts; ++ rpmdbMatchIterator mi; ++ int count = 0; ++ ++#ifdef DLOPEN_LIBRPM ++ /* Duplicate here the declarations to verify they match. The same sanity ++ check is present also in `configure.ac'. */ ++ extern char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg); ++ static char *(*headerFormat_p) (Header h, const char * fmt, errmsg_t *errmsg); ++ extern int rpmReadConfigFiles(const char * file, const char * target); ++ static int (*rpmReadConfigFiles_p) (const char * file, const char * target); ++ extern rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi); ++ static rpmdbMatchIterator (*rpmdbFreeIterator_p) (rpmdbMatchIterator mi); ++ extern Header rpmdbNextIterator(rpmdbMatchIterator mi); ++ static Header (*rpmdbNextIterator_p) (rpmdbMatchIterator mi); ++ extern rpmts rpmtsCreate(void); ++ static rpmts (*rpmtsCreate_p) (void); ++ extern rpmts rpmtsFree(rpmts ts); ++ static rpmts (*rpmtsFree_p) (rpmts ts); ++ extern rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, ++ const void * keyp, size_t keylen); ++ static rpmdbMatchIterator (*rpmtsInitIterator_p) (const rpmts ts, ++ rpmTag rpmtag, ++ const void *keyp, ++ size_t keylen); ++#else /* !DLOPEN_LIBRPM */ ++# define headerFormat_p headerFormat ++# define rpmReadConfigFiles_p rpmReadConfigFiles ++# define rpmdbFreeIterator_p rpmdbFreeIterator ++# define rpmdbNextIterator_p rpmdbNextIterator ++# define rpmtsCreate_p rpmtsCreate ++# define rpmtsFree_p rpmtsFree ++# define rpmtsInitIterator_p rpmtsInitIterator ++#endif /* !DLOPEN_LIBRPM */ ++ ++ gdb_assert (filename != NULL); ++ ++ if (strcmp (filename, BUILD_ID_MAIN_EXECUTABLE_FILENAME) == 0) ++ return 0; ++ ++ if (is_target_filename (filename)) ++ return 0; ++ ++ if (filename[0] != '/') ++ { ++ warning (_("Ignoring non-absolute filename: <%s>"), filename); ++ return 0; ++ } ++ ++ if (!rpm_init_done) ++ { ++ static int init_tried; ++ ++ /* Already failed the initialization before? */ ++ if (init_tried) ++ return 0; ++ init_tried = 1; ++ ++#ifdef DLOPEN_LIBRPM ++ { ++ void *h; ++ ++ h = dlopen (DLOPEN_LIBRPM, RTLD_LAZY); ++ if (!h) ++ { ++ warning (_("Unable to open \"%s\" (%s), " ++ "missing debuginfos notifications will not be displayed"), ++ DLOPEN_LIBRPM, dlerror ()); ++ return 0; ++ } ++ ++ if (!((headerFormat_p = (char *(*) (Header h, const char * fmt, errmsg_t *errmsg)) dlsym (h, "headerFormat")) ++ && (rpmReadConfigFiles_p = (int (*) (const char * file, const char * target)) dlsym (h, "rpmReadConfigFiles")) ++ && (rpmdbFreeIterator_p = (rpmdbMatchIterator (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbFreeIterator")) ++ && (rpmdbNextIterator_p = (Header (*) (rpmdbMatchIterator mi)) dlsym (h, "rpmdbNextIterator")) ++ && (rpmtsCreate_p = (rpmts (*) (void)) dlsym (h, "rpmtsCreate")) ++ && (rpmtsFree_p = (rpmts (*) (rpmts ts)) dlsym (h, "rpmtsFree")) ++ && (rpmtsInitIterator_p = (rpmdbMatchIterator (*) (const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)) dlsym (h, "rpmtsInitIterator")))) ++ { ++ warning (_("Opened library \"%s\" is incompatible (%s), " ++ "missing debuginfos notifications will not be displayed"), ++ DLOPEN_LIBRPM, dlerror ()); ++ if (dlclose (h)) ++ warning (_("Error closing library \"%s\": %s\n"), DLOPEN_LIBRPM, ++ dlerror ()); ++ return 0; ++ } ++ } ++#endif /* DLOPEN_LIBRPM */ ++ ++ if (rpmReadConfigFiles_p (NULL, NULL) != 0) ++ { ++ warning (_("Error reading the rpm configuration files")); ++ return 0; ++ } ++ ++ rpm_init_done = 1; ++ } ++ ++ ts = rpmtsCreate_p (); ++ ++ mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0); ++ if (mi != NULL) ++ { ++#ifndef GDB_INDEX_VERIFY_VENDOR ++ for (;;) ++#else ++ if (!verify_vendor) for (;;) ++#endif ++ { ++ Header h; ++ char *debuginfo, **slot, *s, *s2; ++ errmsg_t err; ++ size_t srcrpmlen = sizeof (".src.rpm") - 1; ++ size_t debuginfolen = sizeof ("-debuginfo") - 1; ++ rpmdbMatchIterator mi_debuginfo; ++ ++ h = rpmdbNextIterator_p (mi); ++ if (h == NULL) ++ break; ++ ++ /* Verify the debuginfo file is not already installed. */ ++ ++ debuginfo = headerFormat_p (h, "%{sourcerpm}-debuginfo.%{arch}", ++ &err); ++ if (!debuginfo) ++ { ++ warning (_("Error querying the rpm file `%s': %s"), filename, ++ err); ++ continue; ++ } ++ /* s = `.src.rpm-debuginfo.%{arch}' */ ++ s = strrchr (debuginfo, '-') - srcrpmlen; ++ s2 = NULL; ++ if (s > debuginfo && memcmp (s, ".src.rpm", srcrpmlen) == 0) ++ { ++ /* s2 = `-%{release}.src.rpm-debuginfo.%{arch}' */ ++ s2 = (char *) memrchr (debuginfo, '-', s - debuginfo); ++ } ++ if (s2) ++ { ++ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */ ++ s2 = (char *) memrchr (debuginfo, '-', s2 - debuginfo); ++ } ++ if (!s2) ++ { ++ warning (_("Error querying the rpm file `%s': %s"), filename, ++ debuginfo); ++ xfree (debuginfo); ++ continue; ++ } ++ /* s = `.src.rpm-debuginfo.%{arch}' */ ++ /* s2 = `-%{version}-%{release}.src.rpm-debuginfo.%{arch}' */ ++ memmove (s2 + debuginfolen, s2, s - s2); ++ memcpy (s2, "-debuginfo", debuginfolen); ++ /* s = `XXXX.%{arch}' */ ++ /* strlen ("XXXX") == srcrpmlen + debuginfolen */ ++ /* s2 = `-debuginfo-%{version}-%{release}XX.%{arch}' */ ++ /* strlen ("XX") == srcrpmlen */ ++ memmove (s + debuginfolen, s + srcrpmlen + debuginfolen, ++ strlen (s + srcrpmlen + debuginfolen) + 1); ++ /* s = `-debuginfo-%{version}-%{release}.%{arch}' */ ++ ++ /* RPMDBI_PACKAGES requires keylen == sizeof (int). */ ++ /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel(). */ ++ mi_debuginfo = rpmtsInitIterator_p (ts, (rpmTag) RPMDBI_LABEL, debuginfo, 0); ++ xfree (debuginfo); ++ if (mi_debuginfo) ++ { ++ rpmdbFreeIterator_p (mi_debuginfo); ++ count = 0; ++ break; ++ } ++ ++ /* The allocated memory gets utilized below for MISSING_RPM_HASH. */ ++ debuginfo = headerFormat_p (h, ++ "%{name}-%{version}-%{release}.%{arch}", ++ &err); ++ if (!debuginfo) ++ { ++ warning (_("Error querying the rpm file `%s': %s"), filename, ++ err); ++ continue; ++ } ++ ++ /* Base package name for `debuginfo-install'. We do not use the ++ `yum' command directly as the line ++ yum --enablerepo='*debug*' install NAME-debuginfo.ARCH ++ would be more complicated than just: ++ debuginfo-install NAME-VERSION-RELEASE.ARCH ++ Do not supply the rpm base name (derived from .src.rpm name) as ++ debuginfo-install is unable to install the debuginfo package if ++ the base name PKG binary rpm is not installed while for example ++ PKG-libs would be installed (RH Bug 467901). ++ FUTURE: After multiple debuginfo versions simultaneously installed ++ get supported the support for the VERSION-RELEASE tags handling ++ may need an update. */ ++ ++ if (missing_rpm_hash == NULL) ++ { ++ /* DEL_F is passed NULL as MISSING_RPM_LIST's HTAB_DELETE ++ should not deallocate the entries. */ ++ ++ missing_rpm_hash = htab_create_alloc (64, htab_hash_string, ++ (int (*) (const void *, const void *)) streq, ++ NULL, xcalloc, xfree); ++ } ++ slot = (char **) htab_find_slot (missing_rpm_hash, debuginfo, INSERT); ++ /* XCALLOC never returns NULL. */ ++ gdb_assert (slot != NULL); ++ if (*slot == NULL) ++ { ++ struct missing_rpm *missing_rpm; ++ ++ *slot = debuginfo; ++ ++ missing_rpm = (struct missing_rpm *) xmalloc (sizeof (*missing_rpm) + strlen (debuginfo)); ++ strcpy (missing_rpm->rpm, debuginfo); ++ missing_rpm->next = missing_rpm_list; ++ missing_rpm_list = missing_rpm; ++ missing_rpm_list_entries++; ++ } ++ else ++ xfree (debuginfo); ++ count++; ++ } ++#ifdef GDB_INDEX_VERIFY_VENDOR ++ else /* verify_vendor */ ++ { ++ int vendor_pass = 0, vendor_fail = 0; ++ ++ for (;;) ++ { ++ Header h; ++ errmsg_t err; ++ char *vendor; ++ ++ h = rpmdbNextIterator_p (mi); ++ if (h == NULL) ++ break; ++ ++ vendor = headerFormat_p (h, "%{vendor}", &err); ++ if (!vendor) ++ { ++ warning (_("Error querying the rpm file `%s': %s"), filename, ++ err); ++ continue; ++ } ++ if (strcmp (vendor, "Red Hat, Inc.") == 0) ++ vendor_pass = 1; ++ else ++ vendor_fail = 1; ++ xfree (vendor); ++ } ++ count = vendor_pass != 0 && vendor_fail == 0; ++ } ++#endif ++ ++ rpmdbFreeIterator_p (mi); ++ } ++ ++ rpmtsFree_p (ts); ++ ++ return count; ++} ++ ++#ifdef GDB_INDEX_VERIFY_VENDOR ++missing_rpm_enlist (const char *filename) ++{ ++ return missing_rpm_enlist_1 (filename, 0); ++} ++ ++extern int rpm_verify_vendor (const char *filename); ++int ++rpm_verify_vendor (const char *filename) ++{ ++ return missing_rpm_enlist_1 (filename, 1); ++} ++#endif ++ ++static bool ++missing_rpm_list_compar (const char *ap, const char *bp) ++{ ++ return strcoll (ap, bp) < 0; ++} ++ ++/* It returns a NULL-terminated array of strings needing to be FREEd. It may ++ also return only NULL. */ ++ ++static void ++missing_rpm_list_print (void) ++{ ++ struct missing_rpm *list_iter; ++ ++ if (missing_rpm_list_entries == 0) ++ return; ++ ++ std::vector array (missing_rpm_list_entries); ++ size_t idx = 0; ++ ++ for (list_iter = missing_rpm_list; list_iter != NULL; ++ list_iter = list_iter->next) ++ { ++ array[idx++] = list_iter->rpm; ++ } ++ gdb_assert (idx == missing_rpm_list_entries); ++ ++ std::sort (array.begin (), array.end (), missing_rpm_list_compar); ++ ++ /* We zero out the number of missing RPMs here because of a nasty ++ bug (see RHBZ 1801974). ++ ++ When we call 'puts_unfiltered' below, if pagination is on and if ++ the number of missing RPMs is big enough to trigger pagination, ++ we will end up in an infinite recursion. The call chain looks ++ like this: ++ ++ missing_rpm_list_print -> puts_unfiltered -> fputs_maybe_filtered ++ -> prompt_for_continue -> display_gdb_prompt -> ++ debug_flush_missing -> missing_rpm_list_print ... ++ ++ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero ++ *before* calling any print function. ++ ++ Note: kevinb/2023-02-22: The code below used to call ++ puts_unfiltered() and printf_unfiltered(), but calls to these ++ functions have been replaced by calls to gdb_printf(). The call ++ chain shown above (probably) used to be the case at one time and ++ hopefully something similar is still the case now that ++ gdb_printf() is being used instead. */ ++ missing_rpm_list_entries = 0; ++ ++ gdb_printf (_("Missing separate debuginfos, use: %s"), ++#ifdef DNF_DEBUGINFO_INSTALL ++ "dnf " ++#endif ++ "debuginfo-install"); ++ for (const char *el : array) ++ { ++ gdb_printf (" %s", el); ++ } ++ gdb_printf ("\n"); ++ ++ while (missing_rpm_list != NULL) ++ { ++ list_iter = missing_rpm_list; ++ missing_rpm_list = list_iter->next; ++ xfree (list_iter); ++ } ++} ++ ++static void ++missing_rpm_change (void) ++{ ++ debug_flush_missing (); ++ ++ gdb_assert (missing_rpm_list == NULL); ++ if (missing_rpm_hash != NULL) ++ { ++ htab_delete (missing_rpm_hash); ++ missing_rpm_hash = NULL; ++ } ++} ++ ++enum missing_exec ++ { ++ /* Init state. EXEC_BFD also still could be NULL. */ ++ MISSING_EXEC_NOT_TRIED, ++ /* We saw a non-NULL EXEC_BFD but RPM has no info about it. */ ++ MISSING_EXEC_NOT_FOUND, ++ /* We found EXEC_BFD by RPM and we either have its symbols (either embedded ++ or separate) or the main executable's RPM is now contained in ++ MISSING_RPM_HASH. */ ++ MISSING_EXEC_ENLISTED ++ }; ++static enum missing_exec missing_exec = MISSING_EXEC_NOT_TRIED; ++ ++#endif /* HAVE_LIBRPM */ ++ ++void ++debug_flush_missing (void) ++{ ++#ifdef HAVE_LIBRPM ++ missing_rpm_list_print (); ++#endif ++} ++ ++/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages ++ yum --enablerepo='*debug*' install ... ++ avoidance. */ ++ ++struct missing_filepair ++ { ++ char *binary; ++ char *debug; ++ char data[1]; ++ }; ++ ++static struct htab *missing_filepair_hash; ++static struct obstack missing_filepair_obstack; ++ ++static void * ++missing_filepair_xcalloc (size_t nmemb, size_t nmemb_size) ++{ ++ void *retval; ++ size_t size = nmemb * nmemb_size; ++ ++ retval = obstack_alloc (&missing_filepair_obstack, size); ++ memset (retval, 0, size); ++ return retval; ++} ++ ++static hashval_t ++missing_filepair_hash_func (const struct missing_filepair *elem) ++{ ++ hashval_t retval = 0; ++ ++ retval ^= htab_hash_string (elem->binary); ++ if (elem->debug != NULL) ++ retval ^= htab_hash_string (elem->debug); ++ ++ return retval; ++} ++ ++static int ++missing_filepair_eq (const struct missing_filepair *elem1, ++ const struct missing_filepair *elem2) ++{ ++ return strcmp (elem1->binary, elem2->binary) == 0 ++ && ((elem1->debug == NULL) == (elem2->debug == NULL)) ++ && (elem1->debug == NULL || strcmp (elem1->debug, elem2->debug) == 0); ++} ++ ++static void ++missing_filepair_change (void) ++{ ++ if (missing_filepair_hash != NULL) ++ { ++ obstack_free (&missing_filepair_obstack, NULL); ++ /* All their memory came just from missing_filepair_OBSTACK. */ ++ missing_filepair_hash = NULL; ++ } ++#ifdef HAVE_LIBRPM ++ missing_exec = MISSING_EXEC_NOT_TRIED; ++#endif ++} ++ ++static void ++debug_print_executable_changed (void) ++{ ++#ifdef HAVE_LIBRPM ++ missing_rpm_change (); ++#endif ++ missing_filepair_change (); ++} ++ ++/* Notify user the file BINARY with (possibly NULL) associated separate debug ++ information file DEBUG is missing. DEBUG may or may not be the build-id ++ file such as would be: ++ /usr/lib/debug/.build-id/dd/b1d2ce632721c47bb9e8679f369e2295ce71be.debug ++ */ ++ ++void ++debug_print_missing (const char *binary, const char *debug) ++{ ++ size_t binary_len0 = strlen (binary) + 1; ++ size_t debug_len0 = debug ? strlen (debug) + 1 : 0; ++ struct missing_filepair missing_filepair_find; ++ struct missing_filepair *missing_filepair; ++ struct missing_filepair **slot; ++ ++ if (build_id_verbose < BUILD_ID_VERBOSE_FILENAMES) ++ return; ++ ++ if (missing_filepair_hash == NULL) ++ { ++ obstack_init (&missing_filepair_obstack); ++ missing_filepair_hash = htab_create_alloc (64, ++ (hashval_t (*) (const void *)) missing_filepair_hash_func, ++ (int (*) (const void *, const void *)) missing_filepair_eq, NULL, ++ missing_filepair_xcalloc, NULL); ++ } ++ ++ /* Use MISSING_FILEPAIR_FIND first instead of calling obstack_alloc with ++ obstack_free in the case of a (rare) match. The problem is ALLOC_F for ++ MISSING_FILEPAIR_HASH allocates from MISSING_FILEPAIR_OBSTACK maintenance ++ structures for MISSING_FILEPAIR_HASH. Calling obstack_free would possibly ++ not to free only MISSING_FILEPAIR but also some such structures (allocated ++ during the htab_find_slot call). */ ++ ++ missing_filepair_find.binary = (char *) binary; ++ missing_filepair_find.debug = (char *) debug; ++ slot = (struct missing_filepair **) htab_find_slot (missing_filepair_hash, ++ &missing_filepair_find, ++ INSERT); ++ ++ /* While it may be still printed duplicitely with the missing debuginfo file ++ * it is due to once printing about the binary file build-id link and once ++ * about the .debug file build-id link as both the build-id symlinks are ++ * located in the debuginfo package. */ ++ ++ if (*slot != NULL) ++ return; ++ ++ missing_filepair = (struct missing_filepair *) obstack_alloc (&missing_filepair_obstack, ++ sizeof (*missing_filepair) - 1 ++ + binary_len0 + debug_len0); ++ missing_filepair->binary = missing_filepair->data; ++ memcpy (missing_filepair->binary, binary, binary_len0); ++ if (debug != NULL) ++ { ++ missing_filepair->debug = missing_filepair->binary + binary_len0; ++ memcpy (missing_filepair->debug, debug, debug_len0); ++ } ++ else ++ missing_filepair->debug = NULL; ++ ++ *slot = missing_filepair; ++ ++#ifdef HAVE_LIBRPM ++ if (missing_exec == MISSING_EXEC_NOT_TRIED) ++ { ++ const char *execfilename = get_exec_file (0); ++ ++ if (execfilename != NULL) ++ { ++ if (missing_rpm_enlist (execfilename) == 0) ++ missing_exec = MISSING_EXEC_NOT_FOUND; ++ else ++ missing_exec = MISSING_EXEC_ENLISTED; ++ } ++ } ++ if (missing_exec != MISSING_EXEC_ENLISTED) ++ if ((binary[0] == 0 || missing_rpm_enlist (binary) == 0) ++ && (debug == NULL || missing_rpm_enlist (debug) == 0)) ++#endif /* HAVE_LIBRPM */ ++ { ++ /* We do not collect and flush these messages as each such message ++ already requires its own separate lines. */ ++ ++ gdb_printf (gdb_stdlog, ++ _("Missing separate debuginfo for %s\n"), binary); ++ if (debug != NULL) ++ gdb_printf (gdb_stdlog, _("Try: %s %s\n"), ++#ifdef DNF_DEBUGINFO_INSTALL ++ "dnf" ++#else ++ "yum" ++#endif ++ " --enablerepo='*debug*' install", debug); ++ } ++} ++ + /* See build-id.h. */ + + gdb_bfd_ref_ptr +-build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) ++build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id, ++ char **link_return) + { +- return build_id_to_bfd_suffix (build_id_len, build_id, ".debug"); ++ return build_id_to_bfd_suffix (build_id_len, build_id, ".debug", ++ link_return); + } + + /* See build-id.h. */ + + gdb_bfd_ref_ptr +-build_id_to_exec_bfd (size_t build_id_len, const bfd_byte *build_id) ++build_id_to_exec_bfd (size_t build_id_len, const bfd_byte *build_id, ++ char **link_return) + { +- return build_id_to_bfd_suffix (build_id_len, build_id, ""); ++ return build_id_to_bfd_suffix (build_id_len, build_id, "", link_return); + } + + /* See build-id.h. */ + + std::string +-find_separate_debug_file_by_buildid (struct objfile *objfile) ++find_separate_debug_file_by_buildid (struct objfile *objfile, ++ gdb::unique_xmalloc_ptr *build_id_filename_return) + { + const struct bfd_build_id *build_id; + +- build_id = build_id_bfd_get (objfile->obfd.get ()); ++ if (build_id_filename_return) ++ *build_id_filename_return = NULL; ++ ++ build_id = build_id_bfd_shdr_get (objfile->obfd.get ()); + if (build_id != NULL) + { + if (separate_debug_file_debug) +@@ -214,8 +1343,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) + _("\nLooking for separate debug info (build-id) for " + "%s\n"), objfile_name (objfile)); + ++ char *build_id_filename_cstr = NULL; + gdb_bfd_ref_ptr abfd (build_id_to_debug_bfd (build_id->size, +- build_id->data)); ++ build_id->data, ++ (!build_id_filename_return ? NULL : &build_id_filename_cstr))); ++ if (build_id_filename_return) ++ { ++ if (!build_id_filename_cstr) ++ gdb_assert (!*build_id_filename_return); ++ else ++ { ++ *build_id_filename_return = gdb::unique_xmalloc_ptr (build_id_filename_cstr); ++ build_id_filename_cstr = NULL; ++ } ++ } ++ + /* Prevent looping on a stripped .debug file. */ + if (abfd != NULL + && filename_cmp (bfd_get_filename (abfd.get ()), +@@ -228,3 +1370,22 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) + + return std::string (); + } ++ ++void _initialize_build_id (); ++ ++void ++_initialize_build_id () ++{ ++ add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose, ++ _("\ ++Set debugging level of the build-id locator."), _("\ ++Show debugging level of the build-id locator."), _("\ ++Level 1 (default) enables printing the missing debug filenames,\n\ ++level 2 also prints the parsing of binaries to find the identificators."), ++ NULL, ++ show_build_id_verbose, ++ &setlist, &showlist); ++ ++ gdb::observers::executable_changed.attach (debug_print_executable_changed, ++ "build-id"); ++} +diff --git a/gdb/build-id.h b/gdb/build-id.h +--- a/gdb/build-id.h ++++ b/gdb/build-id.h +@@ -23,9 +23,10 @@ + #include "gdb_bfd.h" + #include "gdbsupport/rsp-low.h" + +-/* Locate NT_GNU_BUILD_ID from ABFD and return its content. */ ++/* Separate debuginfo files have corrupted PHDR but SHDR is correct there. ++ Locate NT_GNU_BUILD_ID from ABFD and return its content. */ + +-extern const struct bfd_build_id *build_id_bfd_get (bfd *abfd); ++extern const struct bfd_build_id *build_id_bfd_shdr_get (bfd *abfd); + + /* Return true if ABFD has NT_GNU_BUILD_ID matching the CHECK value. + Otherwise, issue a warning and return false. */ +@@ -38,21 +39,26 @@ extern int build_id_verify (bfd *abfd, + can be found, return NULL. */ + + extern gdb_bfd_ref_ptr build_id_to_debug_bfd (size_t build_id_len, +- const bfd_byte *build_id); ++ const bfd_byte *build_id, ++ char **link_return = NULL); ++ ++extern char *build_id_to_filename (const struct bfd_build_id *build_id, ++ char **link_return); + + /* Find and open a BFD for an executable file given a build-id. If no BFD + can be found, return NULL. The returned reference to the BFD must be + released by the caller. */ + + extern gdb_bfd_ref_ptr build_id_to_exec_bfd (size_t build_id_len, +- const bfd_byte *build_id); ++ const bfd_byte *build_id, ++ char **link_return); + + /* Find the separate debug file for OBJFILE, by using the build-id + associated with OBJFILE's BFD. If successful, returns the file name for the + separate debug file, otherwise, return an empty string. */ + +-extern std::string find_separate_debug_file_by_buildid +- (struct objfile *objfile); ++extern std::string find_separate_debug_file_by_buildid (struct objfile *objfile, ++ gdb::unique_xmalloc_ptr *build_id_filename_return); + + /* Return an hex-string representation of BUILD_ID. */ + +diff --git a/gdb/coffread.c b/gdb/coffread.c +--- a/gdb/coffread.c ++++ b/gdb/coffread.c +@@ -734,7 +734,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 ()) + { +- std::string debugfile = find_separate_debug_file_by_buildid (objfile); ++ std::string debugfile = find_separate_debug_file_by_buildid (objfile, ++ NULL); + + if (debugfile.empty ()) + debugfile = find_separate_debug_file_by_debuglink (objfile); +diff --git a/gdb/corelow.c b/gdb/corelow.c +--- a/gdb/corelow.c ++++ b/gdb/corelow.c +@@ -22,6 +22,10 @@ + #include + #include + #include "frame.h" /* required by inferior.h */ ++#include "auxv.h" ++#include "build-id.h" ++#include "elf/common.h" ++#include "gdbcmd.h" + #include "inferior.h" + #include "infrun.h" + #include "symtab.h" +@@ -391,6 +395,8 @@ add_to_thread_list (asection *asect, asection *reg_sect) + switch_to_thread (thr); /* Yes, make it current. */ + } + ++static bool build_id_core_loads = true; ++ + /* Issue a message saying we have no core to debug, if FROM_TTY. */ + + static void +@@ -427,12 +433,14 @@ core_file_command (const char *filename, int from_tty) + static void + locate_exec_from_corefile_build_id (bfd *abfd, int from_tty) + { +- const bfd_build_id *build_id = build_id_bfd_get (abfd); ++ const bfd_build_id *build_id = build_id_bfd_shdr_get (abfd); + if (build_id == nullptr) + return; + ++ char *build_id_filename; + gdb_bfd_ref_ptr execbfd +- = build_id_to_exec_bfd (build_id->size, build_id->data); ++ = build_id_to_exec_bfd (build_id->size, build_id->data, ++ &build_id_filename); + + if (execbfd == nullptr) + { +@@ -460,7 +468,12 @@ locate_exec_from_corefile_build_id (bfd *abfd, int from_tty) + exec_file_attach (bfd_get_filename (execbfd.get ()), from_tty); + symbol_file_add_main (bfd_get_filename (execbfd.get ()), + symfile_add_flag (from_tty ? SYMFILE_VERBOSE : 0)); ++ if (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. */ +@@ -1325,4 +1338,11 @@ _initialize_corelow () + maintenance_print_core_file_backed_mappings, + _("Print core file's file-backed mappings."), + &maintenanceprintlist); ++ ++ add_setshow_boolean_cmd ("build-id-core-loads", class_files, ++ &build_id_core_loads, _("\ ++Set whether CORE-FILE loads the build-id associated files automatically."), _("\ ++Show whether CORE-FILE loads the build-id associated files automatically."), ++ NULL, NULL, NULL, ++ &setlist, &showlist); + } +diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo +--- a/gdb/doc/gdb.texinfo ++++ b/gdb/doc/gdb.texinfo +@@ -22037,6 +22037,27 @@ information files. + + @end table + ++You can also adjust the current verbosity of the @dfn{build id} locating. ++ ++@table @code ++ ++@kindex set build-id-verbose ++@item set build-id-verbose 0 ++No additional messages are printed. ++ ++@item set build-id-verbose 1 ++Missing separate debug filenames are printed. ++ ++@item set build-id-verbose 2 ++Missing separate debug filenames are printed and also all the parsing of the ++binaries to find their @dfn{build id} content is printed. ++ ++@kindex show build-id-verbose ++@item show build-id-verbose ++Show the current verbosity value for the @dfn{build id} content locating. ++ ++@end table ++ + @cindex @code{.gnu_debuglink} sections + @cindex debug link sections + A debug link is a special section of the executable file named +diff --git a/gdb/dwarf2/index-cache.c b/gdb/dwarf2/index-cache.c +--- a/gdb/dwarf2/index-cache.c ++++ b/gdb/dwarf2/index-cache.c +@@ -101,7 +101,7 @@ index_cache::store (dwarf2_per_objfile *per_objfile) + return; + + /* Get build id of objfile. */ +- const bfd_build_id *build_id = build_id_bfd_get (obj->obfd.get ()); ++ const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd.get ()); + if (build_id == nullptr) + { + index_cache_debug ("objfile %s has no build id", +@@ -118,7 +118,8 @@ index_cache::store (dwarf2_per_objfile *per_objfile) + + if (dwz != nullptr) + { +- const bfd_build_id *dwz_build_id = build_id_bfd_get (dwz->dwz_bfd.get ()); ++ const bfd_build_id *dwz_build_id ++ = build_id_bfd_shdr_get (dwz->dwz_bfd.get ()); + + if (dwz_build_id == nullptr) + { +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -5328,7 +5328,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner) + static gdb::array_view + get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd) + { +- const bfd_build_id *build_id = build_id_bfd_get (obj->obfd.get ()); ++ const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd.get ()); + if (build_id == nullptr) + return {}; + +@@ -5341,7 +5341,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd) + static gdb::array_view + get_gdb_index_contents_from_cache_dwz (objfile *obj, dwz_file *dwz) + { +- const bfd_build_id *build_id = build_id_bfd_get (dwz->dwz_bfd.get ()); ++ const bfd_build_id *build_id = build_id_bfd_shdr_get (dwz->dwz_bfd.get ()); + if (build_id == nullptr) + return {}; + +diff --git a/gdb/elfread.c b/gdb/elfread.c +--- a/gdb/elfread.c ++++ b/gdb/elfread.c +@@ -1213,7 +1213,9 @@ elf_symfile_read_dwarf2 (struct objfile *objfile, + && objfile->separate_debug_objfile == NULL + && objfile->separate_debug_objfile_backlink == NULL) + { +- std::string debugfile = find_separate_debug_file_by_buildid (objfile); ++ gdb::unique_xmalloc_ptr build_id_filename; ++ std::string debugfile ++ = find_separate_debug_file_by_buildid (objfile, &build_id_filename); + + if (debugfile.empty ()) + debugfile = find_separate_debug_file_by_debuglink (objfile); +@@ -1229,7 +1231,7 @@ elf_symfile_read_dwarf2 (struct objfile *objfile, + { + has_dwarf2 = false; + const struct bfd_build_id *build_id +- = build_id_bfd_get (objfile->obfd.get ()); ++ = build_id_bfd_shdr_get (objfile->obfd.get ()); + const char *filename = bfd_get_filename (objfile->obfd.get ()); + + if (build_id != nullptr) +@@ -1256,6 +1258,11 @@ elf_symfile_read_dwarf2 (struct objfile *objfile, + has_dwarf2 = true; + } + } ++ /* Check if any separate debug info has been extracted out. */ ++ else if (bfd_get_section_by_name (objfile->obfd.get (), ++ ".gnu_debuglink") ++ != NULL) ++ debug_print_missing (objfile_name (objfile), build_id_filename.get ()); + } + } + } +diff --git a/gdb/exec.c b/gdb/exec.c +--- a/gdb/exec.c ++++ b/gdb/exec.c +@@ -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 (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 +@@ -250,7 +250,7 @@ validate_exec_file (int from_tty) + if (abfd != nullptr) + { + const bfd_build_id *target_exec_file_build_id +- = build_id_bfd_get (abfd.get ()); ++ = build_id_bfd_shdr_get (abfd.get ()); + + if (target_exec_file_build_id != nullptr) + { +diff --git a/gdb/objfiles.h b/gdb/objfiles.h +--- a/gdb/objfiles.h ++++ b/gdb/objfiles.h +@@ -786,6 +786,10 @@ struct objfile + bool skip_jit_symbol_lookup = false; + }; + ++/* This file was loaded according to the BUILD_ID_CORE_LOADS rules. */ ++ ++#define OBJF_BUILD_ID_CORE_LOADED static_cast(1 << 12) ++ + /* A deleter for objfile. */ + + struct objfile_deleter +diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c +--- a/gdb/python/py-objfile.c ++++ b/gdb/python/py-objfile.c +@@ -158,7 +158,7 @@ objfpy_get_build_id (PyObject *self, void *closure) + + try + { +- build_id = build_id_bfd_get (objfile->obfd.get ()); ++ build_id = build_id_bfd_shdr_get (objfile->obfd.get ()); + } + catch (const gdb_exception &except) + { +@@ -629,7 +629,7 @@ gdbpy_lookup_objfile (PyObject *self, PyObject *args, PyObject *kw) + if (obfd == nullptr) + return 0; + +- const bfd_build_id *obfd_build_id = build_id_bfd_get (obfd); ++ const bfd_build_id *obfd_build_id = build_id_bfd_shdr_get (obfd); + if (obfd_build_id == nullptr) + return 0; + +diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c +--- a/gdb/solib-svr4.c ++++ b/gdb/solib-svr4.c +@@ -45,6 +45,7 @@ + #include "auxv.h" + #include "gdb_bfd.h" + #include "probe.h" ++#include "build-id.h" + + #include + +@@ -1319,9 +1320,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, + continue; + } + +- strncpy (newobj->so_name, buffer.get (), SO_NAME_MAX_PATH_SIZE - 1); +- newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; +- strcpy (newobj->so_original_name, newobj->so_name); ++ { ++ struct bfd_build_id *build_id; ++ ++ strncpy (newobj->so_original_name, buffer.get (), SO_NAME_MAX_PATH_SIZE - 1); ++ newobj->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; ++ /* May get overwritten below. */ ++ strcpy (newobj->so_name, newobj->so_original_name); ++ ++ build_id = build_id_addr_get (((lm_info_svr4 *) newobj->lm_info)->l_ld); ++ if (build_id != NULL) ++ { ++ char *name, *build_id_filename; ++ ++ /* Missing the build-id matching separate debug info file ++ would be handled while SO_NAME gets loaded. */ ++ name = build_id_to_filename (build_id, &build_id_filename); ++ if (name != NULL) ++ { ++ strncpy (newobj->so_name, name, SO_NAME_MAX_PATH_SIZE - 1); ++ newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; ++ xfree (name); ++ } ++ else ++ { ++ debug_print_missing (newobj->so_name, build_id_filename); ++ ++ /* In the case the main executable was found according to ++ its build-id (from a core file) prevent loading ++ a different build of a library with accidentally the ++ same SO_NAME. ++ ++ It suppresses bogus backtraces (and prints "??" there ++ instead) if the on-disk files no longer match the ++ running program version. */ ++ ++ if (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; ++ } ++ ++ xfree (build_id_filename); ++ xfree (build_id); ++ } ++ } + + /* If this entry has no name, or its name matches the name + for the main executable, don't include it in the list. */ +diff --git a/gdb/source.c b/gdb/source.c +--- a/gdb/source.c ++++ b/gdb/source.c +@@ -1196,7 +1196,7 @@ open_source_file (struct symtab *s) + } + + const struct bfd_build_id *build_id +- = build_id_bfd_get (ofp->obfd.get ()); ++ = build_id_bfd_shdr_get (ofp->obfd.get ()); + + /* Query debuginfod for the source file. */ + if (build_id != nullptr && !srcpath.empty ()) +diff --git a/gdb/symfile.h b/gdb/symfile.h +--- a/gdb/symfile.h ++++ b/gdb/symfile.h +@@ -342,12 +342,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. + + ARGS should be in the form "EXECUTABLE [OFFSET]", where OFFSET is an + optional offset to apply to each section. */ + extern void generic_load (const char *args, int from_tty); + ++/* build-id support. */ ++extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr); ++extern void debug_print_missing (const char *binary, const char *debug); ++#define BUILD_ID_MAIN_EXECUTABLE_FILENAME _("the main executable file") ++ + /* From minidebug.c. */ + + 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 +@@ -349,3 +349,33 @@ gdb_test_multiple "core-file $corefile" $test { + pass $test + } + } ++ ++ ++# Test auto-loading of binary files through build-id from the core file. ++set buildid [build_id_debug_filename_get $binfile] ++set wholetest "binfile found by build-id" ++if {$buildid == ""} { ++ untested "$wholetest (binary has no build-id)" ++} else { ++ gdb_exit ++ gdb_start ++ ++ regsub {\.debug$} $buildid {} buildid ++ set debugdir [standard_output_file ${testfile}-debugdir] ++ file delete -force -- $debugdir ++ file mkdir $debugdir/[file dirname $buildid] ++ file copy $binfile $debugdir/$buildid ++ ++ set test "show debug-file-directory" ++ gdb_test_multiple $test $test { ++ -re "The directory where separate debug symbols are searched for is \"(.*)\"\\.\r\n$gdb_prompt $" { ++ set debugdir_orig $expect_out(1,string) ++ pass $test ++ } ++ } ++ gdb_test_no_output "set debug-file-directory $debugdir:$debugdir_orig" "set debug-file-directory" ++ gdb_test "show build-id-core-loads" {Whether CORE-FILE loads the build-id associated files automatically is on\.} ++ gdb_test "core-file $corefile" "\r\nProgram terminated with .*" "core-file without executable" ++ gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*" ++ pass $wholetest ++} +diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp +--- a/gdb/testsuite/gdb.base/gdbinit-history.exp ++++ b/gdb/testsuite/gdb.base/gdbinit-history.exp +@@ -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 +@@ -62,6 +62,7 @@ proc test_command_line_new_ui_pending_input {} { + set options "" + append options " -iex \"set height 0\"" + append options " -iex \"set width 0\"" ++ append options " -iex \"set build-id-verbose 0\"" + append options " -iex \"new-ui console $extra_tty_name\"" + append options " -ex \"b $bpline\"" + append options " -ex \"run\"" +diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -217,7 +217,8 @@ if ![info exists INTERNAL_GDBFLAGS] { + "-nw" \ + "-nx" \ + {-iex "set height 0"} \ +- {-iex "set width 0"}]] ++ {-iex "set width 0"} \ ++ {-iex "set build-id-verbose 0"}]] + + set INTERNAL_GDBFLAGS [append_gdb_data_directory_option $INTERNAL_GDBFLAGS] + } +@@ -2349,6 +2350,17 @@ proc default_gdb_start { } { + } + } + ++ # Turn off the missing warnings as the testsuite does not expect it. ++ send_gdb "set build-id-verbose 0\n" ++ gdb_expect 10 { ++ -re "$gdb_prompt $" { ++ verbose "Disabled the missing debug infos warnings." 2 ++ } ++ timeout { ++ warning "Could not disable the missing debug infos warnings.." ++ } ++ } ++ + gdb_debug_init + return 0 + } +diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp +--- a/gdb/testsuite/lib/mi-support.exp ++++ b/gdb/testsuite/lib/mi-support.exp +@@ -330,6 +330,16 @@ proc default_mi_gdb_start { { flags {} } } { + warning "Couldn't set the width to 0." + } + } ++ # Turn off the missing warnings as the testsuite does not expect it. ++ send_gdb "190-gdb-set build-id-verbose 0\n" ++ gdb_expect 10 { ++ -re ".*190-gdb-set build-id-verbose 0\r\n190\\\^done\r\n$mi_gdb_prompt$" { ++ verbose "Disabled the missing debug infos warnings." 2 ++ } ++ timeout { ++ warning "Could not disable the missing debug infos warnings.." ++ } ++ } + + if { $separate_inferior_pty } { + mi_create_inferior_pty diff --git a/gdb-6.6-bz229517-gcore-without-terminal.patch b/gdb-6.6-bz229517-gcore-without-terminal.patch new file mode 100644 index 0000000..2c127cc --- /dev/null +++ b/gdb-6.6-bz229517-gcore-without-terminal.patch @@ -0,0 +1,188 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jan Kratochvil +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.6-bz229517-gcore-without-terminal.patch + +;; Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517). +;;=fedoratest + +2007-04-22 Jan Kratochvil + + * gdb_gcore.sh: Redirect GDB from ` + + * gdb.base/gcorebg.exp, gdb.base/gcorebg.c: New files. + +diff --git a/gdb/testsuite/gdb.base/gcorebg.c b/gdb/testsuite/gdb.base/gcorebg.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/gcorebg.c +@@ -0,0 +1,49 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++int main (int argc, char **argv) ++{ ++ pid_t pid = 0; ++ pid_t ppid; ++ char buf[1024*2 + 500]; ++ int gotint; ++ ++ if (argc != 4) ++ { ++ fprintf (stderr, "Syntax: %s {standard|detached} \n", ++ argv[0]); ++ exit (1); ++ } ++ ++ pid = fork (); ++ ++ switch (pid) ++ { ++ case 0: ++ if (strcmp (argv[1], "detached") == 0) ++ setpgrp (); ++ ppid = getppid (); ++ gotint = snprintf (buf, sizeof (buf), "sh %s -o %s %d", argv[2], argv[3], (int) ppid); ++ assert (gotint < sizeof (buf)); ++ system (buf); ++ fprintf (stderr, "Killing parent PID %d\n", ppid); ++ kill (ppid, SIGTERM); ++ break; ++ ++ case -1: ++ perror ("fork err\n"); ++ exit (1); ++ break; ++ ++ default: ++ fprintf (stderr,"Sleeping as PID %d\n", getpid ()); ++ sleep (60); ++ } ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/gcorebg.exp b/gdb/testsuite/gdb.base/gcorebg.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/gcorebg.exp +@@ -0,0 +1,113 @@ ++# Copyright 2007 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++# Please email any bugs, comments, and/or additions to this file to: ++# bug-gdb@prep.ai.mit.edu ++ ++# This file was written by Jan Kratochvil . ++# This is a test for `gdb_gcore.sh' functionality. ++# It also tests a regression with `gdb_gcore.sh' being run without its ++# accessible terminal. ++ ++if ![info exists GCORE] { ++ set GCORE "[standard_output_file ../../../../gcore]" ++} ++verbose "using GCORE = $GCORE" 2 ++ ++set testfile "gcorebg" ++set srcfile ${testfile}.c ++set binfile [standard_output_file ${testfile}] ++set corefile [standard_output_file ${testfile}.test] ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { ++ untested gcorebg.exp ++ return -1 ++} ++ ++# Cleanup. ++ ++proc core_clean {} { ++ global corefile ++ ++ foreach file [glob -nocomplain [join [list $corefile *] ""]] { ++ verbose "Delete file $file" 1 ++ remote_file target delete $file ++ } ++} ++core_clean ++remote_file target delete "./gdb" ++ ++# Generate the core file. ++ ++# Provide `./gdb' for `gdb_gcore.sh' running it as a bare `gdb' command. ++# Setup also `$PATH' appropriately. ++# If GDB was not found let `gdb_gcore.sh' to find the system GDB by `$PATH'. ++if {$GDB != "gdb"} { ++ file link ./gdb $GDB ++} ++global env ++set oldpath $env(PATH) ++set env(PATH) [join [list . $env(PATH)] ":"] ++verbose "PATH = $env(PATH)" 2 ++ ++# Test file body. ++# $detached == "standard" || $detached == "detached" ++ ++proc test_body { detached } { ++ global binfile ++ global GCORE ++ global corefile ++ ++ set res [remote_spawn target "$binfile $detached $GCORE $corefile"] ++ if { $res < 0 || $res == "" } { ++ fail "Spawning $detached gcore" ++ return 1 ++ } ++ pass "Spawning $detached gcore" ++ remote_expect target 20 { ++ timeout { ++ fail "Spawned $detached gcore finished (timeout)" ++ remote_exec target "kill -9 -[exp_pid -i $res]" ++ return 1 ++ } ++ "Saved corefile .*\r\nKilling parent PID " { ++ pass "Spawned $detached gcore finished" ++ remote_wait target 20 ++ } ++ } ++ ++ if {1 == [llength [glob -nocomplain [join [list $corefile *] ""]]]} { ++ pass "Core file generated by $detached gcore" ++ } else { ++ fail "Core file generated by $detached gcore" ++ } ++ core_clean ++} ++ ++# First a general `gdb_gcore.sh' spawn with its controlling terminal available. ++ ++test_body standard ++ ++# And now `gdb_gcore.sh' spawn without its controlling terminal available. ++# It is spawned through `gcorebg.c' using setpgrp (). ++ ++test_body detached ++ ++ ++# Cleanup. ++ ++set env(PATH) $oldpath ++remote_file target delete "./gdb" diff --git a/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch b/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch new file mode 100644 index 0000000..4faef13 --- /dev/null +++ b/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch @@ -0,0 +1,278 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jan Kratochvil +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch + +;; Support for stepping over PPC atomic instruction sequences (BZ 237572). +;;=fedoratest + +2007-06-25 Jan Kratochvil + + * gdb.threads/atomic-seq-threaded.c, + gdb.threads/atomic-seq-threaded.exp: New files. + +diff --git a/gdb/testsuite/gdb.threads/atomic-seq-threaded.c b/gdb/testsuite/gdb.threads/atomic-seq-threaded.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/atomic-seq-threaded.c +@@ -0,0 +1,171 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2007 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, ++ MA 02110-1301, USA. */ ++ ++/* Test stepping over RISC atomic sequences. ++ This variant testcases the code for stepping another thread while skipping ++ over the atomic sequence in the former thread ++ (STEPPING_PAST_SINGLESTEP_BREAKPOINT). ++ Code comes from gcc/testsuite/gcc.dg/sync-2.c */ ++ ++/* { dg-options "-march=i486" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ ++/* { dg-options "-mcpu=v9" { target sparc*-*-* } } */ ++ ++/* Test functionality of the intrinsics for 'short' and 'char'. */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#define LOOPS 2 ++ ++static int unused; ++ ++static char AI[18]; ++static char init_qi[18] = { 3,5,7,9,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0 }; ++static char test_qi[18] = { 3,5,7,9,1,4,22,-12,7,8,9,7,1,-12,7,8,9,7 }; ++ ++static void ++do_qi (void) ++{ ++ if (__sync_fetch_and_add(AI+4, 1) != 0) ++ abort (); ++ if (__sync_fetch_and_add(AI+5, 4) != 0) ++ abort (); ++ if (__sync_fetch_and_add(AI+6, 22) != 0) ++ abort (); ++ if (__sync_fetch_and_sub(AI+7, 12) != 0) ++ abort (); ++ if (__sync_fetch_and_and(AI+8, 7) != (char)-1) ++ abort (); ++ if (__sync_fetch_and_or(AI+9, 8) != 0) ++ abort (); ++ if (__sync_fetch_and_xor(AI+10, 9) != 0) ++ abort (); ++ if (__sync_fetch_and_nand(AI+11, 7) != 0) ++ abort (); ++ ++ if (__sync_add_and_fetch(AI+12, 1) != 1) ++ abort (); ++ if (__sync_sub_and_fetch(AI+13, 12) != (char)-12) ++ abort (); ++ if (__sync_and_and_fetch(AI+14, 7) != 7) ++ abort (); ++ if (__sync_or_and_fetch(AI+15, 8) != 8) ++ abort (); ++ if (__sync_xor_and_fetch(AI+16, 9) != 9) ++ abort (); ++ if (__sync_nand_and_fetch(AI+17, 7) != 7) ++ abort (); ++} ++ ++static short AL[18]; ++static short init_hi[18] = { 3,5,7,9,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0 }; ++static short test_hi[18] = { 3,5,7,9,1,4,22,-12,7,8,9,7,1,-12,7,8,9,7 }; ++ ++static void ++do_hi (void) ++{ ++ if (__sync_fetch_and_add(AL+4, 1) != 0) ++ abort (); ++ if (__sync_fetch_and_add(AL+5, 4) != 0) ++ abort (); ++ if (__sync_fetch_and_add(AL+6, 22) != 0) ++ abort (); ++ if (__sync_fetch_and_sub(AL+7, 12) != 0) ++ abort (); ++ if (__sync_fetch_and_and(AL+8, 7) != -1) ++ abort (); ++ if (__sync_fetch_and_or(AL+9, 8) != 0) ++ abort (); ++ if (__sync_fetch_and_xor(AL+10, 9) != 0) ++ abort (); ++ if (__sync_fetch_and_nand(AL+11, 7) != 0) ++ abort (); ++ ++ if (__sync_add_and_fetch(AL+12, 1) != 1) ++ abort (); ++ if (__sync_sub_and_fetch(AL+13, 12) != -12) ++ abort (); ++ if (__sync_and_and_fetch(AL+14, 7) != 7) ++ abort (); ++ if (__sync_or_and_fetch(AL+15, 8) != 8) ++ abort (); ++ if (__sync_xor_and_fetch(AL+16, 9) != 9) ++ abort (); ++ if (__sync_nand_and_fetch(AL+17, 7) != 7) ++ abort (); ++} ++ ++static void * ++start1 (void *arg) ++{ ++ unsigned loop; ++ sleep(1); ++ ++ for (loop = 0; loop < LOOPS; loop++) ++ { ++ memcpy(AI, init_qi, sizeof(init_qi)); ++ ++ do_qi (); ++ ++ if (memcmp (AI, test_qi, sizeof(test_qi))) ++ abort (); ++ } ++ ++ return arg; /* _delete1_ */ ++} ++ ++static void * ++start2 (void *arg) ++{ ++ unsigned loop; ++ ++ for (loop = 0; loop < LOOPS; loop++) ++ { ++ memcpy(AL, init_hi, sizeof(init_hi)); ++ ++ do_hi (); ++ ++ if (memcmp (AL, test_hi, sizeof(test_hi))) ++ abort (); ++ } ++ ++ return arg; /* _delete2_ */ ++} ++ ++int ++main (int argc, char **argv) ++{ ++ pthread_t thread; ++ int i; ++ ++ i = pthread_create (&thread, NULL, start1, NULL); /* _create_ */ ++ assert (i == 0); /* _create_after_ */ ++ ++ sleep (1); ++ ++ start2 (NULL); ++ ++ i = pthread_join (thread, NULL); /* _delete_ */ ++ assert (i == 0); ++ ++ return 0; /* _exit_ */ ++} +diff --git a/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp b/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp +@@ -0,0 +1,84 @@ ++# atomic-seq-threaded.exp -- Test case for stepping over RISC atomic code seqs. ++# This variant testcases the code for stepping another thread while skipping ++# over the atomic sequence in the former thread ++# (STEPPING_PAST_SINGLESTEP_BREAKPOINT). ++# Copyright (C) 2007 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ++ ++# Please email any bugs, comments, and/or additions to this file to: ++# bug-gdb@prep.ai.mit.edu ++ ++set testfile atomic-seq-threaded ++set srcfile ${testfile}.c ++set binfile [standard_output_file ${testfile}] ++ ++foreach opts {{} {compiler=gcc4} {FAIL}} { ++ if {$opts eq "FAIL"} { ++ return -1 ++ } ++ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $opts]] eq "" } { ++ break ++ } ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++ ++gdb_load ${binfile} ++if ![runto_main] then { ++ fail "Can't run to main" ++ return 0 ++} ++ ++# pthread_create () will not pass even on x86_64 with software watchpoint. ++# Pass after pthread_create () without any watchpoint active. ++set line [gdb_get_line_number "_create_after_"] ++gdb_test "tbreak $line" \ ++ "reakpoint (\[0-9\]+) at .*$srcfile, line $line\..*" \ ++ "set breakpoint after pthread_create ()" ++gdb_test "c" \ ++ ".*/\\* _create_after_ \\*/.*" \ ++ "run till after pthread_create ()" ++ ++# Without a watchpoint being software no single-stepping would be used. ++set test "Start (software) watchpoint" ++gdb_test_multiple "watch unused" $test { ++ -re "Watchpoint \[0-9\]+: unused.*$gdb_prompt $" { ++ pass $test ++ } ++ -re "Hardware watchpoint \[0-9\]+: unused.*$gdb_prompt $" { ++ # We do not test the goal but still the whole testcase should pass. ++ unsupported $test ++ } ++} ++ ++# More thorough testing of the scheduling logic. ++gdb_test "set scheduler-locking step" "" ++ ++# Critical code path is stepped through at this point. ++set line [gdb_get_line_number "_exit_"] ++gdb_test "tbreak $line" \ ++ "reakpoint \[0-9\]+ at .*$srcfile, line $line\..*" \ ++ "set breakpoint at _exit_" ++gdb_test "c" \ ++ ".*/\\* _exit_ \\*/.*" \ ++ "run till _exit_" ++ ++# Just a nonproblematic program exit. ++gdb_test "c" \ ++ ".*Program exited normally\\..*" \ ++ "run till program exit" diff --git a/gdb-6.6-testsuite-timeouts.patch b/gdb-6.6-testsuite-timeouts.patch new file mode 100644 index 0000000..a896313 --- /dev/null +++ b/gdb-6.6-testsuite-timeouts.patch @@ -0,0 +1,32 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.6-testsuite-timeouts.patch + +;; Avoid too long timeouts on failing cases of "annota1.exp annota3.exp". +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp +--- a/gdb/testsuite/gdb.base/annota1.exp ++++ b/gdb/testsuite/gdb.base/annota1.exp +@@ -39,6 +39,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb + + clean_restart ${binfile} + ++gdb_test "set breakpoint pending off" "" "Avoid lockup on nonexisting functions" ++ + # The commands we test here produce many lines of output; disable "press + # to continue" prompts. + gdb_test_no_output "set height 0" +diff --git a/gdb/testsuite/gdb.base/annota3.exp b/gdb/testsuite/gdb.base/annota3.exp +--- a/gdb/testsuite/gdb.base/annota3.exp ++++ b/gdb/testsuite/gdb.base/annota3.exp +@@ -38,6 +38,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb + + clean_restart ${binfile} + ++gdb_test "set breakpoint pending off" "" "Avoid lockup on nonexisting functions" ++ + # The commands we test here produce many lines of output; disable "press + # to continue" prompts. + gdb_test_no_output "set height 0" diff --git a/gdb-6.7-testsuite-stable-results.patch b/gdb-6.7-testsuite-stable-results.patch new file mode 100644 index 0000000..fcb007c --- /dev/null +++ b/gdb-6.7-testsuite-stable-results.patch @@ -0,0 +1,104 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jan Kratochvil +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.7-testsuite-stable-results.patch + +;; Testsuite fixes for more stable/comparable results. +;;=fedoratest + +gdb/testsuite/gdb.base/fileio.c: +gdb/testsuite/gdb.base/fileio.exp: +2007-12-08 Jan Kratochvil + + * gdb.base/fileio.c (ROOTSUBDIR): New macro. + (main): CHDIR into ROOTSUBDIR. CHOWN ROOTSUBDIR and CHDIR into + ROOTSUBDIR if we are being run as root. + * gdb.base/fileio.exp: Change the startup and finish cleanup. + Change the test file reference to be into the `fileio.dir' directory. + +sources/gdb/testsuite/gdb.base/dump.exp: +Found on RHEL-5.s390x. + +gdb-6.8.50.20090209/gdb/testsuite/gdb.base/auxv.exp: +random FAIL: gdb.base/auxv.exp: matching auxv data from live and gcore + +gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp: +frames-invalid can happen asynchronously. + +diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c +--- a/gdb/testsuite/gdb.base/fileio.c ++++ b/gdb/testsuite/gdb.base/fileio.c +@@ -559,6 +559,28 @@ strerrno (int err) + int + main () + { ++ /* These tests ++ Open for write but no write permission returns EACCES ++ Unlinking a file in a directory w/o write access returns EACCES ++ fail if we are being run as root - drop the privileges here. */ ++ ++ if (geteuid () == 0) ++ { ++ uid_t uid = 99; ++ ++ if (chown (OUTDIR, uid, uid) != 0) ++ { ++ printf ("chown %d.%d %s: %s\n", (int) uid, (int) uid, ++ OUTDIR, strerror (errno)); ++ exit (1); ++ } ++ if (setuid (uid) || geteuid () == 0) ++ { ++ printf ("setuid %d: %s\n", (int) uid, strerror (errno)); ++ exit (1); ++ } ++ } ++ + /* Don't change the order of the calls. They partly depend on each other */ + test_open (); + test_write (); +diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp +--- a/gdb/testsuite/gdb.base/fileio.exp ++++ b/gdb/testsuite/gdb.base/fileio.exp +@@ -24,9 +24,9 @@ if [target_info exists gdb,nofileio] { + standard_testfile + + if {[is_remote host]} { +- set outdir . ++ set outdir "fileio.dir" + } else { +- set outdir [standard_output_file {}] ++ set outdir [standard_output_file "fileio.dir"] + } + + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ +@@ -40,7 +40,8 @@ set dir2 [standard_output_file dir2.fileio.test] + if {[file exists $dir2] && ![file writable $dir2]} { + system "chmod +w $dir2" + } +-system "rm -rf [standard_output_file *.fileio.test]" ++system "rm -rf [standard_output_file fileio.dir]" ++system "mkdir -m777 [standard_output_file fileio.dir]" + + set oldtimeout $timeout + set timeout [expr "$timeout + 60"] +@@ -81,7 +82,7 @@ gdb_test continue \ + + gdb_test "continue" ".*" "" + +-catch "system \"chmod -f -w [standard_output_file nowrt.fileio.test]\"" ++catch "system \"chmod -f -w [standard_output_file fileio.dir/nowrt.fileio.test]\"" + + gdb_test continue \ + "Continuing\\..*open 5:.*EACCES$stop_msg" \ +@@ -268,9 +269,7 @@ gdb_test continue \ + gdb_exit + + # Make dir2 writable again so rm -rf of a build tree Just Works. +-if {[file exists $dir2] && ![file writable $dir2]} { +- system "chmod +w $dir2" +-} ++system "chmod -R +w $outdir" + + set timeout $oldtimeout + return 0 diff --git a/gdb-6.8-bz442765-threaded-exec-test.patch b/gdb-6.8-bz442765-threaded-exec-test.patch new file mode 100644 index 0000000..90685c7 --- /dev/null +++ b/gdb-6.8-bz442765-threaded-exec-test.patch @@ -0,0 +1,181 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-6.8-bz442765-threaded-exec-test.patch + +;; Test various forms of threads tracking across exec() (BZ 442765). +;;=fedoratest + +Test various forms of threads tracking across exec(2). + +diff --git a/gdb/testsuite/gdb.threads/threaded-exec.c b/gdb/testsuite/gdb.threads/threaded-exec.c +--- a/gdb/testsuite/gdb.threads/threaded-exec.c ++++ b/gdb/testsuite/gdb.threads/threaded-exec.c +@@ -18,21 +18,95 @@ + Boston, MA 02111-1307, USA. */ + + #include +-#include + #include + #include + #include ++#include + ++#ifdef THREADS ++ ++# include + + static void * + threader (void *arg) + { +- return NULL; ++ return NULL; + } + ++#endif ++ + int +-main (void) ++main (int argc, char **argv) + { ++ char *exec_nothreads, *exec_threads, *cmd; ++ int phase; ++ char phase_s[8]; ++ ++ setbuf (stdout, NULL); ++ ++ if (argc != 4) ++ { ++ fprintf (stderr, "%s \n", argv[0]); ++ return 1; ++ } ++ ++#ifdef THREADS ++ puts ("THREADS: Y"); ++#else ++ puts ("THREADS: N"); ++#endif ++ exec_nothreads = argv[1]; ++ printf ("exec_nothreads: %s\n", exec_nothreads); ++ exec_threads = argv[2]; ++ printf ("exec_threads: %s\n", exec_threads); ++ phase = atoi (argv[3]); ++ printf ("phase: %d\n", phase); ++ ++ /* Phases: threading ++ 0: N -> N ++ 1: N -> Y ++ 2: Y -> Y ++ 3: Y -> N ++ 4: N -> exit */ ++ ++ cmd = NULL; ++ ++#ifndef THREADS ++ switch (phase) ++ { ++ case 0: ++ cmd = exec_nothreads; ++ break; ++ case 1: ++ cmd = exec_threads; ++ break; ++ case 2: ++ fprintf (stderr, "%s: We should have threads for phase %d!\n", argv[0], ++ phase); ++ return 1; ++ case 3: ++ fprintf (stderr, "%s: We should have threads for phase %d!\n", argv[0], ++ phase); ++ return 1; ++ case 4: ++ return 0; ++ default: ++ assert (0); ++ } ++#else /* THREADS */ ++ switch (phase) ++ { ++ case 0: ++ fprintf (stderr, "%s: We should not have threads for phase %d!\n", ++ argv[0], phase); ++ return 1; ++ case 1: ++ fprintf (stderr, "%s: We should not have threads for phase %d!\n", ++ argv[0], phase); ++ return 1; ++ case 2: ++ cmd = exec_threads; ++ { + pthread_t t1; + int i; + +@@ -40,7 +114,34 @@ main (void) + assert (i == 0); + i = pthread_join (t1, NULL); + assert (i == 0); ++ } ++ break; ++ case 3: ++ cmd = exec_nothreads; ++ { ++ pthread_t t1; ++ int i; ++ ++ i = pthread_create (&t1, NULL, threader, (void *) NULL); ++ assert (i == 0); ++ i = pthread_join (t1, NULL); ++ assert (i == 0); ++ } ++ break; ++ case 4: ++ fprintf (stderr, "%s: We should not have threads for phase %d!\n", ++ argv[0], phase); ++ return 1; ++ default: ++ assert (0); ++ } ++#endif /* THREADS */ ++ ++ assert (cmd != NULL); ++ ++ phase++; ++ snprintf (phase_s, sizeof phase_s, "%d", phase); + +- execl ("/bin/true", "/bin/true", NULL); +- abort (); ++ execl (cmd, cmd, exec_nothreads, exec_threads, phase_s, NULL); ++ assert (0); + } +diff --git a/gdb/testsuite/gdb.threads/threaded-exec.exp b/gdb/testsuite/gdb.threads/threaded-exec.exp +--- a/gdb/testsuite/gdb.threads/threaded-exec.exp ++++ b/gdb/testsuite/gdb.threads/threaded-exec.exp +@@ -20,9 +20,14 @@ + + set testfile threaded-exec + set srcfile ${testfile}.c +-set binfile [standard_output_file ${testfile}] ++set binfile_nothreads [standard_output_file ${testfile}N] ++set binfile_threads [standard_output_file ${testfile}Y] + +-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable []] != "" } { ++if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile_nothreads}" executable {additional_flags=-UTHREADS}] != "" } { ++ return -1 ++} ++ ++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile_threads}" executable {additional_flags=-DTHREADS}] != "" } { + return -1 + } + +@@ -30,9 +35,9 @@ gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + +-gdb_load ${binfile} ++gdb_load ${binfile_nothreads} + +-gdb_run_cmd ++gdb_run_cmd [list ${binfile_nothreads} ${binfile_threads} 0] + + gdb_test_multiple {} "Program exited" { + -re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" { diff --git a/gdb-add-index.sh-fix-bashism.patch b/gdb-add-index.sh-fix-bashism.patch new file mode 100644 index 0000000..4b28ac4 --- /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-next-over-throw-cxx-exec.patch b/gdb-archer-next-over-throw-cxx-exec.patch new file mode 100644 index 0000000..ba71cd3 --- /dev/null +++ b/gdb-archer-next-over-throw-cxx-exec.patch @@ -0,0 +1,88 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-archer-next-over-throw-cxx-exec.patch + +;; Fix follow-exec for C++ programs (bugreported by Martin Stransky). +;;=fedoratest + +Archer-upstreamed: +http://sourceware.org/ml/archer/2010-q2/msg00031.html + +diff --git a/gdb/testsuite/gdb.cp/cxxexec.cc b/gdb/testsuite/gdb.cp/cxxexec.cc +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/cxxexec.cc +@@ -0,0 +1,25 @@ ++/* This test script is part of GDB, the GNU debugger. ++ ++ Copyright 2010 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#include ++ ++int ++main() ++{ ++ execlp ("true", "true", NULL); ++ return 1; ++} +diff --git a/gdb/testsuite/gdb.cp/cxxexec.exp b/gdb/testsuite/gdb.cp/cxxexec.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/cxxexec.exp +@@ -0,0 +1,42 @@ ++# Copyright 2010 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++if { [skip_cplus_tests] } { continue } ++ ++set testfile cxxexec ++if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.cc {c++ debug}] } { ++ return -1 ++} ++ ++runto_main ++ ++# We could stop after `continue' again at `main'. ++delete_breakpoints ++ ++set test "p _Unwind_DebugHook" ++gdb_test_multiple $test $test { ++ -re " = .* 0x\[0-9a-f\].*\r\n$gdb_prompt $" { ++ pass $test ++ } ++ -re "\r\nNo symbol .*\r\n$gdb_prompt $" { ++ xfail $test ++ untested ${testfile}.exp ++ return -1 ++ } ++} ++ ++# Run to end. The buggy GDB failed instead with: ++# Cannot access memory at address ADDR. ++gdb_continue_to_end "" "continue" 1 diff --git a/gdb-binutils29988-read_indexed_address.patch b/gdb-binutils29988-read_indexed_address.patch new file mode 100644 index 0000000..af44d12 --- /dev/null +++ b/gdb-binutils29988-read_indexed_address.patch @@ -0,0 +1,24 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Wed, 11 Jan 2023 12:13:46 +0000 +Subject: gdb-binutils29988-read_indexed_address.patch + +;; Backport "Fix a potential illegal memory access in the BFD library..." +;; (Nick Clifton, binutils/29988) + + PR 29988 + * dwarf2.c (read_indexed_address): Fix check for an out of range + offset. + +diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c +--- a/bfd/dwarf2.c ++++ b/bfd/dwarf2.c +@@ -1412,7 +1412,7 @@ read_indexed_address (uint64_t idx, struct comp_unit *unit) + offset += unit->dwarf_addr_offset; + if (offset < unit->dwarf_addr_offset + || offset > file->dwarf_addr_size +- || file->dwarf_addr_size - offset < unit->offset_size) ++ || file->dwarf_addr_size - offset < unit->addr_size) + return 0; + + info_ptr = file->dwarf_addr_buffer + offset; diff --git a/gdb-bz2237392-dwarf-obstack-allocation.patch b/gdb-bz2237392-dwarf-obstack-allocation.patch new file mode 100644 index 0000000..424cad3 --- /dev/null +++ b/gdb-bz2237392-dwarf-obstack-allocation.patch @@ -0,0 +1,68 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andrew Burgess +Date: Thu, 14 Sep 2023 13:06:26 +0100 +Subject: gdb-bz2237392-dwarf-obstack-allocation.patch + +;; Backport upstream commit 54392c4df604f20 to fix an incorrect +;; obstack allocation that wold lead to memory corruption. + +gdb: fix buffer overflow in DWARF reader + +In this commit: + + commit 48ac197b0c209ccf1f2de9704eb6cdf7c5c73a8e + Date: Fri Nov 19 10:12:44 2021 -0700 + + Handle multiple addresses in call_site_target + +a buffer overflow bug was introduced when the following code was +added: + + CORE_ADDR *saved = XOBNEWVAR (&objfile->objfile_obstack, CORE_ADDR, + addresses.size ()); + std::copy (addresses.begin (), addresses.end (), saved); + +The definition of XOBNEWVAR is (from libiberty.h): + + #define XOBNEWVAR(O, T, S) ((T *) obstack_alloc ((O), (S))) + +So 'saved' is going to point to addresses.size () bytes of memory, +however, the std::copy will write addresses.size () number of +CORE_ADDR sized entries to the address pointed to by 'saved', this is +going to result in memory corruption. + +The mistake is that we should have used XOBNEWVEC, which allocates a +vector of entries, the definition of XOBNEWVEC is: + + #define XOBNEWVEC(O, T, N) \ + ((T *) obstack_alloc ((O), sizeof (T) * (N))) + +Which means we will have set aside enough space to create a copy of +the contents of the addresses vector. + +I'm not sure how to create a test for this problem, this issue cropped +up when debugging a particular i686 built binary, which just happened +to trigger a glibc assertion (likely due to random memory corruption), +debugging the same binary built for x86-64 appeared to work just fine. + +Using valgrind on the failing GDB binary pointed straight to the cause +of the problem, and with this patch in place there are no longer +valgrind errors in this area. + +If anyone has ideas for a test I'm happy to work on something. + +Co-Authored-By: Keith Seitz +Approved-By: Tom Tromey + +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -12506,7 +12506,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu) + std::vector addresses; + dwarf2_ranges_read_low_addrs (ranges_offset, target_cu, + target_die->tag, addresses); +- CORE_ADDR *saved = XOBNEWVAR (&objfile->objfile_obstack, CORE_ADDR, ++ CORE_ADDR *saved = XOBNEWVEC (&objfile->objfile_obstack, CORE_ADDR, + addresses.size ()); + std::copy (addresses.begin (), addresses.end (), saved); + call_site->target.set_loc_array (addresses.size (), saved); diff --git a/gdb-bz2237515-debuginfod-double-free.patch b/gdb-bz2237515-debuginfod-double-free.patch new file mode 100644 index 0000000..9d72639 --- /dev/null +++ b/gdb-bz2237515-debuginfod-double-free.patch @@ -0,0 +1,102 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Tom Tromey +Date: Tue, 6 Dec 2022 12:07:12 -0700 +Subject: gdb-bz2237515-debuginfod-double-free.patch + +;; Backport upstream commit f96328accde1e63 to fix a potential double +;; free issue in the debuginfod code. + +Avoid double-free with debuginfod + +PR gdb/29257 points out a possible double free when debuginfod is in +use. Aside from some ugly warts in the symbol code (an ongoing +issue), the underlying issue in this particular case is that elfread.c +seems to assume that symfile_bfd_open will return NULL on error, +whereas in reality it throws an exception. As this code isn't +prepared for an exception, bad things result. + +This patch fixes the problem by introducing a non-throwing variant of +symfile_bfd_open and using it in the affected places. + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29257 + +diff --git a/gdb/elfread.c b/gdb/elfread.c +--- a/gdb/elfread.c ++++ b/gdb/elfread.c +@@ -1222,10 +1222,12 @@ elf_symfile_read_dwarf2 (struct objfile *objfile, + + if (!debugfile.empty ()) + { +- gdb_bfd_ref_ptr debug_bfd (symfile_bfd_open (debugfile.c_str ())); ++ gdb_bfd_ref_ptr debug_bfd ++ (symfile_bfd_open_no_error (debugfile.c_str ())); + +- symbol_file_add_separate (debug_bfd, debugfile.c_str (), +- symfile_flags, objfile); ++ if (debug_bfd != nullptr) ++ symbol_file_add_separate (debug_bfd, debugfile.c_str (), ++ symfile_flags, objfile); + } + else + { +@@ -1245,13 +1247,12 @@ elf_symfile_read_dwarf2 (struct objfile *objfile, + if (fd.get () >= 0) + { + /* File successfully retrieved from server. */ +- gdb_bfd_ref_ptr debug_bfd (symfile_bfd_open (symfile_path.get ())); ++ gdb_bfd_ref_ptr debug_bfd ++ (symfile_bfd_open_no_error (symfile_path.get ())); + +- if (debug_bfd == nullptr) +- warning (_("File \"%s\" from debuginfod cannot be opened as bfd"), +- filename); +- else if (build_id_verify (debug_bfd.get (), build_id->size, +- build_id->data)) ++ if (debug_bfd != nullptr ++ && build_id_verify (debug_bfd.get (), build_id->size, ++ build_id->data)) + { + symbol_file_add_separate (debug_bfd, symfile_path.get (), + symfile_flags, objfile); +diff --git a/gdb/symfile.c b/gdb/symfile.c +--- a/gdb/symfile.c ++++ b/gdb/symfile.c +@@ -1744,6 +1744,23 @@ symfile_bfd_open (const char *name) + return sym_bfd; + } + ++/* See symfile.h. */ ++ ++gdb_bfd_ref_ptr ++symfile_bfd_open_no_error (const char *name) noexcept ++{ ++ try ++ { ++ return symfile_bfd_open (name); ++ } ++ catch (const gdb_exception_error &err) ++ { ++ warning ("%s", err.what ()); ++ } ++ ++ return nullptr; ++} ++ + /* Return the section index for SECTION_NAME on OBJFILE. Return -1 if + the section was not found. */ + +diff --git a/gdb/symfile.h b/gdb/symfile.h +--- a/gdb/symfile.h ++++ b/gdb/symfile.h +@@ -269,6 +269,11 @@ extern void set_initial_language (void); + + extern gdb_bfd_ref_ptr symfile_bfd_open (const char *); + ++/* Like symfile_bfd_open, but will not throw an exception on error. ++ Instead, it issues a warning and returns nullptr. */ ++ ++extern gdb_bfd_ref_ptr symfile_bfd_open_no_error (const char *) noexcept; ++ + extern int get_section_index (struct objfile *, const char *); + + extern int print_symbol_loading_p (int from_tty, int mainline, int full); diff --git a/gdb-bz634108-solib_address.patch b/gdb-bz634108-solib_address.patch new file mode 100644 index 0000000..58b473f --- /dev/null +++ b/gdb-bz634108-solib_address.patch @@ -0,0 +1,41 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-bz634108-solib_address.patch + +;; Verify GDB Python built-in function gdb.solib_address exists (BZ # 634108). +;;=fedoratest + +Fix gdb.solib_address (fix by Phil Muldoon). + +s/solib_address/solib_name/ during upstreaming. + +diff --git a/gdb/testsuite/gdb.python/rh634108-solib_address.exp b/gdb/testsuite/gdb.python/rh634108-solib_address.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.python/rh634108-solib_address.exp +@@ -0,0 +1,24 @@ ++# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# https://bugzilla.redhat.com/show_bug.cgi?id=634108 ++ ++gdb_exit ++gdb_start ++ ++# Skip all tests if Python scripting is not enabled. ++if { [skip_python_tests] } { continue } ++ ++gdb_test "python print (gdb.solib_name(-1))" "None" "gdb.solib_name exists" diff --git a/gdb-ccache-workaround.patch b/gdb-ccache-workaround.patch new file mode 100644 index 0000000..e6137f7 --- /dev/null +++ b/gdb-ccache-workaround.patch @@ -0,0 +1,26 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-ccache-workaround.patch + +;; Workaround ccache making lineno non-zero for command-line definitions. +;;=fedoratest: ccache is rarely used and it is even fixed now. + +diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp +--- a/gdb/testsuite/gdb.base/macscp.exp ++++ b/gdb/testsuite/gdb.base/macscp.exp +@@ -20,6 +20,14 @@ set objfile [standard_output_file ${testfile}.o] + + set options {debug macros additional_flags=-DFROM_COMMANDLINE=ARG} + ++# Workaround ccache making lineno non-zero for command-line definitions. ++if {[find_gcc] == "gcc" && [file executable "/usr/bin/gcc"]} { ++ set result [catch "exec which gcc" output] ++ if {$result == 0 && [string first "/ccache/" $output] > -1} { ++ lappend options "compiler=/usr/bin/gcc" ++ } ++} ++ + # Generate the intermediate object file. This is required by Darwin to + # have access to the .debug_macinfo section. + if {[gdb_compile "${srcdir}/${subdir}/macscp1.c" "${objfile}" \ diff --git a/gdb-cli-add-ignore-errors-command.patch b/gdb-cli-add-ignore-errors-command.patch new file mode 100644 index 0000000..1f24c3a --- /dev/null +++ b/gdb-cli-add-ignore-errors-command.patch @@ -0,0 +1,192 @@ +[gdb/cli] Add ignore-errors command + +While trying to reproduce a failing test-case from the testsuite on the +command line using a gdb command script, I ran into the problem that a command +failed which stopped script execution. + +I could work around this by splitting the script at each error, but I realized +it would be nice if I could tell gdb to ignore the error. + +A python workaround ignore-errors exists, mentioned here ( +https://sourceware.org/legacy-ml/gdb/2010-06/msg00100.html ), which is +already supplied by distros like Fedora and openSUSE. + +FTR, a more elaborate try-catch solution was posted here ( +https://sourceware.org/bugzilla/show_bug.cgi?id=8487 ). + +This patch adds native ignore-errors support (so no python needed). + +So with this script: +... +$ cat script.gdb +ignore-errors run +echo here +... +we have: +... +$ gdb -q -batch -x script.gdb +No executable file specified. +Use the "file" or "exec-file" command. +here$ +... + +Note that quit is not caught: +... +$ gdb -q +(gdb) ignore-errors quit +$ +... +which is the same behaviour as with the python implementation. + +Tested on x86_64-linux. + +gdb/ChangeLog: + +2021-05-18 Tom de Vries + + * cli/cli-cmds.c (ignore_errors_command_completer) + (ignore_errors_command): New function. + (_initialize_cli_cmds): Add "ignore-errors" cmd. + +gdb/doc/ChangeLog: + +2021-05-18 Tom de Vries + + * gdb.texinfo (Command Files): Document command ignore-errors. + +gdb/testsuite/ChangeLog: + +2021-05-18 Tom de Vries + + * gdb.base/ignore-errors.exp: New test. + * gdb.base/ignore-errors.gdb: New command file. + +--- + gdb/cli/cli-cmds.c | 35 ++++++++++++++++++++++++++++++++ + gdb/doc/gdb.texinfo | 8 +++++++- + gdb/testsuite/gdb.base/ignore-errors.exp | 24 ++++++++++++++++++++++ + gdb/testsuite/gdb.base/ignore-errors.gdb | 2 ++ + 4 files changed, 68 insertions(+), 1 deletion(-) + +diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c +index 31d398cb13b..4eff591b3df 100644 +--- a/gdb/cli/cli-cmds.c ++++ b/gdb/cli/cli-cmds.c +@@ -39,6 +39,7 @@ + #include "gdbsupport/filestuff.h" + #include "location.h" + #include "block.h" ++#include "event-top.h" + + #include "ui-out.h" + #include "interps.h" +@@ -2399,6 +2400,34 @@ gdb_maint_setting_str_internal_fn (struct gdbarch *gdbarch, + return str_value_from_setting (*show_cmd->var, gdbarch); + } + ++/* Completer for "ignore-errors". */ ++ ++static void ++ignore_errors_command_completer (cmd_list_element *ignore, ++ completion_tracker &tracker, ++ const char *text, const char * /*word*/) ++{ ++ complete_nested_command_line (tracker, text); ++} ++ ++/* Implementation of the ignore-errors command. */ ++ ++static void ++ignore_errors_command (const char *args, int from_tty) ++{ ++ try ++ { ++ execute_command (args, from_tty); ++ } ++ catch (const gdb_exception_error &ex) ++ { ++ exception_print (gdb_stderr, ex); ++ ++ /* See also execute_gdb_command. */ ++ async_enable_stdin (); ++ } ++} ++ + void _initialize_cli_cmds (); + void + _initialize_cli_cmds () +@@ -2786,4 +2815,10 @@ when GDB is started."), GDBINIT).release (); + c = add_cmd ("source", class_support, source_command, + source_help_text, &cmdlist); + set_cmd_completer (c, filename_completer); ++ ++ c = add_cmd ("ignore-errors", class_support, ignore_errors_command, ++ _("Execute a single command, ignoring all errors.\n" ++ "Only one-line commands are supported.\n" ++ "This is primarily useful in scripts."), &cmdlist); ++ set_cmd_completer (c, ignore_errors_command_completer); + } +diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo +index 1cf3550885e..68e11585942 100644 +--- a/gdb/doc/gdb.texinfo ++++ b/gdb/doc/gdb.texinfo +@@ -27680,7 +27680,8 @@ The lines in a command file are generally executed sequentially, + unless the order of execution is changed by one of the + @emph{flow-control commands} described below. The commands are not + printed as they are executed. An error in any command terminates +-execution of the command file and control is returned to the console. ++execution of the command file and control is returned to the console, ++unless the line is prefixed with the @code{ignore-errors} command. + + @value{GDBN} first searches for @var{filename} in the current directory. + If the file is not found there, and @var{filename} does not specify a +@@ -27775,6 +27776,11 @@ the controlling expression. + @item end + Terminate the block of commands that are the body of @code{if}, + @code{else}, or @code{while} flow-control commands. ++ ++@kindex ignore-errors ++@item ignore-errors ++This command executes the command specified by its arguments, but ++doesn't stop execution of the script if the command fails. + @end table + + +diff --git a/gdb/testsuite/gdb.base/ignore-errors.exp b/gdb/testsuite/gdb.base/ignore-errors.exp +new file mode 100644 +index 00000000000..30dac7a94e2 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/ignore-errors.exp +@@ -0,0 +1,24 @@ ++# 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 . */ ++ ++# Check command ignore-errors. ++ ++clean_restart ++ ++gdb_test "source ignore-errors.gdb" \ ++ [multi_line \ ++ "No executable file specified\\." \ ++ "Use the \"file\" or \"exec-file\" command\\." \ ++ "here"] +diff --git a/gdb/testsuite/gdb.base/ignore-errors.gdb b/gdb/testsuite/gdb.base/ignore-errors.gdb +new file mode 100644 +index 00000000000..5962ff49b11 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/ignore-errors.gdb +@@ -0,0 +1,2 @@ ++ignore-errors run ++echo here\n diff --git a/gdb-cli-handle-pending-c-after-rl_callback_read_char.patch b/gdb-cli-handle-pending-c-after-rl_callback_read_char.patch new file mode 100644 index 0000000..7246847 --- /dev/null +++ b/gdb-cli-handle-pending-c-after-rl_callback_read_char.patch @@ -0,0 +1,69 @@ +From 3f5ef7bf512c7565279832bad3d5c743e9d8ae4b Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Wed, 24 May 2023 10:53:02 +0200 +Subject: [PATCH 1/4] [gdb/cli] Handle pending ^C after rl_callback_read_char + for readline 7 + +In commit faf01aee1d0 ("[gdb] Handle pending ^C after rl_callback_read_char") +we handled a problem (described in detail in that commit) for readline >= 8 +using public readline functions rl_pending_signal and rl_check_signals. + +For readline 7 (note that we require at least readline 7 so there's no need to +worry about readline 6), there was no fix though, because rl_check_signals was +not available. + +Fix this by instead using the private readline function _rl_signal_handler. + +There is precedent for using private readline variables and functions, but +it's something we want to get rid of (PR build/10723). Nevertheless, I think +we can allow this specific instance because it's not used when building +against readline >= 8. + +[ In the meanwhile, a fix was committed in the devel branch of the readline +repo, contained in commit 8d0c439 ("rollup of changes since readline-8.2"), +first proposed here ( +https://lists.gnu.org/archive/html/bug-readline/2022-10/msg00008.html ). ] + +Tested on x86_64-linux, against system readline 7.0 on openSUSE Leap 15.4. + +PR cli/27813 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27813 +--- + gdb/event-top.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/gdb/event-top.c b/gdb/event-top.c +index 9181e4bdcff..399582698c1 100644 +--- a/gdb/event-top.c ++++ b/gdb/event-top.c +@@ -134,6 +134,9 @@ static struct async_signal_handler *async_sigterm_token; + character is processed. */ + void (*after_char_processing_hook) (void); + ++#if RL_VERSION_MAJOR == 7 ++EXTERN_C void _rl_signal_handler (int); ++#endif + + /* Wrapper function for calling into the readline library. This takes + care of a couple things: +@@ -200,8 +203,14 @@ gdb_rl_callback_read_char_wrapper_noexcept () noexcept + pending signal. I'm not sure if that's possible, but it seems + better to handle the scenario than to assert. */ + rl_check_signals (); ++#elif RL_VERSION_MAJOR == 7 ++ /* Unfortunately, rl_check_signals is not available. Use private ++ function _rl_signal_handler instead. */ ++ ++ while (rl_pending_signal () != 0) ++ _rl_signal_handler (rl_pending_signal ()); + #else +- /* Unfortunately, rl_check_signals is not available. */ ++#error "Readline major version >= 7 expected" + #endif + if (after_char_processing_hook) + (*after_char_processing_hook) (); + +base-commit: 7f7fcd7031430953f41b284069d1ed0cf3c8734a +-- +2.35.3 + diff --git a/gdb-core-open-vdso-warning.patch b/gdb-core-open-vdso-warning.patch new file mode 100644 index 0000000..c64b4bc --- /dev/null +++ b/gdb-core-open-vdso-warning.patch @@ -0,0 +1,58 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-core-open-vdso-warning.patch + +;; Fix GNU/Linux core open: Can't read pathname for load map: Input/output error. +;; Fix regression of undisplayed missing shared libraries caused by a fix for. +;;=fedoratest: It should be in glibc: libc-alpha: <20091004161706.GA27450@.*> + +http://sourceware.org/ml/gdb-patches/2009-10/msg00142.html +Subject: [patch] Fix GNU/Linux core open: Can't read pathname for load map: Input/output error. + +[ New patch variant. ] + +commit 7d760051ffb8a23cdc51342d4e6243fbc462f73f +Author: Ulrich Weigand +Date: Wed Sep 25 11:52:50 2013 +0000 + +diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/solib-symbol.exp +--- a/gdb/testsuite/gdb.base/solib-symbol.exp ++++ b/gdb/testsuite/gdb.base/solib-symbol.exp +@@ -29,6 +29,7 @@ set testfile "solib-symbol-main" + set srcfile ${srcdir}/${subdir}/${testfile}.c + set binfile [standard_output_file ${testfile}] + set bin_flags [list debug shlib=${binfile_lib}] ++set executable ${testfile} + + if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != "" + || [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } { +@@ -66,8 +67,26 @@ gdb_test "br foo2" \ + "Breakpoint.*: foo2. .2 locations..*" \ + "foo2 in mdlib" + +-gdb_exit ++# Test GDB warns for shared libraris which have not been found. + +-return 0 ++gdb_test "info sharedlibrary" "/${libname}.*" + ++clean_restart ${executable} ++gdb_breakpoint "main" ++gdb_run_cmd ++set test "no warning for missing libraries" ++gdb_test_multiple "" $test { ++ -re "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\n$gdb_prompt $" { ++ fail $test ++ } ++ -re "Breakpoint \[0-9\]+, main .*\r\n$gdb_prompt $" { ++ pass $test ++ } ++} + ++clean_restart ${executable} ++gdb_test_no_output "set solib-absolute-prefix /doESnotEXIST" ++gdb_breakpoint "main" ++gdb_run_cmd ++gdb_test "" "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\nBreakpoint \[0-9\]+, main .*" \ ++ "warning for missing libraries" diff --git a/gdb-fedora-libncursesw.patch b/gdb-fedora-libncursesw.patch new file mode 100644 index 0000000..621d905 --- /dev/null +++ b/gdb-fedora-libncursesw.patch @@ -0,0 +1,71 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-fedora-libncursesw.patch + +;; Force libncursesw over libncurses to match the includes (RH BZ 1270534). +;;=push+jan + +Fedora: Force libncursesw over libncurses to match the includes. +https://bugzilla.redhat.com/show_bug.cgi?id=1270534 + +diff --git a/gdb/configure b/gdb/configure +--- a/gdb/configure ++++ b/gdb/configure +@@ -20915,6 +20915,7 @@ if test x"$prefer_curses" = xyes; then + # search /usr/local/include, if ncurses is installed in /usr/local. A + # default installation of ncurses on alpha*-dec-osf* will lead to such + # a situation. ++ # Fedora: Force libncursesw over libncurses to match the includes. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing waddstr" >&5 + $as_echo_n "checking for library containing waddstr... " >&6; } + if ${ac_cv_search_waddstr+:} false; then : +@@ -20939,7 +20940,7 @@ return waddstr (); + return 0; + } + _ACEOF +-for ac_lib in '' ncursesw ncurses cursesX curses; do ++for ac_lib in '' ncursesw; do + if test -z "$ac_lib"; then + ac_res="none required" + else +@@ -21013,6 +21014,7 @@ case $host_os in + esac + + # These are the libraries checked by Readline. ++# Fedora: Force libncursesw over libncurses to match the includes. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5 + $as_echo_n "checking for library containing tgetent... " >&6; } + if ${ac_cv_search_tgetent+:} false; then : +@@ -21037,7 +21039,7 @@ return tgetent (); + return 0; + } + _ACEOF +-for ac_lib in '' termcap tinfow tinfo curses ncursesw ncurses; do ++for ac_lib in '' ncursesw; do + if test -z "$ac_lib"; then + ac_res="none required" + else +diff --git a/gdb/configure.ac b/gdb/configure.ac +--- a/gdb/configure.ac ++++ b/gdb/configure.ac +@@ -704,7 +704,8 @@ if test x"$prefer_curses" = xyes; then + # search /usr/local/include, if ncurses is installed in /usr/local. A + # default installation of ncurses on alpha*-dec-osf* will lead to such + # a situation. +- AC_SEARCH_LIBS(waddstr, [ncursesw ncurses cursesX curses]) ++ # Fedora: Force libncursesw over libncurses to match the includes. ++ AC_SEARCH_LIBS(waddstr, [ncursesw]) + + if test "$ac_cv_search_waddstr" != no; then + curses_found=yes +@@ -746,7 +747,8 @@ case $host_os in + esac + + # These are the libraries checked by Readline. +-AC_SEARCH_LIBS(tgetent, [termcap tinfow tinfo curses ncursesw ncurses]) ++# Fedora: Force libncursesw over libncurses to match the includes. ++AC_SEARCH_LIBS(tgetent, [ncursesw]) + + if test "$ac_cv_search_tgetent" = no; then + CONFIG_OBS="$CONFIG_OBS stub-termcap.o" diff --git a/gdb-fix-segfault-in-for_each_block-part-1.patch b/gdb-fix-segfault-in-for_each_block-part-1.patch new file mode 100644 index 0000000..2fccf96 --- /dev/null +++ b/gdb-fix-segfault-in-for_each_block-part-1.patch @@ -0,0 +1,645 @@ +From 75617e6d28b93814ac46ad85ad4fc2b133f61114 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Fri, 3 Nov 2023 16:25:33 +0100 +Subject: [PATCH] [gdb] Fix segfault in for_each_block, part 1 + +When running test-case gdb.base/vfork-follow-parent.exp on powerpc64 (likewise +on s390x), I run into: +... +(gdb) PASS: gdb.base/vfork-follow-parent.exp: \ + exec_file=vfork-follow-parent-exit: target-non-stop=on: non-stop=off: \ + resolution_method=schedule-multiple: print unblock_parent = 1 +continue^M +Continuing.^M +Reading symbols from vfork-follow-parent-exit...^M +^M +^M +Fatal signal: Segmentation fault^M +----- Backtrace -----^M +0x1027d3e7 gdb_internal_backtrace_1^M + src/gdb/bt-utils.c:122^M +0x1027d54f _Z22gdb_internal_backtracev^M + src/gdb/bt-utils.c:168^M +0x1057643f handle_fatal_signal^M + src/gdb/event-top.c:889^M +0x10576677 handle_sigsegv^M + src/gdb/event-top.c:962^M +0x3fffa7610477 ???^M +0x103f2144 for_each_block^M + src/gdb/dcache.c:199^M +0x103f235b _Z17dcache_invalidateP13dcache_struct^M + src/gdb/dcache.c:251^M +0x10bde8c7 _Z24target_dcache_invalidatev^M + src/gdb/target-dcache.c:50^M +... +or similar. + +The root cause for the segmentation fault is that linux_is_uclinux gives an +incorrect result: it should always return false, given that we're running on a +regular linux system, but instead it returns first true, then false. + +In more detail, the segmentation fault happens as follows: +- a program space with an address space is created +- a second program space is about to be created. maybe_new_address_space + is called, and because linux_is_uclinux returns true, maybe_new_address_space + returns false, and no new address space is created +- a second program space with the same address space is created +- a program space is deleted. Because linux_is_uclinux now returns false, + gdbarch_has_shared_address_space (current_inferior ()->arch ()) returns + false, and the address space is deleted +- when gdb uses the address space of the remaining program space, we run into + the segfault, because the address space is deleted. + +Hardcoding linux_is_uclinux to false makes the test-case pass. + +We leave addressing the root cause for the following commit in this series. + +For now, prevent the segmentation fault by making the address space a refcounted +object. + +This was already suggested here [1]: +... +A better solution might be to have the address spaces be reference counted +... + +Tested on top of trunk on x86_64-linux and ppc64le-linux. +Tested on top of gdb-14-branch on ppc64-linux. + +Co-Authored-By: Simon Marchi + +PR gdb/30547 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30547 + +[1] https://sourceware.org/pipermail/gdb-patches/2023-October/202928.html +--- + gdb/breakpoint.c | 29 ++++++++------- + gdb/inferior.c | 8 ++--- + gdb/inferior.h | 2 +- + gdb/infrun.c | 20 +++++------ + gdb/linux-nat.c | 2 +- + gdb/process-stratum-target.c | 2 +- + gdb/progspace.c | 22 +++++------- + gdb/progspace.h | 64 +++++++++++++++++++++------------- + gdb/record-btrace.c | 2 +- + gdb/regcache.c | 2 +- + gdb/scoped-mock-context.h | 2 +- + gdb/target-dcache.c | 11 +++--- + gdbsupport/refcounted-object.h | 17 +++++++++ + 13 files changed, 103 insertions(+), 80 deletions(-) + +diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c +index f8d19356828..f4acb4ea8c4 100644 +--- a/gdb/breakpoint.c ++++ b/gdb/breakpoint.c +@@ -1605,7 +1605,7 @@ one_breakpoint_xfer_memory (gdb_byte *readbuf, gdb_byte *writebuf, + int bptoffset = 0; + + if (!breakpoint_address_match (target_info->placed_address_space, 0, +- current_program_space->aspace, 0)) ++ current_program_space->aspace.get (), 0)) + { + /* The breakpoint is inserted in a different address space. */ + return; +@@ -2278,7 +2278,7 @@ should_be_inserted (struct bp_location *bl) + a breakpoint. */ + if ((bl->loc_type == bp_loc_software_breakpoint + || bl->loc_type == bp_loc_hardware_breakpoint) +- && stepping_past_instruction_at (bl->pspace->aspace, ++ && stepping_past_instruction_at (bl->pspace->aspace.get (), + bl->address) + /* The single-step breakpoint may be inserted at the location + we're trying to step if the instruction branches to itself. +@@ -2713,7 +2713,7 @@ insert_bp_location (struct bp_location *bl, + read the breakpoint instead of returning the data saved in + the breakpoint location's shadow contents. */ + bl->target_info.reqstd_address = bl->address; +- bl->target_info.placed_address_space = bl->pspace->aspace; ++ bl->target_info.placed_address_space = bl->pspace->aspace.get (); + bl->target_info.length = bl->length; + + /* When working with target-side conditions, we must pass all the conditions +@@ -4276,7 +4276,7 @@ bp_location_inserted_here_p (const struct bp_location *bl, + const address_space *aspace, CORE_ADDR pc) + { + if (bl->inserted +- && breakpoint_address_match (bl->pspace->aspace, bl->address, ++ && breakpoint_address_match (bl->pspace->aspace.get (), bl->address, + aspace, pc)) + { + /* An unmapped overlay can't be a match. */ +@@ -4355,7 +4355,7 @@ hardware_watchpoint_inserted_in_range (const address_space *aspace, + continue; + + for (bp_location *loc : bpt->locations ()) +- if (loc->pspace->aspace == aspace && loc->inserted) ++ if (loc->pspace->aspace.get () == aspace && loc->inserted) + { + CORE_ADDR l, h; + +@@ -7153,10 +7153,10 @@ breakpoint_location_address_match (struct bp_location *bl, + const address_space *aspace, + CORE_ADDR addr) + { +- return (breakpoint_address_match (bl->pspace->aspace, bl->address, ++ return (breakpoint_address_match (bl->pspace->aspace.get (), bl->address, + aspace, addr) + || (bl->length +- && breakpoint_address_match_range (bl->pspace->aspace, ++ && breakpoint_address_match_range (bl->pspace->aspace.get (), + bl->address, bl->length, + aspace, addr))); + } +@@ -7173,7 +7173,7 @@ breakpoint_location_address_range_overlap (struct bp_location *bl, + CORE_ADDR addr, int len) + { + if (gdbarch_has_global_breakpoints (target_gdbarch ()) +- || bl->pspace->aspace == aspace) ++ || bl->pspace->aspace.get () == aspace) + { + int bl_len = bl->length != 0 ? bl->length : 1; + +@@ -7230,8 +7230,10 @@ breakpoint_locations_match (const struct bp_location *loc1, + /* We compare bp_location.length in order to cover ranged + breakpoints. Keep this in sync with + bp_location_is_less_than. */ +- return (breakpoint_address_match (loc1->pspace->aspace, loc1->address, +- loc2->pspace->aspace, loc2->address) ++ return (breakpoint_address_match (loc1->pspace->aspace.get (), ++ loc1->address, ++ loc2->pspace->aspace.get (), ++ loc2->address) + && (loc1->loc_type == loc2->loc_type || sw_hw_bps_match) + && loc1->length == loc2->length); + } +@@ -9297,8 +9299,9 @@ ranged_breakpoint::breakpoint_hit (const struct bp_location *bl, + || ws.sig () != GDB_SIGNAL_TRAP) + return 0; + +- return breakpoint_address_match_range (bl->pspace->aspace, bl->address, +- bl->length, aspace, bp_addr); ++ return breakpoint_address_match_range (bl->pspace->aspace.get (), ++ bl->address, bl->length, aspace, ++ bp_addr); + } + + /* Implement the "resources_needed" method for ranged breakpoints. */ +@@ -11696,7 +11699,7 @@ code_breakpoint::breakpoint_hit (const struct bp_location *bl, + || ws.sig () != GDB_SIGNAL_TRAP) + return 0; + +- if (!breakpoint_address_match (bl->pspace->aspace, bl->address, ++ if (!breakpoint_address_match (bl->pspace->aspace.get (), bl->address, + aspace, bp_addr)) + return 0; + +diff --git a/gdb/inferior.c b/gdb/inferior.c +index b0ecca8b63a..87c61eeafd7 100644 +--- a/gdb/inferior.c ++++ b/gdb/inferior.c +@@ -775,15 +775,13 @@ remove_inferior_command (const char *args, int from_tty) + struct inferior * + add_inferior_with_spaces (void) + { +- struct address_space *aspace; + struct program_space *pspace; + struct inferior *inf; + + /* If all inferiors share an address space on this system, this + doesn't really return a new address space; otherwise, it + really does. */ +- aspace = maybe_new_address_space (); +- pspace = new program_space (aspace); ++ pspace = new program_space (maybe_new_address_space ()); + inf = add_inferior (0); + inf->pspace = pspace; + inf->aspace = pspace->aspace; +@@ -946,15 +944,13 @@ clone_inferior_command (const char *args, int from_tty) + + for (i = 0; i < copies; ++i) + { +- struct address_space *aspace; + struct program_space *pspace; + struct inferior *inf; + + /* If all inferiors share an address space on this system, this + doesn't really return a new address space; otherwise, it + really does. */ +- aspace = maybe_new_address_space (); +- pspace = new program_space (aspace); ++ pspace = new program_space (maybe_new_address_space ()); + inf = add_inferior (0); + inf->pspace = pspace; + inf->aspace = pspace->aspace; +diff --git a/gdb/inferior.h b/gdb/inferior.h +index 4d001b0ad50..fa5c3c92eeb 100644 +--- a/gdb/inferior.h ++++ b/gdb/inferior.h +@@ -541,7 +541,7 @@ class inferior : public refcounted_object, + bool removable = false; + + /* The address space bound to this inferior. */ +- struct address_space *aspace = NULL; ++ address_space_ref_ptr aspace; + + /* The program space bound to this inferior. */ + struct program_space *pspace = NULL; +diff --git a/gdb/infrun.c b/gdb/infrun.c +index c078098a6f8..4073150d80c 100644 +--- a/gdb/infrun.c ++++ b/gdb/infrun.c +@@ -501,8 +501,8 @@ holding the child stopped. Try \"set detach-on-fork\" or \ + } + else + { +- child_inf->aspace = new address_space (); +- child_inf->pspace = new program_space (child_inf->aspace); ++ child_inf->pspace = new program_space (new_address_space ()); ++ child_inf->aspace = child_inf->pspace->aspace; + child_inf->removable = true; + clone_program_space (child_inf->pspace, parent_inf->pspace); + } +@@ -573,8 +573,8 @@ holding the child stopped. Try \"set detach-on-fork\" or \ + + child_inf->aspace = parent_inf->aspace; + child_inf->pspace = parent_inf->pspace; +- parent_inf->aspace = new address_space (); +- parent_inf->pspace = new program_space (parent_inf->aspace); ++ parent_inf->pspace = new program_space (new_address_space ()); ++ parent_inf->aspace = parent_inf->pspace->aspace; + clone_program_space (parent_inf->pspace, child_inf->pspace); + + /* The parent inferior is still the current one, so keep things +@@ -583,8 +583,8 @@ holding the child stopped. Try \"set detach-on-fork\" or \ + } + else + { +- child_inf->aspace = new address_space (); +- child_inf->pspace = new program_space (child_inf->aspace); ++ child_inf->pspace = new program_space (new_address_space ()); ++ child_inf->aspace = child_inf->pspace->aspace; + child_inf->removable = true; + child_inf->symfile_flags = SYMFILE_NO_READ; + clone_program_space (child_inf->pspace, parent_inf->pspace); +@@ -938,7 +938,6 @@ handle_vfork_child_exec_or_exit (int exec) + if (vfork_parent->pending_detach) + { + struct program_space *pspace; +- struct address_space *aspace; + + /* follow-fork child, detach-on-fork on. */ + +@@ -963,9 +962,8 @@ handle_vfork_child_exec_or_exit (int exec) + of" a hack. */ + + pspace = inf->pspace; +- aspace = inf->aspace; +- inf->aspace = nullptr; + inf->pspace = nullptr; ++ address_space_ref_ptr aspace = std::move (inf->aspace); + + if (print_inferior_events) + { +@@ -1019,7 +1017,7 @@ handle_vfork_child_exec_or_exit (int exec) + /* Temporarily switch to the vfork parent, to facilitate ptrace + calls done during maybe_new_address_space. */ + switch_to_thread (any_live_thread_of_inferior (vfork_parent)); +- address_space *aspace = maybe_new_address_space (); ++ address_space_ref_ptr aspace = maybe_new_address_space (); + + /* Switch back to the vfork child inferior. Switch to no-thread + while running clone_program_space, so that clone_program_space +@@ -5639,7 +5637,7 @@ handle_inferior_event (struct execution_control_state *ecs) + = get_thread_arch_aspace_regcache (parent_inf->process_target (), + ecs->ws.child_ptid (), + gdbarch, +- parent_inf->aspace); ++ parent_inf->aspace.get ()); + /* Read PC value of parent process. */ + parent_pc = regcache_read_pc (regcache); + +diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c +index 2b206a4ec1e..474d3c7f945 100644 +--- a/gdb/linux-nat.c ++++ b/gdb/linux-nat.c +@@ -4316,7 +4316,7 @@ linux_nat_target::thread_address_space (ptid_t ptid) + + inf = find_inferior_pid (this, pid); + gdb_assert (inf != NULL); +- return inf->aspace; ++ return inf->aspace.get (); + } + + /* Return the cached value of the processor core for thread PTID. */ +diff --git a/gdb/process-stratum-target.c b/gdb/process-stratum-target.c +index 4722c5a0f28..e67012a8591 100644 +--- a/gdb/process-stratum-target.c ++++ b/gdb/process-stratum-target.c +@@ -37,7 +37,7 @@ process_stratum_target::thread_address_space (ptid_t ptid) + "address space of thread %s\n"), + target_pid_to_str (ptid).c_str ()); + +- return inf->aspace; ++ return inf->aspace.get (); + } + + struct gdbarch * +diff --git a/gdb/progspace.c b/gdb/progspace.c +index 32bdfebcf7c..55df3b65dfe 100644 +--- a/gdb/progspace.c ++++ b/gdb/progspace.c +@@ -54,8 +54,8 @@ address_space::address_space () + return a pointer to an existing address space, in case inferiors + share an address space on this target system. */ + +-struct address_space * +-maybe_new_address_space (void) ++address_space_ref_ptr ++maybe_new_address_space () + { + int shared_aspace = gdbarch_has_shared_address_space (target_gdbarch ()); + +@@ -65,7 +65,7 @@ maybe_new_address_space (void) + return program_spaces[0]->aspace; + } + +- return new address_space (); ++ return new_address_space (); + } + + /* Start counting over from scratch. */ +@@ -93,9 +93,9 @@ remove_program_space (program_space *pspace) + + /* See progspace.h. */ + +-program_space::program_space (address_space *aspace_) ++program_space::program_space (address_space_ref_ptr aspace_) + : num (++last_program_space_num), +- aspace (aspace_) ++ aspace (std::move (aspace_)) + { + program_spaces.push_back (this); + } +@@ -118,8 +118,6 @@ program_space::~program_space () + /* Defer breakpoint re-set because we don't want to create new + locations for this pspace which we're tearing down. */ + clear_symtab_users (SYMFILE_DEFER_BP_RESET); +- if (!gdbarch_has_shared_address_space (target_gdbarch ())) +- delete this->aspace; + } + + /* See progspace.h. */ +@@ -389,18 +387,14 @@ update_address_spaces (void) + + if (shared_aspace) + { +- struct address_space *aspace = new address_space (); ++ address_space_ref_ptr aspace = new_address_space (); + +- delete current_program_space->aspace; + for (struct program_space *pspace : program_spaces) + pspace->aspace = aspace; + } + else + for (struct program_space *pspace : program_spaces) +- { +- delete pspace->aspace; +- pspace->aspace = new address_space (); +- } ++ pspace->aspace = new_address_space (); + + for (inferior *inf : all_inferiors ()) + if (gdbarch_has_global_solist (target_gdbarch ())) +@@ -437,5 +431,5 @@ initialize_progspace (void) + modules have done that. Do this before + initialize_current_architecture, because that accesses the ebfd + of current_program_space. */ +- current_program_space = new program_space (new address_space ()); ++ current_program_space = new program_space (new_address_space ()); + } +diff --git a/gdb/progspace.h b/gdb/progspace.h +index 85215f0e2f1..07cca8c675c 100644 +--- a/gdb/progspace.h ++++ b/gdb/progspace.h +@@ -28,6 +28,8 @@ + #include "solist.h" + #include "gdbsupport/next-iterator.h" + #include "gdbsupport/safe-iterator.h" ++#include "gdbsupport/refcounted-object.h" ++#include "gdbsupport/gdb_ref_ptr.h" + #include + #include + +@@ -42,6 +44,40 @@ struct so_list; + + typedef std::list> objfile_list; + ++/* An address space. It is used for comparing if ++ pspaces/inferior/threads see the same address space and for ++ associating caches to each address space. */ ++struct address_space : public refcounted_object ++{ ++ /* Create a new address space object, and add it to the list. */ ++ address_space (); ++ DISABLE_COPY_AND_ASSIGN (address_space); ++ ++ /* Returns the integer address space id of this address space. */ ++ int num () const ++ { ++ return m_num; ++ } ++ ++ /* Per aspace data-pointers required by other GDB modules. */ ++ registry registry_fields; ++ ++private: ++ int m_num; ++}; ++ ++using address_space_ref_ptr ++ = gdb::ref_ptr>; ++ ++/* Create a new address space. */ ++ ++static inline address_space_ref_ptr ++new_address_space () ++{ ++ return address_space_ref_ptr::new_reference (new address_space); ++} ++ + /* An iterator that wraps an iterator over std::unique_ptr, + and dereferences the returned object. This is useful for iterating + over a list of shared pointers and returning raw pointers -- which +@@ -191,7 +227,7 @@ struct program_space + { + /* Constructs a new empty program space, binds it to ASPACE, and + adds it to the program space list. */ +- explicit program_space (address_space *aspace); ++ explicit program_space (address_space_ref_ptr aspace); + + /* Releases a program space, and all its contents (shared libraries, + objfiles, and any other references to the program space in other +@@ -332,7 +368,7 @@ struct program_space + are global, then this field is ignored (we don't currently + support inferiors sharing a program space if the target doesn't + make breakpoints global). */ +- struct address_space *aspace = NULL; ++ address_space_ref_ptr aspace; + + /* True if this program space's section offsets don't yet represent + the final offsets of the "live" address space (that is, the +@@ -379,28 +415,6 @@ struct program_space + target_section_table m_target_sections; + }; + +-/* An address space. It is used for comparing if +- pspaces/inferior/threads see the same address space and for +- associating caches to each address space. */ +-struct address_space +-{ +- /* Create a new address space object, and add it to the list. */ +- address_space (); +- DISABLE_COPY_AND_ASSIGN (address_space); +- +- /* Returns the integer address space id of this address space. */ +- int num () const +- { +- return m_num; +- } +- +- /* Per aspace data-pointers required by other GDB modules. */ +- registry registry_fields; +- +-private: +- int m_num; +-}; +- + /* The list of all program spaces. There's always at least one. */ + extern std::vectorprogram_spaces; + +@@ -443,7 +457,7 @@ class scoped_restore_current_program_space + /* Maybe create a new address space object, and add it to the list, or + return a pointer to an existing address space, in case inferiors + share an address space. */ +-extern struct address_space *maybe_new_address_space (void); ++extern address_space_ref_ptr maybe_new_address_space (); + + /* Update all program spaces matching to address spaces. The user may + have created several program spaces, and loaded executables into +diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c +index 0daba893813..276cdcc03b8 100644 +--- a/gdb/record-btrace.c ++++ b/gdb/record-btrace.c +@@ -2314,7 +2314,7 @@ record_btrace_replay_at_breakpoint (struct thread_info *tp) + if (insn == NULL) + return 0; + +- return record_check_stopped_by_breakpoint (tp->inf->aspace, insn->pc, ++ return record_check_stopped_by_breakpoint (tp->inf->aspace.get (), insn->pc, + &btinfo->stop_reason); + } + +diff --git a/gdb/regcache.c b/gdb/regcache.c +index 56b6d047874..8a0b57e67b8 100644 +--- a/gdb/regcache.c ++++ b/gdb/regcache.c +@@ -1617,7 +1617,7 @@ get_thread_arch_aspace_regcache_and_check (process_stratum_target *target, + the current inferior's gdbarch. Also use the current inferior's address + space. */ + gdbarch *arch = current_inferior ()->gdbarch; +- address_space *aspace = current_inferior ()->aspace; ++ address_space *aspace = current_inferior ()->aspace.get (); + regcache *regcache + = get_thread_arch_aspace_regcache (target, ptid, arch, aspace); + +diff --git a/gdb/scoped-mock-context.h b/gdb/scoped-mock-context.h +index 9ad7ebf5f0c..5f25dc7ed6b 100644 +--- a/gdb/scoped-mock-context.h ++++ b/gdb/scoped-mock-context.h +@@ -38,7 +38,7 @@ struct scoped_mock_context + + Target mock_target; + ptid_t mock_ptid {1, 1}; +- program_space mock_pspace {new address_space ()}; ++ program_space mock_pspace {new_address_space ()}; + inferior mock_inferior {mock_ptid.pid ()}; + thread_info mock_thread {&mock_inferior, mock_ptid}; + +diff --git a/gdb/target-dcache.c b/gdb/target-dcache.c +index 13c2888e7ea..b1b772ab76e 100644 +--- a/gdb/target-dcache.c ++++ b/gdb/target-dcache.c +@@ -33,7 +33,7 @@ int + target_dcache_init_p (void) + { + DCACHE *dcache +- = target_dcache_aspace_key.get (current_program_space->aspace); ++ = target_dcache_aspace_key.get (current_program_space->aspace.get ()); + + return (dcache != NULL); + } +@@ -44,7 +44,7 @@ void + target_dcache_invalidate (void) + { + DCACHE *dcache +- = target_dcache_aspace_key.get (current_program_space->aspace); ++ = target_dcache_aspace_key.get (current_program_space->aspace.get ()); + + if (dcache != NULL) + dcache_invalidate (dcache); +@@ -56,7 +56,7 @@ target_dcache_invalidate (void) + DCACHE * + target_dcache_get (void) + { +- return target_dcache_aspace_key.get (current_program_space->aspace); ++ return target_dcache_aspace_key.get (current_program_space->aspace.get ()); + } + + /* Return the target dcache. If it is not initialized yet, initialize +@@ -66,12 +66,13 @@ DCACHE * + target_dcache_get_or_init (void) + { + DCACHE *dcache +- = target_dcache_aspace_key.get (current_program_space->aspace); ++ = target_dcache_aspace_key.get (current_program_space->aspace.get ()); + + if (dcache == NULL) + { + dcache = dcache_init (); +- target_dcache_aspace_key.set (current_program_space->aspace, dcache); ++ target_dcache_aspace_key.set (current_program_space->aspace.get (), ++ dcache); + } + + return dcache; +diff --git a/gdbsupport/refcounted-object.h b/gdbsupport/refcounted-object.h +index d8fdb950043..294fd873df1 100644 +--- a/gdbsupport/refcounted-object.h ++++ b/gdbsupport/refcounted-object.h +@@ -67,4 +67,21 @@ struct refcounted_object_ref_policy + } + }; + ++/* A policy class to interface gdb::ref_ptr with a refcounted_object, that ++ deletes the object once the refcount reaches 0.. */ ++ ++template ++struct refcounted_object_delete_ref_policy ++{ ++ static void incref (T *obj) ++ { obj->incref (); } ++ ++ static void decref (T *obj) ++ { ++ obj->decref (); ++ if (obj->refcount () == 0) ++ delete obj; ++ } ++}; ++ + #endif /* COMMON_REFCOUNTED_OBJECT_H */ + +base-commit: c55a452eaf9390d5659d3205f762aa2cb84511e1 +-- +2.35.3 + diff --git a/gdb-fix-segfault-in-for_each_block-part-2.patch b/gdb-fix-segfault-in-for_each_block-part-2.patch new file mode 100644 index 0000000..4aefe4e --- /dev/null +++ b/gdb-fix-segfault-in-for_each_block-part-2.patch @@ -0,0 +1,168 @@ +From 1cd845ab3d405412aabf9b959aa527dd60143826 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Thu, 2 Nov 2023 14:51:02 +0100 +Subject: [PATCH] [gdb] Fix segfault in for_each_block, part 2 + +The previous commit describes PR gdb/30547, a segfault when running test-case +gdb.base/vfork-follow-parent.exp on powerpc64 (likewise on s390x). + +The root cause for the segmentation fault is that linux_is_uclinux gives an +incorrect result: it returns true instead of false. + +So, why does linux_is_uclinux: +... +int +linux_is_uclinux (void) +{ + CORE_ADDR dummy; + + return (target_auxv_search (AT_NULL, &dummy) > 0 + && target_auxv_search (AT_PAGESZ, &dummy) == 0); +... +return true? + +This is because ppc_linux_target_wordsize returns 4 instead of 8, causing +ppc_linux_nat_target::auxv_parse to misinterpret the auxv vector. + +So, why does ppc_linux_target_wordsize: +... +int +ppc_linux_target_wordsize (int tid) +{ + int wordsize = 4; + + /* Check for 64-bit inferior process. This is the case when the host is + 64-bit, and in addition the top bit of the MSR register is set. */ + long msr; + + errno = 0; + msr = (long) ptrace (PTRACE_PEEKUSER, tid, PT_MSR * 8, 0); + if (errno == 0 && ppc64_64bit_inferior_p (msr)) + wordsize = 8; + + return wordsize; +} +... +return 4? + +Specifically, we get this result because because tid == 0, so we get +errno == ESRCH. + +The tid == 0 is caused by the switch_to_no_thread in +handle_vfork_child_exec_or_exit: +... + /* Switch to no-thread while running clone_program_space, so + that clone_program_space doesn't want to read the + selected frame of a dead process. */ + scoped_restore_current_thread restore_thread; + switch_to_no_thread (); + + inf->pspace = new program_space (maybe_new_address_space ()); +... +but moving the maybe_new_address_space call to before that gives us the +same result. The tid is no longer 0, but we still get ESRCH because the +thread has exited. + +Fix this in handle_vfork_child_exec_or_exit by doing the +maybe_new_address_space call in the context of the vfork parent. + +Tested on top of trunk on x86_64-linux and ppc64le-linux. +Tested on top of gdb-14-branch on ppc64-linux. + +Co-Authored-By: Simon Marchi + +PR gdb/30547 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30547 +--- + gdb/infrun.c | 16 +++++++++++----- + gdb/nat/ppc-linux.c | 2 ++ + gdb/ppc-linux-nat.c | 2 ++ + gdb/s390-linux-nat.c | 5 ++++- + 4 files changed, 19 insertions(+), 6 deletions(-) + +diff --git a/gdb/infrun.c b/gdb/infrun.c +index 9c1b1f04e4d..c078098a6f8 100644 +--- a/gdb/infrun.c ++++ b/gdb/infrun.c +@@ -1014,13 +1014,19 @@ handle_vfork_child_exec_or_exit (int exec) + go ahead and create a new one for this exiting + inferior. */ + +- /* Switch to no-thread while running clone_program_space, so +- that clone_program_space doesn't want to read the +- selected frame of a dead process. */ + scoped_restore_current_thread restore_thread; +- switch_to_no_thread (); + +- inf->pspace = new program_space (maybe_new_address_space ()); ++ /* Temporarily switch to the vfork parent, to facilitate ptrace ++ calls done during maybe_new_address_space. */ ++ switch_to_thread (any_live_thread_of_inferior (vfork_parent)); ++ address_space *aspace = maybe_new_address_space (); ++ ++ /* Switch back to the vfork child inferior. Switch to no-thread ++ while running clone_program_space, so that clone_program_space ++ doesn't want to read the selected frame of a dead process. */ ++ switch_to_inferior_no_thread (inf); ++ ++ inf->pspace = new program_space (aspace); + inf->aspace = inf->pspace->aspace; + set_current_program_space (inf->pspace); + inf->removable = true; +diff --git a/gdb/nat/ppc-linux.c b/gdb/nat/ppc-linux.c +index 0957d1b58a7..74549754806 100644 +--- a/gdb/nat/ppc-linux.c ++++ b/gdb/nat/ppc-linux.c +@@ -78,6 +78,8 @@ ppc64_64bit_inferior_p (long msr) + int + ppc_linux_target_wordsize (int tid) + { ++ gdb_assert (tid != 0); ++ + int wordsize = 4; + + /* Check for 64-bit inferior process. This is the case when the host is +diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c +index d8a8fbdf706..500fb566bc1 100644 +--- a/gdb/ppc-linux-nat.c ++++ b/gdb/ppc-linux-nat.c +@@ -1918,6 +1918,8 @@ ppc_linux_nat_target::auxv_parse (const gdb_byte **readptr, + const gdb_byte *endptr, CORE_ADDR *typep, + CORE_ADDR *valp) + { ++ gdb_assert (inferior_ptid != null_ptid); ++ + int tid = inferior_ptid.lwp (); + if (tid == 0) + tid = inferior_ptid.pid (); +diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c +index fc3917d30be..403f37d690d 100644 +--- a/gdb/s390-linux-nat.c ++++ b/gdb/s390-linux-nat.c +@@ -949,10 +949,12 @@ s390_target_wordsize (void) + /* Check for 64-bit inferior process. This is the case when the host is + 64-bit, and in addition bit 32 of the PSW mask is set. */ + #ifdef __s390x__ ++ int tid = s390_inferior_tid (); ++ gdb_assert (tid != 0); + long pswm; + + errno = 0; +- pswm = (long) ptrace (PTRACE_PEEKUSER, s390_inferior_tid (), PT_PSWMASK, 0); ++ pswm = (long) ptrace (PTRACE_PEEKUSER, tid, PT_PSWMASK, 0); + if (errno == 0 && (pswm & 0x100000000ul) != 0) + wordsize = 8; + #endif +@@ -965,6 +967,7 @@ s390_linux_nat_target::auxv_parse (const gdb_byte **readptr, + const gdb_byte *endptr, CORE_ADDR *typep, + CORE_ADDR *valp) + { ++ gdb_assert (inferior_ptid != null_ptid); + int sizeof_auxv_field = s390_target_wordsize (); + enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); + const gdb_byte *ptr = *readptr; + +base-commit: 59053f06bd94be51efacfa80f9a1f738e3e1ee9c +-- +2.35.3 + diff --git a/gdb-gcore-bash.patch b/gdb-gcore-bash.patch new file mode 100644 index 0000000..5148cac --- /dev/null +++ b/gdb-gcore-bash.patch @@ -0,0 +1,10 @@ +diff --git a/gdb/gcore.in b/gdb/gcore.in +index b9770ea415..3149f6e1fe 100644 +--- a/gdb/gcore.in ++++ b/gdb/gcore.in +@@ -1,4 +1,4 @@ +-#!/usr/bin/env bash ++#!/bin/bash + + # Copyright (C) 2003-2023 Free Software Foundation, Inc. + diff --git a/gdb-glibc-strstr-workaround.patch b/gdb-glibc-strstr-workaround.patch new file mode 100644 index 0000000..da9c5de --- /dev/null +++ b/gdb-glibc-strstr-workaround.patch @@ -0,0 +1,132 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-glibc-strstr-workaround.patch + +;; Workaround PR libc/14166 for inferior calls of strstr. +;;=fedoratest: Compatibility with RHELs (unchecked which ones). + +diff --git a/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/gnu-ifunc-strstr-workaround.exp +@@ -0,0 +1,119 @@ ++# Copyright (C) 2012 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# Workaround for: ++# invalid IFUNC DW_AT_linkage_name: memmove strstr time ++# http://sourceware.org/bugzilla/show_bug.cgi?id=14166 ++ ++if {[skip_shlib_tests]} { ++ return 0 ++} ++ ++set testfile "gnu-ifunc-strstr-workaround" ++set executable ${testfile} ++set srcfile start.c ++set binfile [standard_output_file ${executable}] ++ ++if [prepare_for_testing ${testfile}.exp $executable $srcfile] { ++ return -1 ++} ++ ++if ![runto_main] { ++ return 0 ++} ++ ++set test "ptype atoi" ++gdb_test_multiple $test $test { ++ -re "type = int \\(const char \\*\\)\r\n$gdb_prompt $" { ++ pass $test ++ } ++ -re "type = int \\(\\)\r\n$gdb_prompt $" { ++ untested "$test (no DWARF)" ++ return 0 ++ } ++ -re "type = \\(\\)\r\n$gdb_prompt $" { ++ untested "$test (no DWARF)" ++ return 0 ++ } ++} ++ ++set addr "" ++set test "print strstr" ++gdb_test_multiple $test $test { ++ -re " = {} (0x\[0-9a-f\]+) \r\n$gdb_prompt $" { ++ set addr $expect_out(1,string) ++ pass $test ++ } ++ -re " = {} (0x\[0-9a-f\]+) <__strstr>\r\n$gdb_prompt $" { ++ set addr $expect_out(1,string) ++ pass "$test (GDB workaround)" ++ } ++ -re " = {} (0x\[0-9a-f\]+) <__libc_strstr>\r\n$gdb_prompt $" { ++ set addr $expect_out(1,string) ++ pass "$test (fixed glibc)" ++ } ++ -re " = {} (0x\[0-9a-f\]+) <__libc_strstr_ifunc>\r\n$gdb_prompt $" { ++ set addr $expect_out(1,string) ++ pass "$test (fixed glibc)" ++ } ++ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ \r\n$gdb_prompt $" { ++ untested "$test (gnu-ifunc not in use by glibc)" ++ return 0 ++ } ++} ++ ++set test "info sym" ++gdb_test_multiple "info sym $addr" $test { ++ -re "strstr in section \\.text of /lib\[^/\]*/libc.so.6\r\n$gdb_prompt $" { ++ pass $test ++ } ++ -re " = {char \\*\\(const char \\*, const char \\*\\)} 0x\[0-9a-f\]+ \r\n$gdb_prompt $" { ++ # unexpected ++ xfail "$test (not in libc.so.6)" ++ return 0 ++ } ++} ++ ++set test "info addr strstr" ++gdb_test_multiple $test $test { ++ -re "Symbol \"strstr\" is a function at address $addr\\.\r\n$gdb_prompt $" { ++ fail "$test (DWARF for strstr)" ++ } ++ -re "Symbol \"strstr\" is at $addr in a file compiled without debugging\\.\r\n$gdb_prompt $" { ++ pass "$test" ++ } ++} ++ ++set test "print strstr second time" ++gdb_test_multiple "print strstr" $test { ++ -re " = {} $addr \r\n$gdb_prompt $" { ++ pass $test ++ } ++ -re " = {} $addr <__strstr>\r\n$gdb_prompt $" { ++ pass "$test (GDB workaround)" ++ } ++ -re " = {} $addr <__libc_strstr>\r\n$gdb_prompt $" { ++ pass "$test (fixed glibc)" ++ } ++ -re " = {} $addr <__libc_strstr_ifunc>\r\n$gdb_prompt $" { ++ pass "$test (fixed glibc)" ++ } ++ -re " = {void \\*\\(void\\)} 0x\[0-9a-f\]+ \r\n$gdb_prompt $" { ++ fail $test ++ } ++} ++ ++gdb_test {print (char *)strstr("abc","b")} { = 0x[0-9a-f]+ "bc"} ++gdb_test {print (char *)strstr("def","e")} { = 0x[0-9a-f]+ "ef"} diff --git a/gdb-go-handle-v3-go_0-mangled-prefix.patch b/gdb-go-handle-v3-go_0-mangled-prefix.patch new file mode 100644 index 0000000..93e4e41 --- /dev/null +++ b/gdb-go-handle-v3-go_0-mangled-prefix.patch @@ -0,0 +1,138 @@ +From 6c9e159dbd1a35aafa134fcd52982174236a8dd9 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Thu, 5 Oct 2023 23:22:11 +0200 +Subject: [PATCH 3/3] [gdb/go] Handle v3 go_0 mangled prefix + +With gcc-10 we have: +... +(gdb) break package2.Foo^M +Breakpoint 2 at 0x402563: file package2.go, line 5.^M +(gdb) PASS: gdb.go/package.exp: setting breakpoint 1 +... +but with gcc-11: +... +gdb) break package2.Foo^M +Function "package2.Foo" not defined.^M +Make breakpoint pending on future shared library load? (y or [n]) n^M +(gdb) FAIL: gdb.go/package.exp: gdb_breakpoint: set breakpoint at package2.Foo +... + +In the gcc-10 case, though the exec contains dwarf, it's not used to set the +breakpoint (which is an independent problem, filed as PR go/30941), instead +the minimal symbol information is used. + +The minimal symbol information changed between gcc-10 and gcc-11: +... +$ nm a.out.10 | grep Foo +000000000040370d T go.package2.Foo +0000000000404e50 R go.package2.Foo..f +$ nm a.out.11 | grep Foo +0000000000403857 T go_0package2.Foo +0000000000405030 R go_0package2.Foo..f +... + +A new v3 mangling scheme was used. The mangling schemes define a separator +character and mangling character: +- for v2, dot is used both as separator character and mangling character, and +- for v3, dot is used as separator character and underscore as mangling + character. + +For more details, see [1] and [2]. + +In v3, "_0" demangles to ".". [ See gcc commit a01dda3c23b ("compiler, libgo: +change mangling scheme"), function Special_char_code::Special_char_code. ] + +Handle the new go_0 prefix in unpack_mangled_go_symbol, which fixes the +test-case. + +Note that this doesn't fix this regression: +... +$ gccgo-10 package2.go -c -g0 +$ gccgo-10 package1.go package2.o -g0 +$ gdb -q -batch a.out -ex "break go.package2.Foo" +Breakpoint 1 at 0x40370d +$ gccgo-11 package2.go -c -g0 +$ gccgo-11 package1.go package2.o -g0 +$ gdb -q -batch a.out -ex "break go.package2.Foo" +Function "go.package2.Foo" not defined. +... + +With gcc-10, we set a breakpoint on the mangled minimal symbol. That +one has simply changed for gcc-11, so it's equivalent to using: +... +$ gdb -q -batch a.out -ex "break go_0package2.Foo" +Breakpoint 1 at 0x403857 +... +which does work. + +Tested on x86_64-linux: +- openSUSE Leap 15.4, using gccgo-7, +- openSUSE Tumbleweed, using gccgo-13. + +PR go/27238 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=27238 + +[1] https://go-review.googlesource.com/c/gofrontend/+/271726 +[2] https://github.com/golang/go/issues/41862#issuecomment-707244103 +--- + gdb/go-lang.c | 30 +++++++++++++++++++++++++++--- + 1 file changed, 27 insertions(+), 3 deletions(-) + +diff --git a/gdb/go-lang.c b/gdb/go-lang.c +index f9176ace71d..8a5568f56e0 100644 +--- a/gdb/go-lang.c ++++ b/gdb/go-lang.c +@@ -233,16 +233,28 @@ unpack_mangled_go_symbol (const char *mangled_name, + libgo_.*: used by gccgo's runtime + + Thus we don't support -fgo-prefix (except as used by the runtime). */ +- if (!startswith (mangled_name, "go.") +- && !startswith (mangled_name, "libgo_")) ++ bool v3; ++ if (startswith (mangled_name, "go_0")) ++ /* V3 mangling detected, see ++ https://go-review.googlesource.com/c/gofrontend/+/271726 . */ ++ v3 = true; ++ else if (startswith (mangled_name, "go.") ++ || startswith (mangled_name, "libgo_")) ++ v3 = false; ++ else + return NULL; + + /* Quick check for whether a search may be fruitful. */ + /* Ignore anything with @plt, etc. in it. */ + if (strchr (mangled_name, '@') != NULL) + return NULL; ++ + /* It must have at least two dots. */ +- first_dot = strchr (mangled_name, '.'); ++ if (v3) ++ first_dot = strchr (mangled_name, '0'); ++ else ++ first_dot = strchr (mangled_name, '.'); ++ + if (first_dot == NULL) + return NULL; + /* Treat "foo.bar" as unmangled. It can collide with lots of other +@@ -263,6 +275,18 @@ unpack_mangled_go_symbol (const char *mangled_name, + gdb::unique_xmalloc_ptr result = make_unique_xstrdup (mangled_name); + buf = result.get (); + ++ if (v3) ++ { ++ /* Replace "go_0" with "\0go.". */ ++ buf[0] = '\0'; ++ buf[1] = 'g'; ++ buf[2] = 'o'; ++ buf[3] = '.'; ++ ++ /* Skip the '\0'. */ ++ buf++; ++ } ++ + /* Search backwards looking for "N". */ + p = buf + len; + saw_digit = method_type = NULL; +-- +2.35.3 + diff --git a/gdb-gstack.man b/gdb-gstack.man new file mode 100644 index 0000000..1f4e406 --- /dev/null +++ b/gdb-gstack.man @@ -0,0 +1,48 @@ +.\" +.\" gstack manual page. +.\" Copyright (c) 1999 Ross Thompson +.\" Copyright (c) 2001, 2002, 2004, 2008 Red Hat, Inc. +.\" +.\" Original author: Ross Thompson +.\" +.\" This program is free software; you can redistribute it and/or modify +.\" it under the terms of the GNU General Public License as published by +.\" the Free Software Foundation; either version 2, or (at your option) +.\" any later version. +.\" +.\" This program is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.\" GNU General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public License +.\" along with this program; see the file COPYING. If not, write to +.\" the Free Software Foundation, 59 Temple Place - Suite 330, +.\" Boston, MA 02111-1307, USA. +.\" +.TH GSTACK 1 "Feb 15 2008" "Red Hat Linux" "Linux Programmer's Manual" + +.SH NAME +gstack \- print a stack trace of a running process + +.SH SYNOPSIS +.B gstack +pid + +.SH DESCRIPTION + +\f3gstack\f1 attaches to the active process named by the \f3pid\f1 on +the command line, and prints out an execution stack trace. If ELF +symbols exist in the binary (usually the case unless you have run +strip(1)), then symbolic addresses are printed as well. + +If the process is part of a thread group, then \f3gstack\f1 will print +out a stack trace for each of the threads in the group. + +.SH SEE ALSO +nm(1), ptrace(2), gdb(1) + +.SH AUTHORS +Ross Thompson + +Red Hat, Inc. diff --git a/gdb-lineno-makeup-test.patch b/gdb-lineno-makeup-test.patch new file mode 100644 index 0000000..4b96286 --- /dev/null +++ b/gdb-lineno-makeup-test.patch @@ -0,0 +1,165 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-lineno-makeup-test.patch + +;; Testcase for "Do not make up line information" fix by Daniel Jacobowitz. +;;=fedoratest + +New testcase for: +https://bugzilla.redhat.com/show_bug.cgi?id=466222 + (for the first / customer recommended fix) +and the upstream fix: +http://sourceware.org/ml/gdb-patches/2006-11/msg00253.html + [rfc] Do not make up line information +http://sourceware.org/ml/gdb-cvs/2006-11/msg00127.html + +diff --git a/gdb/testsuite/gdb.base/lineno-makeup-func.c b/gdb/testsuite/gdb.base/lineno-makeup-func.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/lineno-makeup-func.c +@@ -0,0 +1,21 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2009 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++void ++func (void) ++{ ++} +diff --git a/gdb/testsuite/gdb.base/lineno-makeup.c b/gdb/testsuite/gdb.base/lineno-makeup.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/lineno-makeup.c +@@ -0,0 +1,35 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2009 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* DW_AT_low_pc-DW_AT_high_pc should cover the function without line number ++ information (.debug_line) so we cannot use an external object file. ++ ++ It must not be just a label as it would alias on the next function even for ++ correct GDB. Therefore some stub data must be placed there. ++ ++ We need to provide a real stub function body as at least s390 ++ (s390_analyze_prologue) would skip the whole body till reaching `main'. */ ++ ++extern void func (void); ++asm ("func: .incbin \"" BINFILENAME "\""); ++ ++int ++main (void) ++{ ++ func (); ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/lineno-makeup.exp b/gdb/testsuite/gdb.base/lineno-makeup.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/lineno-makeup.exp +@@ -0,0 +1,78 @@ ++# Copyright 2009 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++set testfile "lineno-makeup" ++set srcfuncfile ${testfile}-func.c ++set srcfile ${testfile}.c ++set objfuncfile [standard_output_file ${testfile}-func.o] ++set binfuncfile [standard_output_file ${testfile}-func.bin] ++set binfile [standard_output_file ${testfile}] ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" "${objfuncfile}" object {}] != "" } { ++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." ++} ++ ++set objcopy [catch "exec objcopy -O binary --only-section .text ${objfuncfile} ${binfuncfile}" output] ++verbose -log "objcopy=$objcopy: $output" ++if { $objcopy != 0 } { ++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." ++} ++set binfuncfilesize [file size $binfuncfile] ++verbose -log "file size $binfuncfile = $binfuncfilesize" ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug additional_flags=-DBINFILENAME=\"$binfuncfile\"]] != "" } { ++ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load ${binfile} ++ ++set b_addr "" ++set test "break func" ++gdb_test_multiple $test $test { ++ -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+)\r\n$gdb_prompt $" { ++ set b_addr $expect_out(1,string) ++ pass $test ++ } ++ -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+): .*\r\n$gdb_prompt $" { ++ set b_addr $expect_out(1,string) ++ fail $test ++ } ++} ++verbose -log "b_addr=<$b_addr>" ++ ++set p_addr "" ++set test "print func" ++gdb_test_multiple $test $test { ++ -re "\\$\[0-9\]+ = {} (0x\[0-9a-f\]+) \r\n$gdb_prompt $" { ++ set p_addr $expect_out(1,string) ++ pass $test ++ } ++} ++verbose -log "p_addr=<$p_addr>" ++ ++set test "break address belongs to func" ++if {$b_addr == $p_addr} { ++ pass "$test (exact match)" ++} else { ++ set skip [expr $b_addr - $p_addr] ++ if {$skip > 0 && $skip < $binfuncfilesize} { ++ pass "$test (prologue skip by $skip bytes)" ++ } else { ++ fail $test ++ } ++} diff --git a/gdb-linux_perf-bundle.patch b/gdb-linux_perf-bundle.patch new file mode 100644 index 0000000..4c7e58f --- /dev/null +++ b/gdb-linux_perf-bundle.patch @@ -0,0 +1,224 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-linux_perf-bundle.patch + +;; [dts+el7] [x86*] Bundle linux_perf.h for libipt (RH BZ 1256513). +;;=fedora + +diff --git a/gdb/gdb.c b/gdb/gdb.c +--- a/gdb/gdb.c ++++ b/gdb/gdb.c +@@ -20,11 +20,19 @@ + #include "main.h" + #include "interps.h" + ++#ifdef PERF_ATTR_SIZE_VER5_BUNDLE ++extern "C" void __libipt_init(void); ++#endif ++ + int + main (int argc, char **argv) + { + struct captured_main_args args; + ++#ifdef PERF_ATTR_SIZE_VER5_BUNDLE ++ __libipt_init(); ++#endif ++ + memset (&args, 0, sizeof args); + args.argc = argc; + args.argv = argv; +diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h +--- a/gdb/nat/linux-btrace.h ++++ b/gdb/nat/linux-btrace.h +@@ -27,6 +27,177 @@ + # include + #endif + ++#ifdef PERF_ATTR_SIZE_VER5_BUNDLE ++#ifndef HAVE_LINUX_PERF_EVENT_H ++# error "PERF_ATTR_SIZE_VER5_BUNDLE && !HAVE_LINUX_PERF_EVENT_H" ++#endif ++#ifndef PERF_ATTR_SIZE_VER5 ++#define PERF_ATTR_SIZE_VER5 ++#define perf_event_mmap_page perf_event_mmap_page_bundle ++// kernel-headers-3.10.0-493.el7.x86_64/usr/include/linux/perf_event.h ++/* ++ * Structure of the page that can be mapped via mmap ++ */ ++struct perf_event_mmap_page { ++ __u32 version; /* version number of this structure */ ++ __u32 compat_version; /* lowest version this is compat with */ ++ ++ /* ++ * Bits needed to read the hw events in user-space. ++ * ++ * u32 seq, time_mult, time_shift, index, width; ++ * u64 count, enabled, running; ++ * u64 cyc, time_offset; ++ * s64 pmc = 0; ++ * ++ * do { ++ * seq = pc->lock; ++ * barrier() ++ * ++ * enabled = pc->time_enabled; ++ * running = pc->time_running; ++ * ++ * if (pc->cap_usr_time && enabled != running) { ++ * cyc = rdtsc(); ++ * time_offset = pc->time_offset; ++ * time_mult = pc->time_mult; ++ * time_shift = pc->time_shift; ++ * } ++ * ++ * index = pc->index; ++ * count = pc->offset; ++ * if (pc->cap_user_rdpmc && index) { ++ * width = pc->pmc_width; ++ * pmc = rdpmc(index - 1); ++ * } ++ * ++ * barrier(); ++ * } while (pc->lock != seq); ++ * ++ * NOTE: for obvious reason this only works on self-monitoring ++ * processes. ++ */ ++ __u32 lock; /* seqlock for synchronization */ ++ __u32 index; /* hardware event identifier */ ++ __s64 offset; /* add to hardware event value */ ++ __u64 time_enabled; /* time event active */ ++ __u64 time_running; /* time event on cpu */ ++ union { ++ __u64 capabilities; ++ struct { ++ __u64 cap_bit0 : 1, /* Always 0, deprecated, see commit 860f085b74e9 */ ++ cap_bit0_is_deprecated : 1, /* Always 1, signals that bit 0 is zero */ ++ ++ cap_user_rdpmc : 1, /* The RDPMC instruction can be used to read counts */ ++ cap_user_time : 1, /* The time_* fields are used */ ++ cap_user_time_zero : 1, /* The time_zero field is used */ ++ cap_____res : 59; ++ }; ++ }; ++ ++ /* ++ * If cap_user_rdpmc this field provides the bit-width of the value ++ * read using the rdpmc() or equivalent instruction. This can be used ++ * to sign extend the result like: ++ * ++ * pmc <<= 64 - width; ++ * pmc >>= 64 - width; // signed shift right ++ * count += pmc; ++ */ ++ __u16 pmc_width; ++ ++ /* ++ * If cap_usr_time the below fields can be used to compute the time ++ * delta since time_enabled (in ns) using rdtsc or similar. ++ * ++ * u64 quot, rem; ++ * u64 delta; ++ * ++ * quot = (cyc >> time_shift); ++ * rem = cyc & (((u64)1 << time_shift) - 1); ++ * delta = time_offset + quot * time_mult + ++ * ((rem * time_mult) >> time_shift); ++ * ++ * Where time_offset,time_mult,time_shift and cyc are read in the ++ * seqcount loop described above. This delta can then be added to ++ * enabled and possible running (if index), improving the scaling: ++ * ++ * enabled += delta; ++ * if (index) ++ * running += delta; ++ * ++ * quot = count / running; ++ * rem = count % running; ++ * count = quot * enabled + (rem * enabled) / running; ++ */ ++ __u16 time_shift; ++ __u32 time_mult; ++ __u64 time_offset; ++ /* ++ * If cap_usr_time_zero, the hardware clock (e.g. TSC) can be calculated ++ * from sample timestamps. ++ * ++ * time = timestamp - time_zero; ++ * quot = time / time_mult; ++ * rem = time % time_mult; ++ * cyc = (quot << time_shift) + (rem << time_shift) / time_mult; ++ * ++ * And vice versa: ++ * ++ * quot = cyc >> time_shift; ++ * rem = cyc & (((u64)1 << time_shift) - 1); ++ * timestamp = time_zero + quot * time_mult + ++ * ((rem * time_mult) >> time_shift); ++ */ ++ __u64 time_zero; ++ __u32 size; /* Header size up to __reserved[] fields. */ ++ ++ /* ++ * Hole for extension of the self monitor capabilities ++ */ ++ ++ __u8 __reserved[118*8+4]; /* align to 1k. */ ++ ++ /* ++ * Control data for the mmap() data buffer. ++ * ++ * User-space reading the @data_head value should issue an smp_rmb(), ++ * after reading this value. ++ * ++ * When the mapping is PROT_WRITE the @data_tail value should be ++ * written by userspace to reflect the last read data, after issueing ++ * an smp_mb() to separate the data read from the ->data_tail store. ++ * In this case the kernel will not over-write unread data. ++ * ++ * See perf_output_put_handle() for the data ordering. ++ * ++ * data_{offset,size} indicate the location and size of the perf record ++ * buffer within the mmapped area. ++ */ ++ __u64 data_head; /* head in the data section */ ++ __u64 data_tail; /* user-space written tail */ ++ __u64 data_offset; /* where the buffer starts */ ++ __u64 data_size; /* data buffer size */ ++ ++ /* ++ * AUX area is defined by aux_{offset,size} fields that should be set ++ * by the userspace, so that ++ * ++ * aux_offset >= data_offset + data_size ++ * ++ * prior to mmap()ing it. Size of the mmap()ed area should be aux_size. ++ * ++ * Ring buffer pointers aux_{head,tail} have the same semantics as ++ * data_{head,tail} and same ordering rules apply. ++ */ ++ __u64 aux_head; ++ __u64 aux_tail; ++ __u64 aux_offset; ++ __u64 aux_size; ++}; ++#endif // PERF_ATTR_SIZE_VER5 ++#endif // PERF_ATTR_SIZE_VER5_BUNDLE ++ + struct target_ops; + + #if HAVE_LINUX_PERF_EVENT_H +diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4 +--- a/gdbsupport/common.m4 ++++ b/gdbsupport/common.m4 +@@ -166,7 +166,7 @@ AC_DEFUN([GDB_AC_COMMON], [ + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ + #include + #ifndef PERF_ATTR_SIZE_VER5 +- # error ++ // error // PERF_ATTR_SIZE_VER5_BUNDLE is not available here - Fedora+RHEL + #endif + ]])], [perf_event=yes], [perf_event=no]) + if test "$perf_event" != yes; then diff --git a/gdb-opcodes-clflushopt-test.patch b/gdb-opcodes-clflushopt-test.patch new file mode 100644 index 0000000..f95999e --- /dev/null +++ b/gdb-opcodes-clflushopt-test.patch @@ -0,0 +1,62 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-opcodes-clflushopt-test.patch + +;; Test clflushopt instruction decode (for RH BZ 1262471). +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.arch/amd64-clflushopt.S b/gdb/testsuite/gdb.arch/amd64-clflushopt.S +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/amd64-clflushopt.S +@@ -0,0 +1,19 @@ ++/* Copyright 2016 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . ++ ++ This file is part of the gdb testsuite. */ ++ ++_start: .globl _start ++ clflushopt (%edi) +diff --git a/gdb/testsuite/gdb.arch/amd64-clflushopt.exp b/gdb/testsuite/gdb.arch/amd64-clflushopt.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/amd64-clflushopt.exp +@@ -0,0 +1,25 @@ ++# Copyright 2016 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++if { ![istarget "x86_64-*-*"] && ![istarget "i?86-*-*"] } then { ++ verbose "Skipping amd64 clflushopt test." ++ return ++} ++ ++if [prepare_for_testing amd64-clflushopt.exp amd64-clflushopt amd64-clflushopt.S [list debug "additional_flags=-nostdlib"]] { ++ return -1 ++} ++ ++gdb_test "disas _start" "Dump of assembler code for function _start:\r\n *0x\[0-9a-f\]+ <\[+\]0>:\tclflushopt \\(%edi\\)\r\nEnd of assembler dump\\." "clflushopt" diff --git a/gdb-orphanripper.c b/gdb-orphanripper.c new file mode 100644 index 0000000..2653dd2 --- /dev/null +++ b/gdb-orphanripper.c @@ -0,0 +1,752 @@ +/* + * Copyright 2006-2007 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Reap any leftover children possibly holding file descriptors. + * Children are identified by the stale file descriptor or PGID / SID. + * Both can be missed but only the stale file descriptors are important for us. + * PGID / SID may be set by the children on their own. + * If we fine a candidate we kill it will all its process tree (grandchildren). + * The child process is run with `2>&1' redirection (due to forkpty(3)). + * 2007-07-10 Jan Kratochvil + */ + +/* For getpgid(2). */ +#define _GNU_SOURCE 1 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define LENGTH(x) (sizeof (x) / sizeof (*(x))) + +static const char *progname; + +static volatile pid_t child; + +static void signal_chld (int signo) +{ +} + +static volatile int signal_alrm_hit = 0; + +static void signal_alrm (int signo) +{ + signal_alrm_hit = 1; +} + +static char childptyname[LINE_MAX]; + +static void print_child_error (const char *reason, char **argv) +{ + char **sp; + + fprintf (stderr, "%s: %d %s:", progname, (int) child, reason); + for (sp = argv; *sp != NULL; sp++) + { + fputc (' ', stderr); + fputs (*sp, stderr); + } + fputc ('\n', stderr); +} + +static int read_out (int amaster) +{ + char buf[LINE_MAX]; + ssize_t buf_got; + + buf_got = read (amaster, buf, sizeof buf); + if (buf_got == 0) + return 0; + /* Weird but at least after POLLHUP we get EIO instead of just EOF. */ + if (buf_got == -1 && errno == EIO) + return 0; + if (buf_got == -1 && errno == EAGAIN) + return 0; + if (buf_got < 0) + { + perror ("read (amaster)"); + exit (EXIT_FAILURE); + } + if (write (STDOUT_FILENO, buf, buf_got) != buf_got) + { + perror ("write(2)"); + exit (EXIT_FAILURE); + } + return 1; +} + +/* kill (child, 0) == 0 sometimes even when CHILD's state is already "Z". */ + +static int child_exited (void) +{ + char buf[200]; + int fd, i, retval; + ssize_t got; + char state[3]; + + snprintf (buf, sizeof (buf), "/proc/%ld/stat", (long) child); + fd = open (buf, O_RDONLY); + if (fd == -1) + { + perror ("open (/proc/CHILD/stat)"); + exit (EXIT_FAILURE); + } + got = read (fd, buf, sizeof(buf)); + if (got <= 0) + { + perror ("read (/proc/CHILD/stat)"); + exit (EXIT_FAILURE); + } + if (close (fd) != 0) + { + perror ("close (/proc/CHILD/stat)"); + exit (EXIT_FAILURE); + } + /* RHEL-5 does not support %ms. */ + i = sscanf (buf, "%*d%*s%2s", state); + if (i != 1) + { + perror ("sscanf (/proc/CHILD/stat)"); + exit (EXIT_FAILURE); + } + retval = strcmp (state, "Z") == 0; + return retval; +} + +static int spawn (char **argv, int timeout) +{ + pid_t child_got; + int status, amaster, i, rc; + struct sigaction act; + sigset_t set; + struct termios termios; + unsigned alarm_orig; + + /* We do not use signal(2) to be sure we do not have SA_RESTART. */ + memset (&act, 0, sizeof (act)); + act.sa_handler = signal_chld; + i = sigemptyset (&act.sa_mask); + assert (i == 0); + act.sa_flags = 0; /* !SA_RESTART */ + i = sigaction (SIGCHLD, &act, NULL); + assert (i == 0); + + i = sigemptyset (&set); + assert (i == 0); + i = sigaddset (&set, SIGCHLD); + assert (i == 0); + i = sigprocmask (SIG_SETMASK, &set, NULL); + assert (i == 0); + + /* With TERMP passed as NULL we get "\n" -> "\r\n". */ + termios.c_iflag = IGNBRK | IGNPAR; + termios.c_oflag = 0; + termios.c_cflag = CS8 | CREAD | CLOCAL | HUPCL | B9600; + termios.c_lflag = IEXTEN | NOFLSH; + memset (termios.c_cc, _POSIX_VDISABLE, sizeof (termios.c_cc)); + termios.c_cc[VTIME] = 0; + termios.c_cc[VMIN ] = 1; + cfmakeraw (&termios); +#ifdef FLUSHO + /* Workaround a readline deadlock bug in _get_tty_settings(). */ + termios.c_lflag &= ~FLUSHO; +#endif + child = forkpty (&amaster, childptyname, &termios, NULL); + switch (child) + { + case -1: + perror ("forkpty(3)"); + exit (EXIT_FAILURE); + case 0: + /* Do not replace STDIN as inferiors query its termios. */ +#if 0 + i = close (STDIN_FILENO); + assert (i == 0); + i = open ("/dev/null", O_RDONLY); + assert (i == STDIN_FILENO); +#endif + + i = sigemptyset (&set); + assert (i == 0); + i = sigprocmask (SIG_SETMASK, &set, NULL); + assert (i == 0); + + /* Do not setpgrp(2) in the parent process as the process-group + is shared for the whole sh(1) pipeline we could be a part + of. The process-group is set according to PID of the first + command in the pipeline. + We would rip even vi(1) in the case of: + ./orphanripper sh -c 'sleep 1&' | vi - + */ + /* Do not setpgrp(2) as our pty would not be ours and we would + get `SIGSTOP' later, particularly after spawning gdb(1). + setsid(3) was already executed by forkpty(3) and it would fail if + executed again. */ + if (getpid() != getpgrp ()) + { + perror ("getpgrp(2)"); + exit (EXIT_FAILURE); + } + execvp (argv[0], argv); + perror ("execvp(2)"); + exit (EXIT_FAILURE); + default: + break; + } + i = fcntl (amaster, F_SETFL, O_RDWR | O_NONBLOCK); + if (i != 0) + { + perror ("fcntl (amaster, F_SETFL, O_NONBLOCK)"); + exit (EXIT_FAILURE); + } + + /* We do not use signal(2) to be sure we do not have SA_RESTART. */ + act.sa_handler = signal_alrm; + i = sigaction (SIGALRM, &act, NULL); + assert (i == 0); + + alarm_orig = alarm (timeout); + assert (alarm_orig == 0); + + i = sigemptyset (&set); + assert (i == 0); + + while (!signal_alrm_hit) + { + struct pollfd pollfd; + + pollfd.fd = amaster; + pollfd.events = POLLIN; + i = ppoll (&pollfd, 1, NULL, &set); + if (i == -1 && errno == EINTR) + { + if (child_exited ()) + break; + /* Non-CHILD child may have exited. */ + continue; + } + assert (i == 1); + /* Data available? Process it first. */ + if (pollfd.revents & POLLIN) + { + if (!read_out (amaster)) + { + fprintf (stderr, "%s: Unexpected EOF\n", progname); + exit (EXIT_FAILURE); + } + } + if (pollfd.revents & POLLHUP) + break; + if ((pollfd.revents &= ~POLLIN) != 0) + { + fprintf (stderr, "%s: ppoll(2): revents 0x%x\n", progname, + (unsigned) pollfd.revents); + exit (EXIT_FAILURE); + } + /* Child exited? */ + if (child_exited ()) + break; + } + + if (signal_alrm_hit) + { + i = kill (child, SIGKILL); + assert (i == 0); + } + else + alarm (0); + + /* WNOHANG still could fail. */ + child_got = waitpid (child, &status, 0); + if (child != child_got) + { + fprintf (stderr, "waitpid (%d) = %d: %m\n", (int) child, (int) child_got); + exit (EXIT_FAILURE); + } + if (signal_alrm_hit) + { + char *buf; + + if (asprintf (&buf, "Timed out after %d seconds", timeout) != -1) + { + print_child_error (buf, argv); + free (buf); + } + rc = 128 + SIGALRM; + } + else if (WIFEXITED (status)) + rc = WEXITSTATUS (status); + else if (WIFSIGNALED (status)) + { + print_child_error (strsignal (WTERMSIG (status)), argv); + rc = 128 + WTERMSIG (status); + } + else if (WIFSTOPPED (status)) + { + fprintf (stderr, "waitpid (%d): WIFSTOPPED - WSTOPSIG is %d\n", + (int) child, WSTOPSIG (status)); + exit (EXIT_FAILURE); + } + else + { + fprintf (stderr, "waitpid (%d): !WIFEXITED (%d)\n", (int) child, status); + exit (EXIT_FAILURE); + } + + /* Not used in fact. */ + i = sigprocmask (SIG_SETMASK, &set, NULL); + assert (i == 0); + + /* Do not unset O_NONBLOCK as a stale child (the whole purpose of this + program) having open its output pty would block us in read_out. */ +#if 0 + i = fcntl (amaster, F_SETFL, O_RDONLY /* !O_NONBLOCK */); + if (i != 0) + { + perror ("fcntl (amaster, F_SETFL, O_RDONLY /* !O_NONBLOCK */)"); + exit (EXIT_FAILURE); + } +#endif + + while (read_out (amaster)); + + /* Do not close the master FD as the child would have `/dev/pts/23 (deleted)' + entries which are not expected (and expecting ` (deleted)' would be + a race. */ +#if 0 + i = close (amaster); + if (i != 0) + { + perror ("close (forkpty ()'s amaster)"); + exit (EXIT_FAILURE); + } +#endif + + return rc; +} + +/* Detected commandline may look weird due to a race: + Original command: + ./orphanripper sh -c 'sleep 1&' & + Correct output: + [1] 29610 + ./orphanripper: Killed -9 orphan PID 29612 (PGID 29611): sleep 1 + Raced output (sh(1) child still did not update its argv[]): + [1] 29613 + ./orphanripper: Killed -9 orphan PID 29615 (PGID 29614): sh -c sleep 1& + We could delay a bit before ripping the children. */ +static const char *read_cmdline (pid_t pid) +{ + char cmdline_fname[32]; + static char cmdline[LINE_MAX]; + int fd; + ssize_t got; + char *s; + + if (snprintf (cmdline_fname, sizeof cmdline_fname, "/proc/%d/cmdline", + (int) pid) < 0) + return NULL; + fd = open (cmdline_fname, O_RDONLY); + if (fd == -1) + { + /* It may have already exited - ENOENT. */ +#if 0 + fprintf (stderr, "%s: open (\"%s\"): %m\n", progname, cmdline_fname); +#endif + return NULL; + } + got = read (fd, cmdline, sizeof (cmdline) - 1); + if (got == -1) + fprintf (stderr, "%s: read (\"%s\"): %m\n", progname, + cmdline_fname); + if (close (fd) != 0) + fprintf (stderr, "%s: close (\"%s\"): %m\n", progname, + cmdline_fname); + if (got < 0) + return NULL; + /* Convert '\0' argument delimiters to spaces. */ + for (s = cmdline; s < cmdline + got; s++) + if (!*s) + *s = ' '; + /* Trim the trailing spaces (typically single '\0'->' '). */ + while (s > cmdline && isspace (s[-1])) + s--; + *s = 0; + return cmdline; +} + +static int dir_scan (const char *dirname, + int (*callback) (struct dirent *dirent, const char *pathname)) +{ + DIR *dir; + struct dirent *dirent; + int rc = 0; + + dir = opendir (dirname); + if (dir == NULL) + { + if (errno == EACCES || errno == ENOENT) + return rc; + fprintf (stderr, "%s: opendir (\"%s\"): %m\n", progname, dirname); + exit (EXIT_FAILURE); + } + while ((errno = 0, dirent = readdir (dir))) + { + char pathname[LINE_MAX]; + int pathname_len; + + pathname_len = snprintf (pathname, sizeof pathname, "%s/%s", + dirname, dirent->d_name); + if (pathname_len <= 0 || pathname_len >= (int) sizeof pathname) + { + fprintf (stderr, "entry file name too long: `%s' / `%s'\n", + dirname, dirent->d_name); + continue; + } + /* RHEL-4.5 on s390x never fills in D_TYPE. */ + if (dirent->d_type == DT_UNKNOWN) + { + struct stat statbuf; + int i; + + /* We are not interested in the /proc/PID/fd/ links targets. */ + i = lstat (pathname, &statbuf); + if (i == -1) + { + if (errno == EACCES || errno == ENOENT) + continue; + fprintf (stderr, "%s: stat (\"%s\"): %m\n", progname, pathname); + exit (EXIT_FAILURE); + } + if (S_ISDIR (statbuf.st_mode)) + dirent->d_type = DT_DIR; + if (S_ISLNK (statbuf.st_mode)) + dirent->d_type = DT_LNK; + /* No other D_TYPE types used in this code. */ + } + rc = (*callback) (dirent, pathname); + if (rc != 0) + { + errno = 0; + break; + } + } + if (errno != 0) + { + fprintf (stderr, "%s: readdir (\"%s\"): %m\n", progname, dirname); + exit (EXIT_FAILURE); + } + if (closedir (dir) != 0) + { + fprintf (stderr, "%s: closedir (\"%s\"): %m\n", progname, dirname); + exit (EXIT_FAILURE); + } + return rc; +} + +static int fd_fs_scan (pid_t pid, int (*func) (pid_t pid, const char *link)) +{ + char dirname[64]; + + if (snprintf (dirname, sizeof dirname, "/proc/%d/fd", (int) pid) < 0) + { + perror ("snprintf(3)"); + exit (EXIT_FAILURE); + } + + int callback (struct dirent *dirent, const char *pathname) + { + char buf[LINE_MAX]; + ssize_t buf_len; + + if ((dirent->d_type != DT_DIR && dirent->d_type != DT_LNK) + || (dirent->d_type == DT_DIR && strcmp (dirent->d_name, ".") != 0 + && strcmp (dirent->d_name, "..") != 0) + || (dirent->d_type == DT_LNK && strspn (dirent->d_name, "0123456789") + != strlen (dirent->d_name))) + { + fprintf (stderr, "Unexpected entry \"%s\" (d_type %u)" + " on readdir (\"%s\"): %m\n", + dirent->d_name, (unsigned) dirent->d_type, dirname); + return 0; + } + if (dirent->d_type == DT_DIR) + return 0; + buf_len = readlink (pathname, buf, sizeof buf - 1); + if (buf_len <= 0 || buf_len >= (ssize_t) sizeof buf - 1) + { + if (errno != ENOENT && errno != EACCES) + fprintf (stderr, "Error reading link \"%s\": %m\n", pathname); + return 0; + } + buf[buf_len] = 0; + return (*func) (pid, buf); + } + + return dir_scan (dirname, callback); +} + +static void pid_fs_scan (void (*func) (pid_t pid, void *data), void *data) +{ + int callback (struct dirent *dirent, const char *pathname) + { + if (dirent->d_type != DT_DIR + || strspn (dirent->d_name, "0123456789") != strlen (dirent->d_name)) + return 0; + (*func) (atoi (dirent->d_name), data); + return 0; + } + + dir_scan ("/proc", callback); +} + +static int rip_check_ptyname (pid_t pid, const char *link) +{ + assert (pid != getpid ()); + + return strcmp (link, childptyname) == 0; +} + +struct pid + { + struct pid *next; + pid_t pid; + }; +static struct pid *pid_list; + +static int pid_found (pid_t pid) +{ + struct pid *entry; + + for (entry = pid_list; entry != NULL; entry = entry->next) + if (entry->pid == pid) + return 1; + return 0; +} + +/* Single pass is not enough, a (multithreaded) process was seen to survive. + Repeated killing of the same process is not enough, zombies can be killed. + */ +static int cleanup_acted; + +static void pid_record (pid_t pid) +{ + struct pid *entry; + + if (pid_found (pid)) + return; + cleanup_acted = 1; + + entry = malloc (sizeof (*entry)); + if (entry == NULL) + { + fprintf (stderr, "%s: malloc: %m\n", progname); + exit (EXIT_FAILURE); + } + entry->pid = pid; + entry->next = pid_list; + pid_list = entry; +} + +static void pid_forall (void (*func) (pid_t pid)) +{ + struct pid *entry; + + for (entry = pid_list; entry != NULL; entry = entry->next) + (*func) (entry->pid); +} + +/* Returns 0 on failure. */ +static pid_t pid_get_parent (pid_t pid) +{ + char fname[64]; + FILE *f; + char line[LINE_MAX]; + pid_t retval = 0; + + if (snprintf (fname, sizeof fname, "/proc/%d/status", (int) pid) < 0) + { + perror ("snprintf(3)"); + exit (EXIT_FAILURE); + } + f = fopen (fname, "r"); + if (f == NULL) + { + return 0; + } + while (errno = 0, fgets (line, sizeof line, f) == line) + { + if (strncmp (line, "PPid:\t", sizeof "PPid:\t" - 1) != 0) + continue; + retval = atoi (line + sizeof "PPid:\t" - 1); + errno = 0; + break; + } + if (errno != 0) + { + fprintf (stderr, "%s: fgets (\"%s\"): %m\n", progname, fname); + exit (EXIT_FAILURE); + } + if (fclose (f) != 0) + { + fprintf (stderr, "%s: fclose (\"%s\"): %m\n", progname, fname); + exit (EXIT_FAILURE); + } + return retval; +} + +static void killtree (pid_t pid); + +static void killtree_pid_fs_scan (pid_t pid, void *data) +{ + pid_t parent_pid = *(pid_t *) data; + + /* Do not optimize it as we could miss some newly spawned processes. + Always traverse all the leaves. */ +#if 0 + /* Optimization. */ + if (pid_found (pid)) + return; +#endif + + if (pid_get_parent (pid) != parent_pid) + return; + + killtree (pid); +} + +static void killtree (pid_t pid) +{ + pid_record (pid); + pid_fs_scan (killtree_pid_fs_scan, &pid); +} + +static void rip_pid_fs_scan (pid_t pid, void *data) +{ + pid_t pgid; + + /* Shouldn't happen. */ + if (pid == getpid ()) + return; + + /* Check both PGID and the stale file descriptors. */ + pgid = getpgid (pid); + if (pgid == child + || fd_fs_scan (pid, rip_check_ptyname) != 0) + killtree (pid); +} + +static void killproc (pid_t pid) +{ + const char *cmdline; + + cmdline = read_cmdline (pid); + /* Avoid printing the message for already gone processes. */ + if (kill (pid, 0) != 0 && errno == ESRCH) + return; + if (cmdline == NULL) + cmdline = ""; + fprintf (stderr, "%s: Killed -9 orphan PID %d: %s\n", progname, (int) pid, cmdline); + if (kill (pid, SIGKILL) == 0) + cleanup_acted = 1; + else if (errno != ESRCH) + fprintf (stderr, "%s: kill (%d, SIGKILL): %m\n", progname, (int) pid); + /* RHEL-3 kernels cannot SIGKILL a `T (stopped)' process. */ + kill (pid, SIGCONT); + /* Do not waitpid(2) as it cannot be our direct descendant and it gets + cleaned up by init(8). */ +#if 0 + pid_t pid_got; + pid_got = waitpid (pid, NULL, 0); + if (pid != pid_got) + { + fprintf (stderr, "%s: waitpid (%d) != %d: %m\n", progname, + (int) pid, (int) pid_got); + return; + } +#endif +} + +static void rip (void) +{ + cleanup_acted = 0; + do + { + if (cleanup_acted) + usleep (1000000 / 10); + cleanup_acted = 0; + pid_fs_scan (rip_pid_fs_scan, NULL); + pid_forall (killproc); + } + while (cleanup_acted); +} + +int main (int argc, char **argv) +{ + int timeout = 0; + int rc; + + progname = *argv++; + argc--; + + if (argc < 1 || strcmp (*argv, "-h") == 0 + || strcmp (*argv, "--help") == 0) + { + puts ("Syntax: orphanripper [-t ] "); + exit (EXIT_FAILURE); + } + if ((*argv)[0] == '-' && (*argv)[1] == 't') + { + char *timeout_s = NULL; + + if ((*argv)[2] == 0) + timeout_s = *++argv; + else if (isdigit ((*argv)[2])) + timeout_s = (*argv) + 2; + if (timeout_s != NULL) + { + long l; + char *endptr; + + argv++; + l = strtol (timeout_s, &endptr, 0); + timeout = l; + if ((endptr != NULL && *endptr != 0) || timeout < 0 || timeout != l) + { + fprintf (stderr, "%s: Invalid timeout value: %s\n", progname, + timeout_s); + exit (EXIT_FAILURE); + } + } + } + + rc = spawn (argv, timeout); + rip (); + return rc; +} diff --git a/gdb-python-finishbreakpoint-update.patch b/gdb-python-finishbreakpoint-update.patch new file mode 100644 index 0000000..7fed6fc --- /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-rhbz-818343-set-solib-absolute-prefix-testcase.patch b/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch new file mode 100644 index 0000000..20e5f75 --- /dev/null +++ b/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch @@ -0,0 +1,83 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch + +;; Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343). +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c +@@ -0,0 +1,26 @@ ++/* Copyright (C) 2012 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#include ++#include ++ ++int ++main (int argc, char *argv[]) ++{ ++ printf ("Hello, World.\n"); ++ abort (); ++} +diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp +@@ -0,0 +1,39 @@ ++# Copyright 2012 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++set testfile "set-solib-absolute-prefix" ++set srcfile ${testfile}.c ++ ++# It is necessary to verify if the binary is 32-bit, so that the system ++# call `__kernel_vsyscall' originates from vDSO. ++ ++if { ![is_ilp32_target] } { ++ return -1 ++} ++ ++if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { ++ return -1 ++} ++ ++if { ![runto_main] } { ++ return -1 ++} ++ ++gdb_test "continue" "Program received signal SIGABRT, Aborted.*" \ ++ "continue until abort" ++gdb_test "set solib-absolute-prefix /BOGUS_DIRECT" \ ++ ".*warning: Unable to find dynamic linker breakpoint function.*" \ ++ "set solib-absolute-prefix" ++gdb_test "bt" "__kernel_vsyscall.*" "backtrace with __kernel_vsyscall" diff --git a/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch b/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch new file mode 100644 index 0000000..4d05ba5 --- /dev/null +++ b/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch @@ -0,0 +1,170 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch + +;; Fix 'memory leak in infpy_read_memory()' (RH BZ 1007614) +;;=fedoratest + +Original message by Tom Tromey: + + + Message-ID: <871uoc1va3.fsf@fleche.redhat.com> + +Comment from Sergio Durigan Junior: + + In order to correctly test this patch, I wrote a testcase based on Jan + Kratochvil's . The + testcase, which can be seen below, tests GDB in order to see if the + amount of memory being leaked is minimal, as requested in the bugzilla. + It is hard to define what "minimum" is, so I ran the testcase on all + supported RHEL architectures and came up with an average. + +commit cc0265cdda9dc7e8665e8bfcf5b4477489daf27c +Author: Tom Tromey +Date: Wed Mar 28 17:38:08 2012 +0000 + + * python/py-inferior.c (infpy_read_memory): Remove cleanups and + explicitly free 'buffer' on exit paths. Decref 'membuf_object' + before returning. + +diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c +@@ -0,0 +1,27 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2014 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++static struct x ++ { ++ char unsigned u[4096]; ++ } x, *px = &x; ++ ++int ++main (int argc, char *argv[]) ++{ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.exp b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.exp +@@ -0,0 +1,68 @@ ++# Copyright 2014 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++set testfile py-gdb-rhbz1007614-memleak-infpy_read_memory ++set srcfile ${testfile}.c ++set binfile [standard_output_file ${testfile}] ++ ++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { ++ return -1 ++} ++ ++if { [skip_python_tests] } { continue } ++ ++set pid_of_gdb [exp_pid -i [board_info host fileid]] ++ ++proc memory_v_pages_get {} { ++ global pid_of_gdb ++ set fd [open "/proc/$pid_of_gdb/statm"] ++ gets $fd line ++ close $fd ++ # number of pages of virtual memory ++ scan $line "%d" drs ++ return $drs ++} ++ ++if { ![runto_main] } { ++ untested $testfile.exp ++ return -1 ++} ++ ++set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py] ++ ++gdb_test "source ${remote_python_file}" "" ++ ++gdb_test "hello-world" "" ++ ++set kbytes_before [memory_v_pages_get] ++verbose -log "kbytes_before = $kbytes_before" ++ ++gdb_test "hello-world" "" ++ ++set kbytes_after [memory_v_pages_get] ++verbose -log "kbytes_after = $kbytes_after" ++ ++set kbytes_diff [expr $kbytes_after - $kbytes_before] ++verbose -log "kbytes_diff = $kbytes_diff" ++ ++# The value "1000" was calculated by running a few GDB sessions with this ++# testcase, and seeing how much (in average) the memory consumption ++# increased after the "hello-world" command issued above. The average ++# was around 500 bytes, so I chose 1000 as a high estimate. ++if { $kbytes_diff > 1000 } { ++ fail "there is a memory leak on GDB (RHBZ 1007614)" ++} else { ++ pass "there is not a memory leak on GDB (RHBZ 1007614)" ++} +diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.py b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.py +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.py +@@ -0,0 +1,30 @@ ++# Copyright (C) 2014 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++class HelloWorld (gdb.Command): ++ """Greet the whole world.""" ++ ++ def __init__ (self): ++ super (HelloWorld, self).__init__ ("hello-world", ++ gdb.COMMAND_OBSCURE) ++ ++ def invoke (self, arg, from_tty): ++ px = gdb.parse_and_eval("px") ++ core = gdb.inferiors()[0] ++ for i in range(256 * 1024): ++ chunk = core.read_memory(px, 4096) ++ print "Hello, World!" ++ ++HelloWorld () diff --git a/gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch b/gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch new file mode 100644 index 0000000..d92bfc3 --- /dev/null +++ b/gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch @@ -0,0 +1,235 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch + +;; Fix '[ppc64] and [s390x] wrong prologue skip on -O2 -g code' (Jan +;; Kratochvil, RH BZ 1084404). +;;=fedoratest + +These testcases have been created by compiling glibc-2.17-78 on +RHEL-7.1 s390x/ppc64 boxes, and then taking the "select.o" file +present at $builddir/misc/select.o. + +diff --git a/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp +@@ -0,0 +1,34 @@ ++# Copyright 2015 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++if { ![istarget powerpc64-*linux-*] || ![is_lp64_target] } { ++ verbose "Skipping ppc64-prologue-skip.exp" ++ return ++} ++ ++set testfile "ppc64-prologue-skip" ++set uufile "${srcdir}/${subdir}/${testfile}.o.uu" ++set ofile "${srcdir}/${subdir}/${testfile}.o" ++ ++if { [catch "system \"uudecode -o ${ofile} ${uufile}\"" ] != 0 } { ++ untested "failed uudecode" ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_load $ofile ++ ++gdb_test "break ___newselect_nocancel" "Breakpoint $decimal at 0xc: file ../sysdeps/unix/syscall-template.S, line 81." "breakpoint on ___newselect_nocancel" +diff --git a/gdb/testsuite/gdb.arch/ppc64-prologue-skip.o.uu b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.o.uu +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.o.uu +@@ -0,0 +1,70 @@ ++begin 644 ppc64-skip-prologue.o.uu ++M?T5,1@("`0`````````````!`!4````!```````````````````````````` ++M``-(``````!```````!``!0`$8%-B-`L"@``0,(`-#@``(Y$```"3.,`('P( ++M`J;X`0`0^"'_D4@```%@````Z`$`@#@A`'!\"`.F3H``(/@A_X%]*`*F^2$` ++MD/CA`-#XP0#(^*$`P/B!`+CX80"P2````6````#X80!PZ.$`T.C!`,CHH0#` ++MZ($`N.AA`+`X``".1````GP``";X80!X^`$`B.AA`'!(```!8````.DA`)#H ++M`0"(Z&$`>'TH`Z9\#_$@."$`@$SC`"!+__]@```````,($``````````O``( ++M7U]S96QE8W0```````````````````````````!6``(````Y!`'[#@T``0$! ++M`0````$```$N+B]S>7-D97!S+W5N:7@``'-Y"]S>7-C86QL+71E;7!L871E ++M+E,`+W)O;W0O9VQI8F,O9VQI8F,M,BXQ-RTW."YE;#$$!&PP!```` ++M`#`````8`````````+P`20YP$4%^1`X`009!0@Z``4(107Y2$49_20X`!D$& ++M1@``````+G-Y;71A8@`N`````````!(````$@````$`````````"``````````8```` ++M)@````$``````````P```````````````````1@````````````````````` ++M``````````$``````````````"P````(``````````,````````````````` ++M``$8```````````````````````````````!```````````````V`````0`` ++M```````#```````````````````!&``````````0```````````````````` ++M"```````````````,0````0`````````````````````````````"L`````` ++M````,````!(````%``````````@`````````&````#L````!```````````` ++M``````````````````$H```````````````````````````````!```````` ++M``````!0`````0`````````````````````````````!*`````````!:```` ++M`````````````````0``````````````2P````0````````````````````` ++M````````"O``````````&````!(````(``````````@`````````&````&$` ++M```!``````````````````````````````&"`````````),````````````` ++M```````!``````````````!<````!``````````````````````````````+ ++M"`````````!@````$@````H`````````"``````````8````;0````$````` ++M`````````````````````````A4`````````%`````````````````````$` ++M`````````````(`````!``````````````````````````````(P```````` ++M`#`````````````````````0``````````````![````!``````````````` ++M```````````````+:``````````P````$@````T`````````"``````````8 ++M````E`````$``````````@```````````````````F``````````2``````` ++M``````````````@``````````````(\````$```````````````````````` ++M``````N8`````````!@````2````#P`````````(`````````!@````1```` ++M`P`````````````````````````````"J`````````">```````````````` ++M`````0```````````````0````(`````````````````````````````"$@` ++M```````!L````!,````+``````````@`````````&`````D````#```````` ++M``````````````````````GX`````````'H````````````````````!```` ++M`````````````````````````````````````````````P```0`````````` ++M`````````````````P```P```````````````````````````P``!``````` ++M`````````````````````P``!0```````````````````````````P``"@`` ++M`````````````````````````P``#````````````````````````````P`` ++M"````````````````````````````P``#0`````````````````````````` ++M`P``#P```````````````````````````P``!P`````````````````````` ++M```!$@``!0```````````````````-@````*$@```0`````````,```````` ++M`#`````@$``````````````````````````````P$``````````````````` ++M``````````!*$`````````````````````````````!E(@``!0`````````` ++M`````````-@```!S(@``!0```````````````````-@`7U]S96QE8W0`7U]? ++M;F5W6YC8V%N8V5L`%]?;&EB8U]D:7-A8FQE7V%S>6YC8V%N8V5L`%]? ++M;&EB8U]S96QE8W0`. ++ ++if { ![istarget s390x-*linux-*] || ![is_lp64_target] } { ++ verbose "Skipping s390x-prologue-skip.exp" ++ return ++} ++ ++set testfile "s390x-prologue-skip" ++set uufile "${srcdir}/${subdir}/${testfile}.o.uu" ++set ofile "${srcdir}/${subdir}/${testfile}.o" ++ ++if { [catch "system \"uudecode -o ${ofile} ${uufile}\"" ] != 0 } { ++ untested "failed uudecode" ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_load $ofile ++ ++gdb_test "break select" "Breakpoint $decimal at 0x48: file ../sysdeps/unix/syscall-template.S, line 81." "breakpoint on select" +diff --git a/gdb/testsuite/gdb.arch/s390x-prologue-skip.o.uu b/gdb/testsuite/gdb.arch/s390x-prologue-skip.o.uu +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/s390x-prologue-skip.o.uu +@@ -0,0 +1,64 @@ ++begin 644 s390x-prologue-skip.o.uu ++M?T5,1@("`0`````````````!`!8````!```````````````````````````` ++M``+```````!```````!``!(`#^LE\!``).O?\&@`)+D$`.^G^_]@X^#P```D ++MP.4`````N00``NLE\+``!`J.N00`TKD$`"#`Y0````"Y!``MZ]_Q"``$I_0` ++M"L`0`````+\/$`"G=/_7"HZG2?`!N2$`),"T``````?^````5@`"````.0$! ++M^PX-``$!`0$````!```!+BXO7-C86QL+71E;7!L ++M871E+E,``0`````)`@```````````]```0)F$P("``$!````CP`"``````@! ++M```````````````````````````N+B]S>7-D97!S+W5N:7@OE(``7@. ++M`1L,#Z`!````````&````!P`````````1`!,CP6.!HT'2`[``@```!`````X ++M`````````"```````"YS>6UT86(`+G-T``````````&````!`````&``````````@````````` ++M&````%<````!``````````````````````````````$"`````````),````` ++M```````````````!``````````````!2````!``````````````````````` ++M```````)^`````````!@````$`````@`````````"``````````8````8P`` ++M``$``````````````````````````````94`````````%``````````````` ++M``````$``````````````'8````!``````````````````````````````&P ++M`````````#`````````````````````0``````````````!Q````!``````` ++M```````````````````````*6``````````P````$`````L`````````"``` ++M```````8````B@````$``````````@```````````````````>`````````` ++M2`````````````````````@``````````````(4````$```````````````` ++M``````````````J(`````````#`````0````#0`````````(`````````!@` ++M```1`````P`````````````````````````````"*`````````"4```````` ++M`````````````0```````````````0````(````````````````````````` ++M````!T`````````!L````!$````*``````````@`````````&`````D````# ++M``````````````````````````````CP`````````(X````````````````` ++M```!`````````````````````````````````````````````````P```0`` ++M`````````````````````````P```P```````````````````````````P`` ++M!````````````````````````````P``"``````````````````````````` ++M`P``"@```````````````````````````P``!@`````````````````````` ++M`````P``"P```````````````````````````P``#0`````````````````` ++M`````````P``!0`````````````````````````!$``````````````````` ++M```````````;$``````````````````````````````V$@```0````````!( ++M`````````"`````_$`````````````````````````````!7$@```0`````` ++M``!6`````````!````!I$`````````````````````````````!Y(@```0`` ++M``````!(`````````"````"'(@```0````````!(`````````"``7U]L:6)C ++M7V5N86)L95]A +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-rhbz1149205-catch-syscall-after-fork-test.patch + +;; Fix '`catch syscall' doesn't work for parent after `fork' is called' +;; (Philippe Waroquiers, RH BZ 1149205). +;;=fedoratest + +URL: +Message-ID: <1368136582.30058.7.camel@soleil> + + From: Philippe Waroquiers + To: gdb-patches at sourceware dot org + Subject: RFA: fix gdb_assert caused by 'catch signal ...' and fork + Date: Thu, 09 May 2013 23:56:22 +0200 + + The attached patch fixes a gdb_assert caused by the combination of catch + signal and fork: + break-catch-sig.c:152: internal-error: signal_catchpoint_remove_location: Assertion `signal_catch_counts[iter] > 0' failed. + + The problem is that the signal_catch_counts is decremented by detach_breakpoints. + The fix consists in not detaching breakpoint locations of type bp_loc_other. + The patch introduces a new test. + +Comments by Sergio Durigan Junior: + + I addded a specific testcase for this patch, which tests exactly the + issue that the customer is facing. This patch does not solve the + whole problem of catching a syscall and forking (for more details, + see , + specifically comment #3), but it solves the issue reported by the + customer. + + I also removed the original testcase of this patch, because it + relied on "catch signal", which is a command that is not implemented + in this version of GDB. + +commit bd9673a4ded96ea5c108601501c8e59003ea1be6 +Author: Philippe Waroquiers +Date: Tue May 21 18:47:05 2013 +0000 + + Fix internal error caused by interaction between catch signal and fork + +diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c +@@ -0,0 +1,11 @@ ++#include ++#include ++ ++int ++main (int argc, char **argv) ++{ ++ if (fork () == 0) ++ sleep (1); ++ chdir ("."); ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp +@@ -0,0 +1,58 @@ ++# Copyright 2015 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++if { [is_remote target] || ![isnative] } then { ++ continue ++} ++ ++set testfile "gdb-rhbz1149205-catch-syscall-fork" ++set srcfile ${testfile}.c ++set binfile [standard_output_file ${testfile}] ++ ++# Until "catch syscall" is implemented on other targets... ++if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then { ++ continue ++} ++ ++# This shall be updated whenever 'catch syscall' is implemented ++# on some architecture. ++#if { ![istarget "i\[34567\]86-*-linux*"] ++if { ![istarget "x86_64-*-linux*"] && ![istarget "i\[34567\]86-*-linux*"] ++ && ![istarget "powerpc-*-linux*"] && ![istarget "powerpc64-*-linux*"] ++ && ![istarget "sparc-*-linux*"] && ![istarget "sparc64-*-linux*"] } { ++ continue ++} ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { ++ untested ${testfile}.exp ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++gdb_load $binfile ++ ++if { ![runto_main] } { ++ return -1 ++} ++ ++gdb_test "catch syscall chdir" \ ++ "Catchpoint $decimal \\\(syscall (.)?chdir(.)? \\\[$decimal\\\]\\\)" \ ++ "catch syscall chdir" ++ ++gdb_test "continue" \ ++ "Continuing\.\r\n.*\r\nCatchpoint $decimal \\\(call to syscall .?chdir.?.*" \ ++ "continue from catch syscall after fork" diff --git a/gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch b/gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch new file mode 100644 index 0000000..21a1a08 --- /dev/null +++ b/gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch @@ -0,0 +1,135 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch + +;; Fix 'backport GDB 7.4 fix to RHEL 6.6 GDB' [Original Sourceware bug +;; description: 'C++ (and objc): Internal error on unqualified name +;; re-set', PR 11657] (RH BZ 1186476). +;;=fedoratest + +Comments from Sergio Durigan Junior: + + The "proper" fix for this whole problem would be to backport the + "ambiguous linespec" patch series. However, it is really not + recommended to do that for RHEL GDB, because the patch series is too + big and could introduce unwanted regressions. Instead, what we + chose to do was to replace the gdb_assert call by a warning (which + allows the user to continue the debugging session), and tell the + user that, although more than one location was found for his/her + breakpoint, only one will be used. + +diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc +@@ -0,0 +1,22 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2015 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++int ++main (int argc, char *argv[]) ++{ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.cc b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.cc +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.cc +@@ -0,0 +1,26 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2015 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++class C ++ { ++ public: ++ C () {} ++ C (int x) {} ++ }; ++ ++C a; ++C b (1); +diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.exp b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set.exp +@@ -0,0 +1,51 @@ ++# Copyright 2015 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++if { [skip_cplus_tests] } { continue } ++if { [skip_shlib_tests] } { continue } ++if { [is_remote target] } { continue } ++if { [target_info exists use_gdb_stub] } { continue } ++ ++set testfile gdb-rhbz1186476-internal-error-unqualified-name-re-set-main ++set srcfile $testfile.cc ++set executable $testfile ++set binfile [standard_output_file $executable] ++ ++set libtestfile gdb-rhbz1186476-internal-error-unqualified-name-re-set ++set libsrcfile $libtestfile.cc ++set sofile [standard_output_file lib$libtestfile.so] ++ ++# Create and source the file that provides information about the compiler ++# used to compile the test case. ++if [get_compiler_info "c++"] { ++ return -1 ++} ++ ++if { [gdb_compile_shlib $srcdir/$subdir/$libsrcfile $sofile {debug c++ "additional_flags=-fPIC"}] != "" ++ || [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list additional_flags=-Wl,-rpath,[file dirname ${sofile}] "c++" shlib=${sofile} ]] != ""} { ++ untested $libtestfile.exp ++ return -1 ++} ++ ++clean_restart $executable ++ ++gdb_test_no_output "set breakpoint pending on" ++# gdb_breakpoint would print a failure because of some warning messages ++gdb_test "break C::C" "Breakpoint $decimal \\(C::C\\) pending." ++ ++#gdb_test "run" "warning: Found more than one location for breakpoint #$decimal; only the first location will be used.(\r\n)+Breakpoint $decimal, C::C.*" ++gdb_test "run" ++ ++gdb_test "info break" " in C::C\\(\\) at .* in C::C\\(int\\) at .*" diff --git a/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch b/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch new file mode 100644 index 0000000..a0eb440 --- /dev/null +++ b/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch @@ -0,0 +1,104 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch + +;; [aarch64] Fix hardware watchpoints (RH BZ 1261564). +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c +@@ -0,0 +1,33 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2016 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++__attribute__((aligned(16))) struct ++{ ++ int var0, var4, var8; ++} aligned; ++ ++int ++main (void) ++{ ++ aligned.var0 = 1; ++ aligned.var4 = 2; ++ aligned.var8 = 3; ++ ++ aligned.var4 = aligned.var0; ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp +@@ -0,0 +1,53 @@ ++# Copyright (C) 2016 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++if { [prepare_for_testing rhbz1261564-aarch64-watchpoint.exp "rhbz1261564-aarch64-watchpoint"] } { ++ return -1 ++} ++ ++if { ! [ runto main ] } then { return 0 } ++ ++set test "rwatch aligned.var4" ++if [istarget "s390*-*-*"] { ++ gdb_test $test {Target does not support this type of hardware watchpoint\.} ++ untested "s390* does not support hw read watchpoint" ++ return ++} ++gdb_test $test "Hardware read watchpoint \[0-9\]+: aligned.var4" ++ ++proc checkvar { address } { ++ global gdb_prompt ++ ++ set test "p &aligned.var$address" ++ gdb_test_multiple $test $test { ++ -re " = \\(int \\*\\) 0x\[0-9a-f\]+$address \r\n$gdb_prompt $" { ++ pass $test ++ } ++ -re "\r\n$gdb_prompt $" { ++ untested "$test (unexpected ELF layout)" ++ return 0 ++ } ++ } ++ return 1 ++} ++if ![checkvar "0"] { return } ++if ![checkvar "4"] { return } ++if ![checkvar "8"] { return } ++ ++# Assumes: PPC_PTRACE_GETHWDBGINFO::data_bp_alignment == 8 ++# 'lwz' does read only 4 bytes but the hw watchpoint is 8 bytes wide. ++setup_xfail "powerpc*-*-*" ++ ++gdb_continue_to_end diff --git a/gdb-rhbz1350436-type-printers-error.patch b/gdb-rhbz1350436-type-printers-error.patch new file mode 100644 index 0000000..3322327 --- /dev/null +++ b/gdb-rhbz1350436-type-printers-error.patch @@ -0,0 +1,83 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-rhbz1350436-type-printers-error.patch + +;; Test 'info type-printers' Python error (RH BZ 1350436). +;;=fedoratest + +Typo in Python support breaks info type-printers command +https://bugzilla.redhat.com/show_bug.cgi?id=1350436 + +[testsuite patch] PR python/17136: 'info type-printers' causes an exception when there are per-objfile printers +https://sourceware.org/ml/gdb-patches/2016-06/msg00455.html + +diff --git a/gdb/testsuite/gdb.python/py-typeprint.cc b/gdb/testsuite/gdb.python/py-typeprint.cc +--- a/gdb/testsuite/gdb.python/py-typeprint.cc ++++ b/gdb/testsuite/gdb.python/py-typeprint.cc +@@ -31,6 +31,12 @@ templ s; + + basic_string bs; + ++class Other ++{ ++}; ++ ++Other ovar; ++ + int main() + { + return 0; +diff --git a/gdb/testsuite/gdb.python/py-typeprint.exp b/gdb/testsuite/gdb.python/py-typeprint.exp +--- a/gdb/testsuite/gdb.python/py-typeprint.exp ++++ b/gdb/testsuite/gdb.python/py-typeprint.exp +@@ -50,3 +50,7 @@ gdb_test_no_output "enable type-printer string" + gdb_test "whatis bs" "string" "whatis with enabled printer" + + gdb_test "whatis s" "templ" ++ ++gdb_test "info type-printers" "Type printers for \[^\r\n\]*/py-typeprint:\r\n *other\r\n.*" \ ++ "info type-printers for other" ++gdb_test "whatis ovar" "type = Another" +diff --git a/gdb/testsuite/gdb.python/py-typeprint.py b/gdb/testsuite/gdb.python/py-typeprint.py +--- a/gdb/testsuite/gdb.python/py-typeprint.py ++++ b/gdb/testsuite/gdb.python/py-typeprint.py +@@ -15,8 +15,7 @@ + + import gdb + +- +-class Recognizer(object): ++class StringRecognizer(object): + def __init__(self): + self.enabled = True + +@@ -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): ++ def __init__(self): ++ self.enabled = True ++ ++ def recognize(self, type_obj): ++ if type_obj.tag == 'Other': ++ return 'Another' ++ return None ++ ++class OtherTypePrinter(object): ++ def __init__(self): ++ self.name = 'other' ++ self.enabled = True ++ ++ def instantiate(self): ++ return OtherRecognizer() ++ ++import gdb.types ++gdb.types.register_type_printer(gdb.objfiles()[0], OtherTypePrinter()) diff --git a/gdb-rhbz1553104-s390x-arch12-test.patch b/gdb-rhbz1553104-s390x-arch12-test.patch new file mode 100644 index 0000000..2cb15e5 --- /dev/null +++ b/gdb-rhbz1553104-s390x-arch12-test.patch @@ -0,0 +1,81 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Jan Kratochvil +Date: Fri, 23 Mar 2018 20:42:44 +0100 +Subject: gdb-rhbz1553104-s390x-arch12-test.patch + +;; [s390x] Backport arch12 instructions decoding (RH BZ 1553104). +;; =fedoratest + +diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.S b/gdb/testsuite/gdb.arch/s390x-arch12.S +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/s390x-arch12.S +@@ -0,0 +1,4 @@ ++.text ++.globl load_guarded ++load_guarded: ++.byte 0xeb,0xbf,0xf0,0x58,0x00,0x24,0xe3,0xf0,0xff,0x50,0xff,0x71,0xb9,0x04,0x00,0xbf,0xe3,0x20,0xb0,0xa0,0x00,0x24,0xe3,0x10,0xb0,0xa0,0x00,0x04,0xe3,0x10,0x10,0x00,0x00,0x4c,0xe3,0x10,0xb0,0xa8,0x00,0x24,0xe3,0x10,0xb0,0xa8,0x00,0x04,0xb9,0x04,0x00,0x21,0xe3,0x40,0xb1,0x20,0x00,0x04,0xeb,0xbf,0xb1,0x08,0x00,0x04,0x07,0xf4 +diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.exp b/gdb/testsuite/gdb.arch/s390x-arch12.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/s390x-arch12.exp +@@ -0,0 +1,34 @@ ++# Copyright 2018 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++#if { ![istarget s390x-*linux-*] || ![is_lp64_target] } { ++# verbose "Skipping s390x-prologue-skip.exp" ++# return ++#} ++ ++set testfile "s390x-arch12" ++set uufile "${srcdir}/${subdir}/${testfile}.o.uu" ++set ofile "${srcdir}/${subdir}/${testfile}.o" ++ ++if { [catch "system \"uudecode -o ${ofile} ${uufile}\"" ] != 0 } { ++ untested "failed uudecode" ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_load $ofile ++ ++gdb_test "disas load_guarded" " <\\+28>:\tlgg\t%r1,0\\(%r1\\)\r\n\[^\r\n\]* <\\+34>:\tstg\t%r1,168\\(%r11\\)\r\n.*" +diff --git a/gdb/testsuite/gdb.arch/s390x-arch12.o.uu b/gdb/testsuite/gdb.arch/s390x-arch12.o.uu +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/s390x-arch12.o.uu +@@ -0,0 +1,20 @@ ++begin 644 s390x-arch12.o ++M?T5,1@("`0`````````````!`!8````!```````````````````````````` ++M``$X``````!```````!```<`!.N_\%@`)./P_U#_<;D$`+_C(+"@`"3C$+"@ ++M``3C$!```$SC$+"H`"3C$+"H``2Y!``AXT"Q(``$Z[^Q"``$!_0`+G-Y;71A ++M8@`N +Date: Mon, 2 Oct 2023 15:05:23 -0700 +Subject: gdb-rhbz1773651-gdb-index-internal-error.patch + +;; Backport upstream patch which prevents internal error when +;; generating a gdb-index file (RH BZ 1773651). + +Throw error when creating an overly large gdb-index file + +The header in a .gdb_index section uses 32-bit unsigned offsets to +refer to other areas of the section. Thus, there is a size limit of +2^32-1 which is currently unaccounted for by GDB's code for outputting +these sections. + +At the moment, when GDB creates an overly large section, it will exit +abnormally due to an internal error, which is caused by a failed +assert in assert_file_size, which in turn is called from +write_gdbindex_1, both of which are in gdb/dwarf2/index-write.c. + +This is what happens when that assert fails: + +$ gdb -q -nx -iex 'set auto-load no' -iex 'set debuginfod enabled off' -ex file ./libgraph_tool_inference.so -ex "save gdb-index `pwd`/" +Reading symbols from ./libgraph_tool_inference.so... +No executable file now. +Discard symbol table from `libgraph_tool_inference.so'? (y or n) n +Not confirmed. +../../gdb/dwarf2/index-write.c:1069: internal-error: assert_file_size: Assertion `file_size == expected_size' failed. +A problem internal to GDB has been detected, +further debugging may prove unreliable. +----- Backtrace ----- +0x55fddb4d78b0 gdb_internal_backtrace_1 + ../../gdb/bt-utils.c:122 +0x55fddb4d78b0 _Z22gdb_internal_backtracev + ../../gdb/bt-utils.c:168 +0x55fddb98b5d4 internal_vproblem + ../../gdb/utils.c:396 +0x55fddb98b8de _Z15internal_verrorPKciS0_P13__va_list_tag + ../../gdb/utils.c:476 +0x55fddbb71654 _Z18internal_error_locPKciS0_z + ../../gdbsupport/errors.cc:58 +0x55fddb5a0f23 assert_file_size + ../../gdb/dwarf2/index-write.c:1069 +0x55fddb5a1ee0 assert_file_size + /usr/include/c++/13/bits/stl_iterator.h:1158 +0x55fddb5a1ee0 write_gdbindex_1 + ../../gdb/dwarf2/index-write.c:1119 +0x55fddb5a51be write_gdbindex + ../../gdb/dwarf2/index-write.c:1273 +[...] +--------------------- +../../gdb/dwarf2/index-write.c:1069: internal-error: assert_file_size: Assertion `file_size == expected_size' failed. + +This problem was encountered while building the python-graph-tool +package on Fedora. The Fedora bugzilla bug can be found here: + +https://bugzilla.redhat.com/show_bug.cgi?id=1773651 + +This commit prevents the internal error from occurring by calling error() +when the file size exceeds 2^32-1. + +Using a gdb built with this commit, I now see this behavior instead: + +$ gdb -q -nx -iex 'set auto-load no' -iex 'set debuginfod enabled off' -ex file ./libgraph_tool_inference.so -ex "save gdb-index `pwd`/" +Reading symbols from ./libgraph_tool_inference.so... +No executable file now. +Discard symbol table from `/mesquite2/fedora-bugs/1773651/libgraph_tool_inference.so'? (y or n) n +Not confirmed. +Error while writing index for `/mesquite2/fedora-bugs/1773651/libgraph_tool_inference.so': gdb-index maximum file size of 4294967295 exceeded +(gdb) + +I wish I could provide a test case, but due to the sizes of both the +input and output files, I think that testing resources would be +strained or exceeded in many environments. + +My testing on Fedora 38 shows no regressions. + +Approved-by: Tom Tromey + +diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c +--- a/gdb/dwarf2/index-write.c ++++ b/gdb/dwarf2/index-write.c +@@ -1082,7 +1082,7 @@ write_gdbindex_1 (FILE *out_file, + { + data_buf contents; + const offset_type size_of_header = 6 * sizeof (offset_type); +- offset_type total_len = size_of_header; ++ size_t total_len = size_of_header; + + /* The version number. */ + contents.append_offset (8); +@@ -1109,6 +1109,13 @@ write_gdbindex_1 (FILE *out_file, + + gdb_assert (contents.size () == size_of_header); + ++ /* The maximum size of an index file is limited by the maximum value ++ capable of being represented by 'offset_type'. Throw an error if ++ that length has been exceeded. */ ++ size_t max_size = ~(offset_type) 0; ++ if (total_len > max_size) ++ error (_("gdb-index maximum file size of %zu exceeded"), max_size); ++ + contents.file_write (out_file); + cu_list.file_write (out_file); + types_cu_list.file_write (out_file); diff --git a/gdb-rhbz2160211-excessive-core-file-warnings.patch b/gdb-rhbz2160211-excessive-core-file-warnings.patch new file mode 100644 index 0000000..a790054 --- /dev/null +++ b/gdb-rhbz2160211-excessive-core-file-warnings.patch @@ -0,0 +1,108 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Thu, 29 Jun 2023 18:20:30 -0700 +Subject: gdb-rhbz2160211-excessive-core-file-warnings.patch + +;; Backport two commits, 0ad504dd464 and ea70f941f9b, from Lancelot SIX +;; which prevent repeated warnings from being printed while loading a +;; core file. (RH BZ 2160211) + +gdb/corelow.c: avoid repeated warnings in build_file_mappings + +When GDB opens a coredump it tries to locate and then open all files +which were mapped in the process. + +If a file is found but cannot be opened with BFD (bfd_open / +bfd_check_format fails), then a warning is printed to the user. If the +same file was mapped multiple times in the process's address space, the +warning is printed once for each time the file was mapped. I find this +un-necessarily noisy. + +This patch makes it so the warning message is printed only once per +file. + +There was a comment in the code assuming that if the file was found on +the system, opening it (bfd_open + bfd_check_format) should always +succeed. A recent change in BFD (014a602b86f "Don't optimise bfd_seek +to same position") showed that this assumption is not valid. For +example, it is possible to have a core dump of a process which had +mmaped an IO page from a DRI render node (/dev/dri/runderD$NUM). In +such case the core dump does contain the information that portions of +this special file were mapped in the host process, but trying to seek to +position 0 will fail, making bfd_check_format fail. This patch removes +this comment. + +Reviewed-By: John Baldwin +Approved-By: Andrew Burgess + +gdb/corelow.c: do not try to reopen a file if open failed once + +In the current implementation, core_target::build_file_mappings will try +to locate and open files which were mapped in the process for which the +core dump was produced. If the file cannot be found or cannot be +opened, GDB will re-try to open it once for each time it was mapped in +the process's address space. + +This patch makes it so GDB recognizes that it has already failed to open +a given file once and does not re-try the process for each mapping. + +Reviewed-By: John Baldwin +Approved-By: Andrew Burgess + +diff --git a/gdb/corelow.c b/gdb/corelow.c +--- a/gdb/corelow.c ++++ b/gdb/corelow.c +@@ -237,6 +237,16 @@ core_target::build_file_mappings () + weed out non-file-backed mappings. */ + gdb_assert (filename != nullptr); + ++ if (unavailable_paths.find (filename) != unavailable_paths.end ()) ++ { ++ /* We have already seen some mapping for FILENAME but failed to ++ find/open the file. There is no point in trying the same ++ thing again so just record that the range [start, end) is ++ unavailable. */ ++ m_core_unavailable_mappings.emplace_back (start, end - start); ++ return; ++ } ++ + struct bfd *bfd = bfd_map[filename]; + if (bfd == nullptr) + { +@@ -254,11 +264,10 @@ core_target::build_file_mappings () + if (expanded_fname == nullptr) + { + m_core_unavailable_mappings.emplace_back (start, end - start); +- /* Print just one warning per path. */ +- if (unavailable_paths.insert (filename).second) +- warning (_("Can't open file %s during file-backed mapping " +- "note processing"), +- filename); ++ unavailable_paths.insert (filename); ++ warning (_("Can't open file %s during file-backed mapping " ++ "note processing"), ++ filename); + return; + } + +@@ -268,18 +277,11 @@ core_target::build_file_mappings () + if (bfd == nullptr || !bfd_check_format (bfd, bfd_object)) + { + m_core_unavailable_mappings.emplace_back (start, end - start); +- /* If we get here, there's a good chance that it's due to +- an internal error. We issue a warning instead of an +- internal error because of the possibility that the +- file was removed in between checking for its +- existence during the expansion in exec_file_find() +- and the calls to bfd_openr() / bfd_check_format(). +- Output both the path from the core file note along +- with its expansion to make debugging this problem +- easier. */ ++ unavailable_paths.insert (filename); + warning (_("Can't open file %s which was expanded to %s " + "during file-backed mapping note processing"), + filename, expanded_fname.get ()); ++ + if (bfd != nullptr) + bfd_close (bfd); + return; diff --git a/gdb-rhbz2192105-ftbs-dangling-pointer b/gdb-rhbz2192105-ftbs-dangling-pointer new file mode 100644 index 0000000..26ced86 --- /dev/null +++ b/gdb-rhbz2192105-ftbs-dangling-pointer @@ -0,0 +1,107 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Kevin Buettner +Date: Wed, 3 May 2023 11:28:24 -0700 +Subject: gdb-rhbz2192105-ftbs-dangling-pointer +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +;; Backport upstream patch fixing a "dangling pointer" build problem +;; first seen when building with GCC 13.1.1 20230426 (Red Hat ;; 13.1.1-1). + +Pass const frame_info_ptr reference for skip_[language_]trampoline + +g++ 13.1.1 produces a -Werror=dangling-pointer= + +In file included from ../../binutils-gdb/gdb/frame.h:75, + from ../../binutils-gdb/gdb/symtab.h:40, + from ../../binutils-gdb/gdb/language.c:33: +In member function ‘void intrusive_list::push_empty(T&) [with T = frame_info_ptr; AsNode = intrusive_base_node]’, + inlined from ‘void intrusive_list::push_back(reference) [with T = frame_info_ptr; AsNode = intrusive_base_node]’ at gdbsupport/intrusive_list.h:332:24, + inlined from ‘frame_info_ptr::frame_info_ptr(const frame_info_ptr&)’ at gdb/frame.h:241:26, + inlined from ‘CORE_ADDR skip_language_trampoline(frame_info_ptr, CORE_ADDR)’ at gdb/language.c:530:49: +gdbsupport/intrusive_list.h:415:12: error: storing the address of local variable ‘’ in ‘frame_info_ptr::frame_list.intrusive_list::m_back’ [-Werror=dangling-pointer=] + 415 | m_back = &elem; + | ~~~~~~~^~~~~~~ +gdb/language.c: In function ‘CORE_ADDR skip_language_trampoline(frame_info_ptr, CORE_ADDR)’: +gdb/language.c:530:49: note: ‘’ declared here + 530 | CORE_ADDR real_pc = lang->skip_trampoline (frame, pc); + | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ +gdb/frame.h:359:41: note: ‘frame_info_ptr::frame_list’ declared here + 359 | static intrusive_list frame_list; + | ^~~~~~~~~~ + +Each new frame_info_ptr is being pushed on a static frame list and g++ +cannot see why that is safe in case the frame_info_ptr is created and +destroyed immediately when passed as value. + +It isn't clear why only in this one place g++ sees the issue (probably +because it can inline enough code in this specific case). + +Since passing the frame_info_ptr as const reference is cheaper, use +that as workaround for this warning. + +PR build/30413 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30413 + +Tested-by: Kevin Buettner +Reviewed-by: Kevin Buettner +Reviewed-by: Tom Tromey + +diff --git a/gdb/c-lang.c b/gdb/c-lang.c +--- a/gdb/c-lang.c ++++ b/gdb/c-lang.c +@@ -1003,7 +1003,7 @@ class cplus_language : public language_defn + + /* See language.h. */ + +- CORE_ADDR skip_trampoline (frame_info_ptr fi, ++ CORE_ADDR skip_trampoline (const frame_info_ptr &fi, + CORE_ADDR pc) const override + { + return cplus_skip_trampoline (fi, pc); +diff --git a/gdb/language.c b/gdb/language.c +--- a/gdb/language.c ++++ b/gdb/language.c +@@ -528,7 +528,7 @@ add_set_language_command () + Return the result from the first that returns non-zero, or 0 if all + `fail'. */ + CORE_ADDR +-skip_language_trampoline (frame_info_ptr frame, CORE_ADDR pc) ++skip_language_trampoline (const frame_info_ptr &frame, CORE_ADDR pc) + { + for (const auto &lang : language_defn::languages) + { +diff --git a/gdb/language.h b/gdb/language.h +--- a/gdb/language.h ++++ b/gdb/language.h +@@ -471,7 +471,7 @@ struct language_defn + If that PC falls in a trampoline belonging to this language, return + the address of the first pc in the real function, or 0 if it isn't a + language tramp for this language. */ +- virtual CORE_ADDR skip_trampoline (frame_info_ptr fi, CORE_ADDR pc) const ++ virtual CORE_ADDR skip_trampoline (const frame_info_ptr &fi, CORE_ADDR pc) const + { + return (CORE_ADDR) 0; + } +@@ -789,7 +789,7 @@ extern const char *language_str (enum language); + + /* Check for a language-specific trampoline. */ + +-extern CORE_ADDR skip_language_trampoline (frame_info_ptr, CORE_ADDR pc); ++extern CORE_ADDR skip_language_trampoline (const frame_info_ptr &, CORE_ADDR pc); + + /* Return demangled language symbol, or NULL. */ + extern gdb::unique_xmalloc_ptr language_demangle +diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c +--- a/gdb/objc-lang.c ++++ b/gdb/objc-lang.c +@@ -282,7 +282,7 @@ class objc_language : public language_defn + + /* See language.h. */ + +- CORE_ADDR skip_trampoline (frame_info_ptr frame, ++ CORE_ADDR skip_trampoline (const frame_info_ptr &frame, + CORE_ADDR stop_pc) const override + { + struct gdbarch *gdbarch = get_frame_arch (frame); diff --git a/gdb-rhbz2196395-debuginfod-legacy-openssl-crash.patch b/gdb-rhbz2196395-debuginfod-legacy-openssl-crash.patch new file mode 100644 index 0000000..a7d14c2 --- /dev/null +++ b/gdb-rhbz2196395-debuginfod-legacy-openssl-crash.patch @@ -0,0 +1,188 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Andrew Burgess +Date: Tue, 20 Jun 2023 09:46:35 +0100 +Subject: gdb-rhbz2196395-debuginfod-legacy-openssl-crash.patch + +;; Backport upstream commit f3eee5861743d635 to fix a crash triggered +;; when debuginfod makes use of particular openssl settings. + +gdb/debuginfod: cleanup debuginfod earlier + +A GDB crash was discovered on Fedora GDB that was tracked back to an +issue with the way that debuginfod is cleaned up. + +The bug was reported on Fedora 37, 38, and 39. Here are the steps to +reproduce: + +1. The file /etc/ssl/openssl.cnf contains the following lines: + + [provider_sect] + default = default_sect + ##legacy = legacy_sect + ## + [default_sect] + activate = 1 + + ##[legacy_sect] + ##activate = 1 + + The bug will occur when the '##' characters are removed so that the + lines in question look like this: + + [provider_sect] + default = default_sect + legacy = legacy_sect + + [default_sect] + activate = 1 + + [legacy_sect] + activate = 1 + +2. Clean up any existing debuginfod cache data: + + > rm -rf $HOME/.cache/debuginfod_client + +3. Run GDB: + + > gdb -nx -q -iex 'set trace-commands on' \ + -iex 'set debuginfod enabled on' \ + -iex 'set confirm off' \ + -ex 'start' -ex 'quit' /bin/ls + +set debuginfod enabled on + +set confirm off + Reading symbols from /bin/ls... + Downloading separate debug info for /usr/bin/ls + ... snip ... + Temporary breakpoint 1, main (argc=1, argv=0x7fffffffde38) at ../src/ls.c:1646 + 1646 { + +quit + + Fatal signal: Segmentation fault + ----- Backtrace ----- + ... snip ... + +So GDB ends up crashing during exit. + +What's happening is that when debuginfod is initialised +debuginfod_begin is called (this is in the debuginfod library), this +in turn sets up libcurl, which makes use of openssl. Somewhere during +this setup process an at_exit function is registered to cleanup some +state. + +Back in GDB the debuginfod_client object is managed using this code: + + /* Deleter for a debuginfod_client. */ + + struct debuginfod_client_deleter + { + void operator() (debuginfod_client *c) + { + debuginfod_end (c); + } + }; + + using debuginfod_client_up + = std::unique_ptr; + +And then a global debuginfod_client_up is created to hold a pointer to +the debuginfod_client object. As a global this will be cleaned up +using the standard C++ global object destructor mechanism, which is +run after the at_exit handlers. + +However, it is expected that when debuginfod_end is called the +debuginfod_client object will still be in a usable state, that is, we +don't expect the at_exit handlers to have run and started cleaning up +the library state. + +To fix this issue we need to ensure that debuginfod_end is called +before the at_exit handlers have a chance to run. + +This commit removes the debuginfod_client_up type, and instead has GDB +hold a raw pointer to the debuginfod_client object. We then make use +of GDB's make_final_cleanup to register a function that will call +debuginfod_end. + +As GDB's final cleanups are called before exit is called, this means +that debuginfod_end will be called before the at_exit handlers are +called, and the crash identified above is resolved. + +It's not obvious how this issue can easily be tested for. The bug does +not appear to manifest when using a local debuginfod server, so we'd +need to setup something more involved. For now I'm proposing this +patch without any associated tests. + +diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c +--- a/gdb/debuginfod-support.c ++++ b/gdb/debuginfod-support.c +@@ -96,20 +96,6 @@ struct user_data + ui_out::progress_update progress; + }; + +-/* Deleter for a debuginfod_client. */ +- +-struct debuginfod_client_deleter +-{ +- void operator() (debuginfod_client *c) +- { +- debuginfod_end (c); +- } +-}; +- +-using debuginfod_client_up +- = std::unique_ptr; +- +- + /* Convert SIZE into a unit suitable for use with progress updates. + SIZE should in given in bytes and will be converted into KB, MB, GB + or remain unchanged. UNIT will be set to "B", "KB", "MB" or "GB" +@@ -180,20 +166,45 @@ progressfn (debuginfod_client *c, long cur, long total) + return 0; + } + ++/* Cleanup ARG, which is a debuginfod_client pointer. */ ++ ++static void ++cleanup_debuginfod_client (void *arg) ++{ ++ debuginfod_client *client = static_cast (arg); ++ debuginfod_end (client); ++} ++ ++/* Return a pointer to the single global debuginfod_client, initialising it ++ first if needed. */ ++ + static debuginfod_client * + get_debuginfod_client () + { +- static debuginfod_client_up global_client; ++ static debuginfod_client *global_client = nullptr; + + if (global_client == nullptr) + { +- global_client.reset (debuginfod_begin ()); ++ global_client = debuginfod_begin (); + + if (global_client != nullptr) +- debuginfod_set_progressfn (global_client.get (), progressfn); ++ { ++ /* It is important that we cleanup the debuginfod_client object ++ before calling exit. Some of the libraries used by debuginfod ++ make use of at_exit handlers to perform cleanup. ++ ++ If we wrapped the debuginfod_client in a unique_ptr and relied ++ on its destructor to cleanup then this would be run as part of ++ the global C++ object destructors, which is after the at_exit ++ handlers, which is too late. ++ ++ So instead, we make use of GDB's final cleanup mechanism. */ ++ make_final_cleanup (cleanup_debuginfod_client, global_client); ++ debuginfod_set_progressfn (global_client, progressfn); ++ } + } + +- return global_client.get (); ++ return global_client; + } + + /* Check if debuginfod is enabled. If configured to do so, ask the user diff --git a/gdb-rhbz2233961-CVE-2022-4806.patch b/gdb-rhbz2233961-CVE-2022-4806.patch new file mode 100644 index 0000000..4ce3cc2 --- /dev/null +++ b/gdb-rhbz2233961-CVE-2022-4806.patch @@ -0,0 +1,50 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= +Date: Thu, 21 Sep 2023 18:52:49 +0200 +Subject: gdb-rhbz2233961-CVE-2022-4806.patch + +;; Backport PR29922, SHT_NOBITS section +;; avoids section size sanity check. + +PR29922, SHT_NOBITS section avoids section size sanity check + +PR 29922 +* dwarf2.c (find_debug_info): Ignore sections without +SEC_HAS_CONTENTS. + +diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c +--- a/bfd/dwarf2.c ++++ b/bfd/dwarf2.c +@@ -4831,16 +4831,19 @@ find_debug_info (bfd *abfd, const struct dwarf_debug_section *debug_sections, + { + look = debug_sections[debug_info].uncompressed_name; + msec = bfd_get_section_by_name (abfd, look); +- if (msec != NULL) ++ /* Testing SEC_HAS_CONTENTS is an anti-fuzzer measure. Of ++ course debug sections always have contents. */ ++ if (msec != NULL && (msec->flags & SEC_HAS_CONTENTS) != 0) + return msec; + + look = debug_sections[debug_info].compressed_name; + msec = bfd_get_section_by_name (abfd, look); +- if (msec != NULL) ++ if (msec != NULL && (msec->flags & SEC_HAS_CONTENTS) != 0) + return msec; + + for (msec = abfd->sections; msec != NULL; msec = msec->next) +- if (startswith (msec->name, GNU_LINKONCE_INFO)) ++ if ((msec->flags & SEC_HAS_CONTENTS) != 0 ++ && startswith (msec->name, GNU_LINKONCE_INFO)) + return msec; + + return NULL; +@@ -4848,6 +4851,9 @@ find_debug_info (bfd *abfd, const struct dwarf_debug_section *debug_sections, + + for (msec = after_sec->next; msec != NULL; msec = msec->next) + { ++ if ((msec->flags & SEC_HAS_CONTENTS) == 0) ++ continue; ++ + look = debug_sections[debug_info].uncompressed_name; + if (strcmp (msec->name, look) == 0) + return msec; diff --git a/gdb-rhbz2233965-memory-leak.patch b/gdb-rhbz2233965-memory-leak.patch new file mode 100644 index 0000000..7c49795 --- /dev/null +++ b/gdb-rhbz2233965-memory-leak.patch @@ -0,0 +1,115 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alexandra=20H=C3=A1jkov=C3=A1?= +Date: Sat, 14 Oct 2023 12:37:50 +0200 +Subject: gdb-rhbz2233965-memory-leak.patch + +;; Backport PR29925, Memory leak in find_abstract_instance + +PR29925, Memory leak in find_abstract_instance + +The testcase in the PR had a variable with both DW_AT_decl_file and +DW_AT_specification, where the DW_AT_specification also specified +DW_AT_decl_file. This leads to a memory leak as the file name is +malloced and duplicates are not expected. + +I've also changed find_abstract_instance to not use a temp for "name", +because that can result in a change in behaviour from the usual last +of duplicate attributes wins. + + PR 29925 + * dwarf2.c (find_abstract_instance): Delete "name" variable. + Free *filename_ptr before assigning new file name. + (scan_unit_for_symbols): Similarly free func->file and + var->file before assigning. + +diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c +--- a/bfd/dwarf2.c ++++ b/bfd/dwarf2.c +@@ -3441,7 +3441,6 @@ find_abstract_instance (struct comp_unit *unit, + struct abbrev_info *abbrev; + uint64_t die_ref = attr_ptr->u.val; + struct attribute attr; +- const char *name = NULL; + + if (recur_count == 100) + { +@@ -3602,9 +3601,9 @@ find_abstract_instance (struct comp_unit *unit, + case DW_AT_name: + /* Prefer DW_AT_MIPS_linkage_name or DW_AT_linkage_name + over DW_AT_name. */ +- if (name == NULL && is_str_form (&attr)) ++ if (*pname == NULL && is_str_form (&attr)) + { +- name = attr.u.str; ++ *pname = attr.u.str; + if (mangle_style (unit->lang) == 0) + *is_linkage = true; + } +@@ -3612,7 +3611,7 @@ find_abstract_instance (struct comp_unit *unit, + case DW_AT_specification: + if (is_int_form (&attr) + && !find_abstract_instance (unit, &attr, recur_count + 1, +- &name, is_linkage, ++ pname, is_linkage, + filename_ptr, linenumber_ptr)) + return false; + break; +@@ -3622,7 +3621,7 @@ find_abstract_instance (struct comp_unit *unit, + non-string forms into these attributes. */ + if (is_str_form (&attr)) + { +- name = attr.u.str; ++ *pname = attr.u.str; + *is_linkage = true; + } + break; +@@ -3630,8 +3629,11 @@ find_abstract_instance (struct comp_unit *unit, + if (!comp_unit_maybe_decode_line_info (unit)) + return false; + if (is_int_form (&attr)) +- *filename_ptr = concat_filename (unit->line_table, +- attr.u.val); ++ { ++ free (*filename_ptr); ++ *filename_ptr = concat_filename (unit->line_table, ++ attr.u.val); ++ } + break; + case DW_AT_decl_line: + if (is_int_form (&attr)) +@@ -3643,7 +3645,6 @@ find_abstract_instance (struct comp_unit *unit, + } + } + } +- *pname = name; + return true; + } + +@@ -4139,8 +4140,11 @@ scan_unit_for_symbols (struct comp_unit *unit) + + case DW_AT_decl_file: + if (is_int_form (&attr)) +- func->file = concat_filename (unit->line_table, +- attr.u.val); ++ { ++ free (func->file); ++ func->file = concat_filename (unit->line_table, ++ attr.u.val); ++ } + break; + + case DW_AT_decl_line: +@@ -4182,8 +4186,11 @@ scan_unit_for_symbols (struct comp_unit *unit) + + case DW_AT_decl_file: + if (is_int_form (&attr)) +- var->file = concat_filename (unit->line_table, +- attr.u.val); ++ { ++ free (var->file); ++ var->file = concat_filename (unit->line_table, ++ attr.u.val); ++ } + break; + + case DW_AT_decl_line: diff --git a/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch b/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch new file mode 100644 index 0000000..0df5ee5 --- /dev/null +++ b/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch @@ -0,0 +1,147 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch + +;; Import regression test for `gdb/findvar.c:417: internal-error: +;; read_var_value: Assertion `frame' failed.' (RH BZ 947564) from RHEL 6.5. +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.threads/tls-rhbz947564.cc b/gdb/testsuite/gdb.threads/tls-rhbz947564.cc +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/tls-rhbz947564.cc +@@ -0,0 +1,53 @@ ++#include ++#include ++ ++class x ++ { ++ public: ++ int n; ++ ++ x() : n(0) {} ++ }; ++ ++class y ++ { ++ public: ++ int v; ++ ++ y() : v(0) {} ++ static __thread x *xp; ++ }; ++ ++__thread x *y::xp; ++ ++static void ++foo (y *yp) ++{ ++ yp->v = 1; /* foo_marker */ ++} ++ ++static void * ++bar (void *unused) ++{ ++ x xinst; ++ y::xp= &xinst; ++ ++ y yy; ++ foo(&yy); ++ ++ return NULL; ++} ++ ++int ++main(int argc, char *argv[]) ++{ ++ pthread_t t[2]; ++ ++ pthread_create (&t[0], NULL, bar, NULL); ++ pthread_create (&t[1], NULL, bar, NULL); ++ ++ pthread_join (t[0], NULL); ++ pthread_join (t[1], NULL); ++ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.threads/tls-rhbz947564.exp b/gdb/testsuite/gdb.threads/tls-rhbz947564.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/tls-rhbz947564.exp +@@ -0,0 +1,75 @@ ++# Copyright (C) 2013 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . */ ++ ++set testfile tls-rhbz947564 ++set srcfile ${testfile}.cc ++set binfile [standard_output_file ${testfile}] ++ ++if [istarget "*-*-linux"] then { ++ set target_cflags "-D_MIT_POSIX_THREADS" ++} else { ++ set target_cflags "" ++} ++ ++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list c++ debug]] != "" } { ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++ ++gdb_load ${binfile} ++ ++if { ![runto_main] } { ++ fail "Can't run to function main" ++ return 0 ++} ++ ++gdb_breakpoint "foo" ++gdb_continue_to_breakpoint "foo" ".* foo_marker .*" ++ ++proc get_xp_val {try} { ++ global expect_out ++ global gdb_prompt ++ global hex ++ ++ set xp_val "" ++ gdb_test_multiple "print *yp" "print yp value" { ++ -re { = \{v = 0, static xp = (0x[0-9a-f]+)\}.* } { ++ pass "print $try value of *yp" ++ set xp_val $expect_out(1,string) ++ } ++ -re "$gdb_prompt $" { ++ fail "print $try value of *yp" ++ } ++ timeout { ++ fail "print $try value of *yp (timeout)" ++ } ++ } ++ return $xp_val ++} ++ ++set first_run [get_xp_val "first"] ++ ++gdb_test "continue" "Breakpoint \[0-9\]+, foo \\\(yp=$hex\\\) at.*" ++ ++set second_run [get_xp_val "second"] ++ ++if { $first_run != $second_run } { ++ pass "different values for TLS variable" ++} else { ++ fail "different values for TLS variable" ++} diff --git a/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch b/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch new file mode 100644 index 0000000..b130d1f --- /dev/null +++ b/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch @@ -0,0 +1,731 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch + +;; Include testcase for `Unable to see a variable inside a module (XLF)' (BZ 823789). +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.fortran/xlf-variable.S b/gdb/testsuite/gdb.fortran/xlf-variable.S +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/xlf-variable.S +@@ -0,0 +1,638 @@ ++/* Copyright (C) 2012 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* This file has been generated from the file named `xlf-variable.f', which ++ should be present in this directory. The command used to generate this ++ file was: ++ ++ xlf -qnoopt -g9 -S xlf-variable.f -o xlf-variable.S ++ ++ After issuing this command, you must hand-edit this file and remove the ++ mentions for `_xlfExit', since it is only present in XLF-specific ++ libraries. You must also make sure to remove the file named `mod1.mod' ++ which will be created in the compilation directory. ++ ++ In order to generated this file, the following XLF package was used: ++ ++ xlf.14.1.0.0.linux.eval.tar.gz ++ ++ These instructions may be different for different versions of the XLF ++ compiler. */ ++ ++.set r0,0; .set SP,1; .set RTOC,2; .set r3,3; .set r4,4 ++.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 ++.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 ++.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 ++.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 ++.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 ++.set r30,30; .set r31,31 ++.set fp0,0; .set fp1,1; .set fp2,2; .set fp3,3; .set fp4,4 ++.set fp5,5; .set fp6,6; .set fp7,7; .set fp8,8; .set fp9,9 ++.set fp10,10; .set fp11,11; .set fp12,12; .set fp13,13; .set fp14,14 ++.set fp15,15; .set fp16,16; .set fp17,17; .set fp18,18; .set fp19,19 ++.set fp20,20; .set fp21,21; .set fp22,22; .set fp23,23; .set fp24,24 ++.set fp25,25; .set fp26,26; .set fp27,27; .set fp28,28; .set fp29,29 ++.set fp30,30; .set fp31,31 ++.set v0,0; .set v1,1; .set v2,2; .set v3,3; .set v4,4 ++.set v5,5; .set v6,6; .set v7,7; .set v8,8; .set v9,9 ++.set v10,10; .set v11,11; .set v12,12; .set v13,13; .set v14,14 ++.set v15,15; .set v16,16; .set v17,17; .set v18,18; .set v19,19 ++.set v20,20; .set v21,21; .set v22,22; .set v23,23; .set v24,24 ++.set v25,25; .set v26,26; .set v27,27; .set v28,28; .set v29,29 ++.set v30,30; .set v31,31 ++.set q0,0; .set q1,1; .set q2,2; .set q3,3; .set q4,4 ++.set q5,5; .set q6,6; .set q7,7; .set q8,8; .set q9,9 ++.set q10,10; .set q11,11; .set q12,12; .set q13,13; .set q14,14 ++.set q15,15; .set q16,16; .set q17,17; .set q18,18; .set q19,19 ++.set q20,20; .set q21,21; .set q22,22; .set q23,23; .set q24,24 ++.set q25,25; .set q26,26; .set q27,27; .set q28,28; .set q29,29 ++.set q30,30; .set q31,31 ++.set MQ,0; .set XER,1; .set FROM_RTCU,4; .set FROM_RTCL,5; .set FROM_DEC,6 ++.set LR,8; .set CTR,9; .set TID,17; .set DSISR,18; .set DAR,19; .set TO_RTCU,20 ++.set TO_RTCL,21; .set TO_DEC,22; .set SDR_0,24; .set SDR_1,25; .set SRR_0,26 ++.set SRR_1,27 ++.set BO_dCTR_NZERO_AND_NOT,0; .set BO_dCTR_NZERO_AND_NOT_1,1 ++.set BO_dCTR_ZERO_AND_NOT,2; .set BO_dCTR_ZERO_AND_NOT_1,3 ++.set BO_IF_NOT,4; .set BO_IF_NOT_1,5; .set BO_IF_NOT_2,6 ++.set BO_IF_NOT_3,7; .set BO_dCTR_NZERO_AND,8; .set BO_dCTR_NZERO_AND_1,9 ++.set BO_dCTR_ZERO_AND,10; .set BO_dCTR_ZERO_AND_1,11; .set BO_IF,12 ++.set BO_IF_1,13; .set BO_IF_2,14; .set BO_IF_3,15; .set BO_dCTR_NZERO,16 ++.set BO_dCTR_NZERO_1,17; .set BO_dCTR_ZERO,18; .set BO_dCTR_ZERO_1,19 ++.set BO_ALWAYS,20; .set BO_ALWAYS_1,21; .set BO_ALWAYS_2,22 ++.set BO_ALWAYS_3,23; .set BO_dCTR_NZERO_8,24; .set BO_dCTR_NZERO_9,25 ++.set BO_dCTR_ZERO_8,26; .set BO_dCTR_ZERO_9,27; .set BO_ALWAYS_8,28 ++.set BO_ALWAYS_9,29; .set BO_ALWAYS_10,30; .set BO_ALWAYS_11,31 ++.set CR0_LT,0; .set CR0_GT,1; .set CR0_EQ,2; .set CR0_SO,3 ++.set CR1_FX,4; .set CR1_FEX,5; .set CR1_VX,6; .set CR1_OX,7 ++.set CR2_LT,8; .set CR2_GT,9; .set CR2_EQ,10; .set CR2_SO,11 ++.set CR3_LT,12; .set CR3_GT,13; .set CR3_EQ,14; .set CR3_SO,15 ++.set CR4_LT,16; .set CR4_GT,17; .set CR4_EQ,18; .set CR4_SO,19 ++.set CR5_LT,20; .set CR5_GT,21; .set CR5_EQ,22; .set CR5_SO,23 ++.set CR6_LT,24; .set CR6_GT,25; .set CR6_EQ,26; .set CR6_SO,27 ++.set CR7_LT,28; .set CR7_GT,29; .set CR7_EQ,30; .set CR7_SO,31 ++.set TO_LT,16; .set TO_GT,8; .set TO_EQ,4; .set TO_LLT,2; .set TO_LGT,1 ++ ++ .file "xlf-variable.f" ++ .globl __mod1_NMOD_____mod1 ++ .type __mod1_NMOD_____mod1,@function ++ .size __mod1_NMOD_____mod1,32 ++ .globl main ++ .type main,@function ++ .size main,68 ++ .globl __mod1_NMOD_sub1 ++ .type __mod1_NMOD_sub1,@function ++ .size __mod1_NMOD_sub1,136 ++ .globl _main ++ .type _main,@function ++ .size _main,68 ++ ++ .section ".text" ++ .align 7 ++.LC.text: ++__mod1_NMOD_____mod1: ++ stwu SP,-32(SP) ++ stw r31,28(SP) ++ or r31,SP,SP ++ b $+0x4 ++ addi r11,r31,32 ++ lwz r31,-4(r11) ++ or SP,r11,r11 ++ bclr BO_ALWAYS,CR0_LT ++.LC.text32: ++ ++__mod1_NMOD_sub1: ++ stwu SP,-32(SP) ++ stw r31,28(SP) ++ stw r30,24(SP) ++ or r31,SP,SP ++ addis r30,r0,.const_dr@ha ++ addi r30,r30,.const_dr@l ++ addis r3,r0,__N_mod1@ha ++ addi r3,r3,__N_mod1@l ++ addi r0,r0,1 ++ stb r0,4(r3) ++ addi r4,r0,14 ++ stb r4,5(r3) ++ stb r0,7(r3) ++ addis r5,r0,__N__mod1@ha ++ addi r5,r5,__N__mod1@l ++ stw r5,0(r3) ++ lbz r5,6(r3) ++ rlwinm r5,r5,0,25,25 ++ ori r5,r5,0x0040 ++ stb r5,6(r3) ++ lwz r5,0(r3) ++ lfs fp0,0(r30) ++ stfs fp0,0(r5) ++ stb r0,4(r3) ++ stb r4,5(r3) ++ addi r4,r0,0 ++ stb r4,6(r3) ++ stb r0,7(r3) ++ b $+0x4 ++ addi r11,r31,32 ++ lwz r30,-8(r11) ++ lwz r31,-4(r11) ++ or SP,r11,r11 ++ bclr BO_ALWAYS,CR0_LT ++.LC.text168: ++ .long 0 ++ .skip 0x54 ++.LC.text256: ++ ++main: ++_main: ++ mfspr r0,LR ++ stwu SP,-32(SP) ++ stw r31,28(SP) ++ stw r0,36(SP) ++ or r31,SP,SP ++ bl __mod1_NMOD_sub1 ++ addi r3,r0,0 ++.LC.text288: ++ ++ tw TO_EQ,r14,r14 ++ addi r3,r0,0 ++ b $+0x4 ++ addi r11,r31,32 ++ lwz r31,-4(r11) ++ lwz r0,4(r11) ++ mtspr LR,r0 ++ or SP,r11,r11 ++ bclr BO_ALWAYS,CR0_LT ++.LC.text324: ++ ++ ++ .section ".rodata","a" ++ .align 2 ++.LC.rodata: ++ .type .const_dr,@object ++ .size .const_dr,4 ++.const_dr: ++ .long 0x40400000 ++ ++ .section ".eh_frame","wa" ++ .align 2 ++.LC.eh_frame: ++ .long 0x0000000c ++ .long 0x00000000 ++ .long 0x0100047c ++ .long 0x410c0100 ++ .long 0x0000001c ++ .long 0x00000014 ++ .long .LC.text ++ .long 0x00000020 ++ .long 0x410e2041 ++ .long 0x9f01410d ++ .long 0x1f410a42 ++ .long 0xdf420b00 ++ .long 0x00000020 ++ .long 0x00000034 ++ .long .LC.text32 ++ .long 0x00000088 ++ .long 0x410e2041 ++ .long 0x9f01419e ++ .long 0x02410d1f ++ .long 0x590a42de ++ .long 0x41df420b ++ .long 0x0000000c ++ .long 0x00000000 ++ .long 0x0100047c ++ .long 0x410c0100 ++ .long 0x00000020 ++ .long 0x00000014 ++ .long .LC.text256 ++ .long 0x00000044 ++ .long 0x420e2041 ++ .long 0x9f014111 ++ .long 0x417f410d ++ .long 0x1f460a42 ++ .long 0xdf440b00 ++ ++ .section ".data","wa" ++ .align 4 ++.LC.data: ++ .globl __N_mod1 ++ .type __N_mod1,@object ++ .size __N_mod1,8 ++__N_mod1: ++ .long 0x00000000 ++ .long 0x01000001 ++ ++ .section ".except.1","wa" ++ .align 1 ++.LC.except.1: ++ .long .LC.text288 ++ .byte 0x01 ++ .byte 0x09 ++ ++ .ident "Fri Jun 15 16:35:45 2012 .IBM XL Fortran for Linux, V14.1 (5765-J05, 5725-C75) Version 14.01.0000.0000.Fri Jun 15 16:35:45 2012 .IBM XL Fortran for Linux, V14.1 (5765-J05, 5725-C75) Version 14.01.0000.0000." ++ ++ .section ".debug_aranges" ++ .align 0 ++.LC.debug_aranges: ++ .long 0x0000001c ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_info ++ .long 0x04000000 ++ .byte 0x00 ++ .byte 0x00 ++ .long .LC.text ++ .long 0x000000a8 ++ .long 0x00000000 ++ .long 0x00000000 ++ .long 0x0000001c ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_info273 ++ .long 0x04000000 ++ .byte 0x00 ++ .byte 0x00 ++ .long .LC.text256 ++ .long 0x00000044 ++ .long 0x00000000 ++ .long 0x00000000 ++ ++ .section ".debug_pubnames" ++ .align 0 ++.LC.debug_pubnames: ++ .long 0x0000002f ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_info ++ .long 0x00000111 ++ .long 0x000000dc ++ .long 0x79000000 ++ .long 0x00ec7a00 ++ .long 0x000000fc ++ .long 0x5f5f6d6f ++ .long 0x64315f4e ++ .long 0x4d4f445f ++ .long 0x73756231 ++ .long 0x00000000 ++ .long 0x00000000 ++ .byte 0x18 ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_info273 ++ .long 0x00000127 ++ .long 0x0000010f ++ .long 0x5f6d6169 ++ .long 0x6e000000 ++ .byte 0x00 ++ .byte 0x00 ++ ++ .section ".debug_info" ++ .align 0 ++.LC.debug_info: ++ .long 0x0000010d ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_abbrev ++ .long 0x0401786c ++ .long 0x662d7661 ++ .long 0x72696162 ++ .long 0x6c652e66 ++ .byte 0x00 ++ .long .LC.debug_line ++ .long .LC.text ++ .long .LC.text168 ++ .long 0x082f726f ++ .long 0x6f742f73 ++ .long 0x65726769 ++ .long 0x6f646a2f ++ .long 0x6764622d ++ .long 0x372e302e ++ .long 0x312d3432 ++ .long 0x2e656c35 ++ .long 0x2f676462 ++ .long 0x2d372e30 ++ .long 0x2e312f67 ++ .long 0x64622f74 ++ .long 0x65737473 ++ .long 0x75697465 ++ .long 0x2f676462 ++ .long 0x2e666f72 ++ .long 0x7472616e ++ .long 0x0049424d ++ .long 0x20584c20 ++ .long 0x466f7274 ++ .long 0x72616e20 ++ .long 0x666f7220 ++ .long 0x4c696e75 ++ .long 0x782c2056 ++ .long 0x31342e31 ++ .long 0x20283537 ++ .long 0x36352d4a ++ .long 0x30352c20 ++ .long 0x35373235 ++ .long 0x2d433735 ++ .long 0x29205665 ++ .long 0x7273696f ++ .long 0x6e203134 ++ .long 0x2e30312e ++ .long 0x30303030 ++ .long 0x2e303030 ++ .long 0x30000249 ++ .long 0x4e544547 ++ .long 0x45520004 ++ .long 0x05030005 ++ .long 0x02524541 ++ .long 0x4c000404 ++ .long 0x04050000 ++ .long 0x0000c706 ++ .long 0x6d6f6431 ++ .long 0x00070503 ++ .long __N_mod1 ++ .long 0x79000100 ++ .long 0x01000000 ++ .long 0xd0070503 ++ .long __N__mod1 ++ .long 0x7a000100 ++ .long 0x01000000 ++ .long 0xc7087375 ++ .byte 0x62 ++ .byte 0x31 ++ .byte 0x00 ++ .long .LC.text32 ++ .long .LC.text168 ++ .long 0x01180101 ++ .byte 0x6f ++ .byte 0x00 ++ .byte 0x00 ++.LC.debug_info273: ++ .long 0x00000123 ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_abbrev97 ++ .long 0x0401786c ++ .long 0x662d7661 ++ .long 0x72696162 ++ .long 0x6c652e66 ++ .byte 0x00 ++ .long .LC.debug_line98 ++ .long .LC.text256 ++ .long .LC.text324 ++ .long 0x082f726f ++ .long 0x6f742f73 ++ .long 0x65726769 ++ .long 0x6f646a2f ++ .long 0x6764622d ++ .long 0x372e302e ++ .long 0x312d3432 ++ .long 0x2e656c35 ++ .long 0x2f676462 ++ .long 0x2d372e30 ++ .long 0x2e312f67 ++ .long 0x64622f74 ++ .long 0x65737473 ++ .long 0x75697465 ++ .long 0x2f676462 ++ .long 0x2e666f72 ++ .long 0x7472616e ++ .long 0x0049424d ++ .long 0x20584c20 ++ .long 0x466f7274 ++ .long 0x72616e20 ++ .long 0x666f7220 ++ .long 0x4c696e75 ++ .long 0x782c2056 ++ .long 0x31342e31 ++ .long 0x20283537 ++ .long 0x36352d4a ++ .long 0x30352c20 ++ .long 0x35373235 ++ .long 0x2d433735 ++ .long 0x29205665 ++ .long 0x7273696f ++ .long 0x6e203134 ++ .long 0x2e30312e ++ .long 0x30303030 ++ .long 0x2e303030 ++ .long 0x30000249 ++ .long 0x4e544547 ++ .long 0x45520004 ++ .long 0x05030005 ++ .long 0x02524541 ++ .long 0x4c000404 ++ .long 0x04000000 ++ .long 0xb9050000 ++ .long 0x0000c706 ++ .long 0x000000f4 ++ .long 0x26264e26 ++ .long 0x6d6f6431 ++ .long 0x00080779 ++ .long 0x00022300 ++ .long 0x000000d4 ++ .long 0x00060000 ++ .long 0x010f2626 ++ .long 0x4e26266d ++ .long 0x6f643100 ++ .long 0x04077a00 ++ .long 0x02230000 ++ .long 0x0000c700 ++ .long 0x085f6d61 ++ .byte 0x69 ++ .byte 0x6e ++ .byte 0x00 ++ .long .LC.text256 ++ .long .LC.text324 ++ .long 0x0201016f ++ .long 0x000000b9 ++ .byte 0x00 ++ ++ .section ".debug_abbrev" ++ .align 0 ++.LC.debug_abbrev: ++ .long 0x01110103 ++ .long 0x08100611 ++ .long 0x01120113 ++ .long 0x0b1b0825 ++ .long 0x08000002 ++ .long 0x24000308 ++ .long 0x0b0b3e0b ++ .long 0x00000324 ++ .long 0x000b0b3e ++ .long 0x0b000004 ++ .long 0x15000000 ++ .long 0x050f0033 ++ .long 0x0b491300 ++ .long 0x00061e01 ++ .long 0x03080000 ++ .long 0x07340002 ++ .long 0x0a03083a ++ .long 0x0b3b0b3f ++ .long 0x0c491300 ++ .long 0x00082e00 ++ .long 0x03081101 ++ .long 0x12013a0b ++ .long 0x3b0b3f0c ++ .long 0x400a0000 ++ .byte 0x00 ++.LC.debug_abbrev97: ++ .long 0x01110103 ++ .long 0x08100611 ++ .long 0x01120113 ++ .long 0x0b1b0825 ++ .long 0x08000002 ++ .long 0x24000308 ++ .long 0x0b0b3e0b ++ .long 0x00000324 ++ .long 0x000b0b3e ++ .long 0x0b000004 ++ .long 0x15004913 ++ .long 0x0000050f ++ .long 0x00330b49 ++ .long 0x13000006 ++ .long 0x13010113 ++ .long 0x03080b0b ++ .long 0x0000070d ++ .long 0x00030838 ++ .long 0x0a491300 ++ .long 0x00082e00 ++ .long 0x03081101 ++ .long 0x1201360b ++ .long 0x3f0c400a ++ .long 0x49130000 ++ .byte 0x00 ++ ++ .section ".debug_line" ++ .align 0 ++.LC.debug_line: ++ .long 0x0000005e ++ .long 0x00020000 ++ .long 0x00220101 ++ .long 0x9cdc0a00 ++ .long 0x01010101 ++ .long 0x00000001 ++ .long 0x00786c66 ++ .long 0x2d766172 ++ .long 0x6961626c ++ .long 0x652e6600 ++ .long 0x00000000 ++ .long 0x04010005 ++ .byte 0x02 ++ .long .LC.text ++ .long 0x03130109 ++ .long 0x000c0309 ++ .long 0x01090014 ++ .long 0x037b0109 ++ .long 0x00180301 ++ .long 0x01090038 ++ .long 0x03010109 ++ .long 0x000c0301 ++ .long 0x01090014 ++ .long 0x03010109 ++ .long 0x00180001 ++ .byte 0x01 ++.LC.debug_line98: ++ .long 0x00000046 ++ .long 0x00020000 ++ .long 0x00220101 ++ .long 0x9cdc0a00 ++ .long 0x01010101 ++ .long 0x00000001 ++ .long 0x00786c66 ++ .long 0x2d766172 ++ .long 0x6961626c ++ .long 0x652e6600 ++ .long 0x00000000 ++ .long 0x04010005 ++ .byte 0x02 ++ .long .LC.text256 ++ .long 0x031f0109 ++ .long 0x00140300 ++ .long 0x01090004 ++ .long 0x03010109 ++ .long 0x002c0001 ++ .byte 0x01 ++ ++ .section ".debug_frame" ++ .align 0 ++.LC.debug_frame: ++ .long 0x0000000c ++ .long 0xffffffff ++ .long 0x0100047c ++ .long 0x410c0100 ++ .long 0x0000001c ++ .long .LC.debug_frame ++ .long .LC.text ++ .long 0x00000020 ++ .long 0x410e2041 ++ .long 0x9f01410d ++ .long 0x1f410a42 ++ .long 0xdf420b00 ++ .long 0x00000020 ++ .long .LC.debug_frame ++ .long .LC.text32 ++ .long 0x00000088 ++ .long 0x410e2041 ++ .long 0x9f01419e ++ .long 0x02410d1f ++ .long 0x590a42de ++ .long 0x41df420b ++.LC.debug_frame84: ++ .long 0x0000000c ++ .long 0xffffffff ++ .long 0x0100047c ++ .long 0x410c0100 ++ .long 0x00000020 ++ .long .LC.debug_frame84 ++ .long .LC.text256 ++ .long 0x00000044 ++ .long 0x420e2041 ++ .long 0x9f014111 ++ .long 0x417f410d ++ .long 0x1f460a42 ++ .long 0xdf440b00 ++ ++ .section ".debug_pubtypes" ++ .align 0 ++.LC.debug_pubtypes: ++ .long 0x00000023 ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_info ++ .long 0x00000111 ++ .long 0x000000b9 ++ .long 0x494e5445 ++ .long 0x47455200 ++ .long 0x000000c7 ++ .long 0x5245414c ++ .long 0x00000000 ++ .long 0x00000000 ++ .byte 0x3e ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_info273 ++ .long 0x00000127 ++ .long 0x000000b9 ++ .long 0x494e5445 ++ .long 0x47455200 ++ .long 0x000000c7 ++ .long 0x5245414c ++ .long 0x00000000 ++ .long 0xda26264e ++ .long 0x266d6f64 ++ .long 0x31000000 ++ .long 0x00f42626 ++ .long 0x4e26266d ++ .long 0x6f643100 ++ .long 0x00000000 ++ ++ .comm __N__mod1,4,16 +diff --git a/gdb/testsuite/gdb.fortran/xlf-variable.exp b/gdb/testsuite/gdb.fortran/xlf-variable.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/xlf-variable.exp +@@ -0,0 +1,37 @@ ++# Copyright 2012 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# This test can only be run on PPC64 machines. ++ ++if { ![istarget powerpc64-*] || ![is_ilp32_target] } { ++ return -1 ++} ++ ++set testfile "xlf-variable" ++set srcfile ${testfile}.S ++ ++if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { ++ return -1 ++} ++ ++if { ![runto_main] } { ++ return -1 ++} ++ ++gdb_test "step" ".*y => z.*" "y => z" ++gdb_test "step" ".*y = 3\.0.*" "y = 3.0" ++gdb_test "step" ".*nullify \\(y\\).*" "nullify (y)" ++gdb_test "print z" "= 3" "z = 3" ++gdb_test "ptype z" "= REAL" "z is REAL" +diff --git a/gdb/testsuite/gdb.fortran/xlf-variable.f b/gdb/testsuite/gdb.fortran/xlf-variable.f +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.fortran/xlf-variable.f +@@ -0,0 +1,33 @@ ++c Copyright 2012 Free Software Foundation, Inc. ++c ++c This program is free software; you can redistribute it and/or modify ++c it under the terms of the GNU General Public License as published by ++c the Free Software Foundation; either version 3 of the License, or ++c (at your option) any later version. ++c ++c This program is distributed in the hope that it will be useful, ++c but WITHOUT ANY WARRANTY; without even the implied warranty of ++c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++c GNU General Public License for more details. ++c ++c You should have received a copy of the GNU General Public License ++c along with this program. If not, see . ++ ++c This file is the Fortran source file for xlf-variable.f. ++c It was used to generate the assembly output called xlf-variable.S, ++c which was generated using IBM's XLF compiler. ++ ++ module mod1 ++ real, pointer :: y ++ real, target :: z ++ contains ++ subroutine sub1 ++ y => z ++ y = 3.0 ++ nullify (y) ++ end subroutine ++ end module ++ ++ use mod1 ++ call sub1 ++ end diff --git a/gdb-rpmlintrc b/gdb-rpmlintrc new file mode 100644 index 0000000..3e0b4cd --- /dev/null +++ b/gdb-rpmlintrc @@ -0,0 +1,16 @@ +# This line is mandatory to access the configuration functions +from Config import * + +# The testresult logs contain part of the build log and thus +# necessarily mention the buildroot +addFilter ("gdb-testresults.*file-contains-buildroot") + +# Historically libinproctrace was always in gdbserver. It's +# LD_PRELOADed into processes, so there are no direct ELF +# dependencies to it. It's required on the remote side (where +# gdbserver is) so it makes sense to put it in the same package. +# This never was a problem for rpmlint before because libinproctrace +# had no SONAME, so the check wasn't active. Now it has, so it's checked +# and because the gdbserver binary has no direct ELF visible dependency +# it's thought to be necessary to follow shlib policy. That's not the case. +addFilter ("gdbserver.*shlib-policy-name-error.*libinproctrace") diff --git a/gdb-simultaneous-step-resume-breakpoint-test.patch b/gdb-simultaneous-step-resume-breakpoint-test.patch new file mode 100644 index 0000000..5e1315b --- /dev/null +++ b/gdb-simultaneous-step-resume-breakpoint-test.patch @@ -0,0 +1,162 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-simultaneous-step-resume-breakpoint-test.patch + +;; New test for step-resume breakpoint placed in multiple threads at once. +;;=fedoratest + +diff --git a/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c +@@ -0,0 +1,79 @@ ++/* Copyright 2009 Free Software Foundation, Inc. ++ ++ Written by Fred Fish of Cygnus Support ++ Contributed by Cygnus Support ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Test multiple threads stepping into a .debug_line-less function with ++ a breakpoint placed on its return-to-caller point. */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#define THREADS 3 ++ ++static void * ++func (void *unused) ++{ ++ int i; ++ ++ errno = 0; ++ i = 0xdeadf00d; ++ i = sleep (THREADS); /* sleep-call */ ++ if (errno != 0) /* sleep-after */ ++ perror ("sleep"); ++ ++ /* The GDB bug with forgotten step-resume breakpoint could leave stale ++ breakpoint on the I assignment making it a nop. */ ++ if (i == 0xdeadf00d) ++ assert (0); ++ ++ assert (i == 0); ++ ++ pthread_exit (NULL); ++} ++ ++int ++main (void) ++{ ++ pthread_t threads[THREADS]; ++ int threadi; ++ ++ for (threadi = 0; threadi < THREADS; threadi++) ++ { ++ int i; ++ ++ i = pthread_create (&threads[threadi], NULL, func, NULL); ++ assert (i == 0); ++ ++ i = sleep (1); ++ assert (i == 0); ++ } ++ ++ for (threadi = 0; threadi < THREADS; threadi++) ++ { ++ int i; ++ ++ i = pthread_join (threads[threadi], NULL); ++ assert (i == 0); ++ } ++ ++ return 0; /* final-exit */ ++} +diff --git a/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.exp b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.exp +@@ -0,0 +1,65 @@ ++# Copyright (C) 2009 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . */ ++ ++# Test multiple threads stepping into a .debug_line-less function with ++# a breakpoint placed on its return-to-caller point. ++ ++set testfile simultaneous-step-resume-breakpoint ++set srcfile ${testfile}.c ++set binfile [standard_output_file ${testfile}] ++ ++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++ ++# Ensure we have no debuginfo for the `sleep' call itself (=for libc). ++gdb_test "set debug-file-directory /DoesNotExist" ++ ++gdb_load ${binfile} ++if ![runto_main] { ++ return -1 ++} ++ ++# Red Hat vendor patch does set it to "step" by default. ++gdb_test "set scheduler-locking off" ++ ++gdb_breakpoint [gdb_get_line_number "final-exit"] ++ ++gdb_breakpoint [gdb_get_line_number "sleep-call"] ++gdb_continue_to_breakpoint "sleep-call" ++ ++gdb_test "step" "sleep-call.*" "step thread 1" ++gdb_test "step" "sleep-call.*" "step thread 2" ++gdb_test "step" "sleep-after.*" "step thread 3" ++ ++set test "first continue" ++gdb_test_multiple "continue" $test { ++ -re "final-exit.*$gdb_prompt $" { ++ # gdb-7.0. ++ pass $test ++ return ++ } ++ -re "sleep-after.*$gdb_prompt $" { ++ # Fedora/RHEL branch. ++ pass $test ++ } ++} ++ ++gdb_test "continue" "sleep-after.*" "second continue" ++gdb_test "continue" "final-exit.*" "third continue" diff --git a/gdb-support-rseq-auxvs.patch b/gdb-support-rseq-auxvs.patch new file mode 100644 index 0000000..b16f55d --- /dev/null +++ b/gdb-support-rseq-auxvs.patch @@ -0,0 +1,45 @@ +From 1bbcd2144710c4b1daa9c404df0ebc80c3461747 Mon Sep 17 00:00:00 2001 +From: Ilya Leoshkevich +Date: Thu, 22 Jun 2023 01:03:04 +0200 +Subject: [PATCH 11/12] gdb: support rseq auxvs + +Linux kernel commit commit 317c8194e6ae ("rseq: Introduce feature size +and alignment ELF auxiliary vector entries") introduced two new auxvs: +AT_RSEQ_FEATURE_SIZE and AT_RSEQ_ALIGN. Support them in GDB. This +fixes auxv.exp on kernels >= v6.3. +--- + gdb/auxv.c | 4 ++++ + include/elf/common.h | 2 ++ + 2 files changed, 6 insertions(+) + +diff --git a/gdb/auxv.c b/gdb/auxv.c +index 812b2807554..3ce5ccd3342 100644 +--- a/gdb/auxv.c ++++ b/gdb/auxv.c +@@ -493,6 +493,10 @@ default_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file, + AUXV_FORMAT_STR); + TAG (AT_RANDOM, _("Address of 16 random bytes"), AUXV_FORMAT_HEX); + TAG (AT_HWCAP2, _("Extension of AT_HWCAP"), AUXV_FORMAT_HEX); ++ TAG (AT_RSEQ_FEATURE_SIZE, _("rseq supported feature size"), ++ AUXV_FORMAT_HEX); ++ TAG (AT_RSEQ_ALIGN, _("rseq allocation alignment"), ++ AUXV_FORMAT_HEX); + TAG (AT_EXECFN, _("File name of executable"), AUXV_FORMAT_STR); + TAG (AT_SECURE, _("Boolean, was exec setuid-like?"), AUXV_FORMAT_DEC); + TAG (AT_SYSINFO, _("Special system info/entry points"), AUXV_FORMAT_HEX); +diff --git a/include/elf/common.h b/include/elf/common.h +index 16587f6fb06..a37b1f9a264 100644 +--- a/include/elf/common.h ++++ b/include/elf/common.h +@@ -1353,6 +1353,8 @@ + may differ from AT_PLATFORM. */ + #define AT_RANDOM 25 /* Address of 16 random bytes. */ + #define AT_HWCAP2 26 /* Extension of AT_HWCAP. */ ++#define AT_RSEQ_FEATURE_SIZE 27 /* rseq supported feature size */ ++#define AT_RSEQ_ALIGN 28 /* rseq allocation alignment */ + #define AT_EXECFN 31 /* Filename of executable. */ + /* Pointer to the global system page used for system calls and other + nice things. */ +-- +2.35.3 + diff --git a/gdb-symtab-add-optimized-out-static-var-to-cooked-in.patch b/gdb-symtab-add-optimized-out-static-var-to-cooked-in.patch new file mode 100644 index 0000000..341b0c2 --- /dev/null +++ b/gdb-symtab-add-optimized-out-static-var-to-cooked-in.patch @@ -0,0 +1,299 @@ +From 7f4601b0a51f400bd1b1bc0f7895254d467e3bb4 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Fri, 21 Jul 2023 08:25:25 +0200 +Subject: [PATCH] [gdb/symtab] Add optimized out static var to cooked index + +Consider the test-case: +... +$ cat main.c +int main (void) { return 0; } +$ cat static-optimized-out.c +static int aaa; +... +compiled like this: +... +$ gcc-12 static-optimized-out.c main.c -g -O2 -flto +... + +There's a difference in behaviour depending on symtab expansion state: +... +$ gdb -q -batch a.out -ex "print aaa" +No symbol "aaa" in current context. +$ gdb -q -batch a.out -ex "maint expand-symtab" -ex "print aaa" +$1 = +... + +The reason for the difference is that the optimized out variable aaa: +... + <1><104>: Abbrev Number: 2 (DW_TAG_variable) + <105> DW_AT_name : aaa + <109> DW_AT_decl_file : 1 + <10a> DW_AT_decl_line : 18 + <10b> DW_AT_decl_column : 12 + <10c> DW_AT_type : <0x110> +... +is not added to the cooked index because of this clause in abbrev_table::read: +... + else if (!has_location && !has_specification_or_origin && !has_external + && cur_abbrev->tag == DW_TAG_variable) + cur_abbrev->interesting = false; +... + +Fix this inconsistency by making sure that the optimized out variable is added +to the cooked index. + +Regression tested on x86_64-linux. + +Add two test-cases, a C test-case gdb.opt/static-optimized-out.exp and a dwarf +assembly test-case gdb.dwarf2/static-optimized-out.exp. + +Tested gdb.opt/static-optimized-out.exp with gcc-8 to gcc-12, for which we now +consistently get: +... +(gdb) print aaa^M +$1 = ^M +... +and with gcc 7.5.0 and clang 13.0.1, for which we still consistently get: +... +(gdb) print aaa^M +No symbol "aaa" in current context.^M +... +due to missing debug info for the variable. + +PR symtab/30656 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30656 + +Approved-By: Tom Tromey +--- + gdb/dwarf2/abbrev.c | 9 --- + .../gdb.dwarf2/static-optimized-out.exp | 69 +++++++++++++++++++ + gdb/testsuite/gdb.opt/main.c | 22 ++++++ + gdb/testsuite/gdb.opt/static-optimized-out.c | 18 +++++ + .../gdb.opt/static-optimized-out.exp | 49 +++++++++++++ + 5 files changed, 158 insertions(+), 9 deletions(-) + create mode 100644 gdb/testsuite/gdb.dwarf2/static-optimized-out.exp + create mode 100644 gdb/testsuite/gdb.opt/main.c + create mode 100644 gdb/testsuite/gdb.opt/static-optimized-out.c + create mode 100644 gdb/testsuite/gdb.opt/static-optimized-out.exp + +diff --git a/gdb/dwarf2/abbrev.c b/gdb/dwarf2/abbrev.c +index 1ebf8f6eed5..3a429fd41b1 100644 +--- a/gdb/dwarf2/abbrev.c ++++ b/gdb/dwarf2/abbrev.c +@@ -162,7 +162,6 @@ abbrev_table::read (struct dwarf2_section_info *section, + bool has_specification_or_origin = false; + bool has_name = false; + bool has_linkage_name = false; +- bool has_location = false; + bool has_external = false; + + /* Now read in declarations. */ +@@ -217,11 +216,6 @@ abbrev_table::read (struct dwarf2_section_info *section, + has_linkage_name = true; + break; + +- case DW_AT_const_value: +- case DW_AT_location: +- has_location = true; +- break; +- + case DW_AT_sibling: + if (is_csize && cur_attr.form == DW_FORM_ref4) + sibling_offset = size; +@@ -296,9 +290,6 @@ abbrev_table::read (struct dwarf2_section_info *section, + cur_abbrev->interesting = false; + else if (!tag_interesting_for_index (cur_abbrev->tag)) + cur_abbrev->interesting = false; +- else if (!has_location && !has_specification_or_origin && !has_external +- && cur_abbrev->tag == DW_TAG_variable) +- cur_abbrev->interesting = false; + else + cur_abbrev->interesting = true; + +diff --git a/gdb/testsuite/gdb.dwarf2/static-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/static-optimized-out.exp +new file mode 100644 +index 00000000000..1547a8acbc0 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/static-optimized-out.exp +@@ -0,0 +1,69 @@ ++# Copyright 2023 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# Check that an optimized out static variable is printed the same independent ++# of state of symtab expansion. See also gdb.opt/static-optimized-out.exp. ++ ++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 -dw.S ++ ++# Make DWARF for the test. ++set asm_file [standard_output_file $srcfile2] ++Dwarf::assemble $asm_file { ++ cu {} { ++ compile_unit { ++ { ++ language @DW_LANG_C ++ } ++ } { ++ declare_labels integer_label ++ ++ integer_label: DW_TAG_base_type { ++ {DW_AT_byte_size 4 DW_FORM_sdata} ++ {DW_AT_encoding @DW_ATE_signed} ++ {DW_AT_name integer} ++ } ++ ++ DW_TAG_variable { ++ {name var} ++ {type :$integer_label} ++ } ++ } ++ } ++} ++ ++if { [prepare_for_testing "failed to prepare" ${testfile} \ ++ [list $srcfile $asm_file] {nodebug}] } { ++ return -1 ++} ++ ++gdb_test "print var" " = " ++ ++# Expand all symbol tables. ++gdb_test_no_output "maint expand-symtabs" ++ ++# Make sure we do an actual lookup rather than just returning the same as ++# before. ++gdb_test_no_output "maint flush symbol-cache" ++ ++with_test_prefix "after expand-symtabs" { ++ gdb_test "print var" " = " ++} +diff --git a/gdb/testsuite/gdb.opt/main.c b/gdb/testsuite/gdb.opt/main.c +new file mode 100644 +index 00000000000..c6beff77dbe +--- /dev/null ++++ b/gdb/testsuite/gdb.opt/main.c +@@ -0,0 +1,22 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2023 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++int ++main (void) ++{ ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.opt/static-optimized-out.c b/gdb/testsuite/gdb.opt/static-optimized-out.c +new file mode 100644 +index 00000000000..44287fbd6d2 +--- /dev/null ++++ b/gdb/testsuite/gdb.opt/static-optimized-out.c +@@ -0,0 +1,18 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2023 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++static int aaa; +diff --git a/gdb/testsuite/gdb.opt/static-optimized-out.exp b/gdb/testsuite/gdb.opt/static-optimized-out.exp +new file mode 100644 +index 00000000000..bd673b6503e +--- /dev/null ++++ b/gdb/testsuite/gdb.opt/static-optimized-out.exp +@@ -0,0 +1,49 @@ ++# Copyright 2023 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# Check that an optimized out static variable is printed the same independent ++# of state of symtab expansion. See also gdb.dwarf2/static-optimized-out.exp. ++ ++standard_testfile .c main.c ++ ++set opts {} ++lappend opts debug ++lappend opts "optimize=-O2 -flto" ++ ++if { [prepare_for_testing "failed to prepare" $testfile \ ++ [list $srcfile $srcfile2] $opts] } { ++ return -1 ++} ++ ++set val "" ++gdb_test_multiple "print aaa" "" { ++ -re -wrap "\r\n(?:\\$$decimal = )?(\[^\r\n\]*)" { ++ set val $expect_out(1,string) ++ } ++} ++ ++if { $val == "" } { ++ return ++} ++ ++# Expand all symbol tables. ++gdb_test_no_output "maint expand-symtab" ++ ++# Make sure we do an actual lookup rather than just returning the same as ++# before. ++gdb_test_no_output "maint flush symbol-cache" ++ ++# Now check that we get the same result in both cases. ++gdb_test "print aaa" [string_to_regexp $val] "consistency" + +base-commit: 800c393f89a94f49b01dff99f693cb13c5e28116 +-- +2.35.3 + diff --git a/gdb-symtab-add-producer_is_gas.patch b/gdb-symtab-add-producer_is_gas.patch new file mode 100644 index 0000000..69b47a5 --- /dev/null +++ b/gdb-symtab-add-producer_is_gas.patch @@ -0,0 +1,125 @@ +From aa8ba17b9a3fdfeeb65df4c3e0731a0e9e96cbf7 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Wed, 1 Nov 2023 00:33:12 +0100 +Subject: [PATCH 1/2] [gdb/symtab] Add producer_is_gas + +Add producer_is_gas, a generic way to get the gas version from the +producer string. + +Tested on x86_64-linux. +--- + gdb/dwarf2/read.c | 4 ++-- + gdb/producer.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++ + gdb/producer.h | 5 +++++ + 3 files changed, 63 insertions(+), 2 deletions(-) + +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index 970dd54c7a5..472684a5817 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -13376,8 +13376,8 @@ check_producer (struct dwarf2_cu *cu) + cu->producer_is_codewarrior = true; + else if (producer_is_clang (cu->producer, &major, &minor)) + cu->producer_is_clang = true; +- else if (startswith (cu->producer, "GNU AS 2.39.0")) +- cu->producer_is_gas_2_39 = true; ++ else if (producer_is_gas (cu->producer, &major, &minor)) ++ cu->producer_is_gas_2_39 = major == 2 && minor == 39; + else + { + /* For other non-GCC compilers, expect their behavior is DWARF version +diff --git a/gdb/producer.c b/gdb/producer.c +index 9fcf749e3d4..cd83dfce128 100644 +--- a/gdb/producer.c ++++ b/gdb/producer.c +@@ -81,6 +81,45 @@ producer_is_gcc (const char *producer, int *major, int *minor) + + /* See producer.h. */ + ++bool ++producer_is_gas (const char *producer, int *major, int *minor) ++{ ++ if (producer == nullptr) ++ { ++ /* No producer, don't know. */ ++ return false; ++ } ++ ++ /* Detect prefix. */ ++ const char prefix[] = "GNU AS "; ++ if (!startswith (producer, prefix)) ++ { ++ /* Producer is not gas. */ ++ return false; ++ } ++ ++ /* Skip prefix. */ ++ const char *cs = &producer[strlen (prefix)]; ++ ++ /* Ensure that major/minor are not nullptrs. */ ++ int maj, min; ++ if (major == nullptr) ++ major = &maj; ++ if (minor == nullptr) ++ minor = &min; ++ ++ int scanned = sscanf (cs, "%d.%d", major, minor); ++ if (scanned != 2) ++ { ++ /* Unable to scan major/minor version. */ ++ return false; ++ } ++ ++ return true; ++} ++ ++ /* See producer.h. */ ++ + bool + producer_is_icc_ge_19 (const char *producer) + { +@@ -251,6 +290,23 @@ Version 18.0 Beta"; + SELF_CHECK (!producer_is_gcc (flang_llvm_exp, &major, &minor)); + SELF_CHECK (producer_is_llvm (flang_llvm_exp)); + } ++ ++ { ++ static const char gas_exp[] = "GNU AS 2.39.0"; ++ int major = 0, minor = 0; ++ SELF_CHECK (!producer_is_gcc (gas_exp, &major, &minor)); ++ SELF_CHECK (producer_is_gas (gas_exp, &major, &minor)); ++ SELF_CHECK (major == 2 && minor == 39); ++ ++ static const char gas_incomplete_exp[] = "GNU AS "; ++ SELF_CHECK (!producer_is_gas (gas_incomplete_exp, &major, &minor)); ++ SELF_CHECK (!producer_is_gcc (gas_incomplete_exp, &major, &minor)); ++ ++ static const char gas_incomplete_exp_2[] = "GNU AS 2"; ++ SELF_CHECK (!producer_is_gas (gas_incomplete_exp_2, &major, &minor)); ++ SELF_CHECK (!producer_is_gcc (gas_incomplete_exp_2, &major, &minor)); ++ } ++ + } + } + } +diff --git a/gdb/producer.h b/gdb/producer.h +index c915979b122..00718511775 100644 +--- a/gdb/producer.h ++++ b/gdb/producer.h +@@ -30,6 +30,11 @@ extern int producer_is_gcc_ge_4 (const char *producer); + is NULL or it isn't GCC. */ + extern int producer_is_gcc (const char *producer, int *major, int *minor); + ++/* Returns nonzero if the given PRODUCER string is GAS and sets the MAJOR ++ and MINOR versions when not NULL. Returns zero if the given PRODUCER ++ is NULL or it isn't GAS. */ ++bool producer_is_gas (const char *producer, int *major, int *minor); ++ + /* Check for Intel compilers >= 19.0. */ + extern bool producer_is_icc_ge_19 (const char *producer); + + +base-commit: 39553c1e285c426946188ec2a890c1c1cb933060 +-- +2.35.3 + diff --git a/gdb-symtab-don-t-deduplicate-variables-in-gdb-index.patch b/gdb-symtab-don-t-deduplicate-variables-in-gdb-index.patch new file mode 100644 index 0000000..58504b7 --- /dev/null +++ b/gdb-symtab-don-t-deduplicate-variables-in-gdb-index.patch @@ -0,0 +1,81 @@ +From 04d0d6ebdc6d08f5a7ec0d4c89eb1835deef54dc Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Sun, 13 Aug 2023 14:08:06 +0200 +Subject: [PATCH] [gdb/symtab] Don't deduplicate variables in gdb-index + +When running test-case gdb.python/py-symbol.exp with target board +cc-with-gdb-index, we run into: +... +(gdb) python print (len (gdb.lookup_static_symbols ('rr')))^M +1^M +(gdb) FAIL: gdb.python/py-symbol.exp: print (len (gdb.lookup_static_symbols ('rr'))) +... + +[ Note that the test-case contains rr in both py-symtab.c: +... +static int __attribute__ ((used)) rr = 42; /* line of rr */ +... +and py-symtab-2.c: +... +static int __attribute__ ((used)) rr = 99; /* line of other rr */ +... ] + +This passes with gdb-12-branch, and fails with gdb-13-branch. + +AFAIU the current code in symtab_index_entry::minimize makes the assumption +that it's fine to store only one copy of rr in the gdb-index, because +"print rr" will only ever print one, and always the same. + +But that fails to recognize that gdb supports gdb.lookup_static_symbols, which +returns a list of variables rather than the first one. + +In other words, the current approach breaks feature parity between cooked +index and gdb-index. + +Note btw that also debug-names has both instances: +... +[ 5] #00597969 rr: + <4> DW_TAG_variable DW_IDX_compile_unit=3 DW_IDX_GNU_internal=1 + <4> DW_TAG_variable DW_IDX_compile_unit=4 DW_IDX_GNU_internal=1 +... + +Fix this in symtab_index_entry::minimize, by not deduplicating variables. + +Tested on x86_64-linux, with target boards unix and cc-with-gdb-index. + +Reviewed-by: Kevin Buettner + +PR symtab/30720 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30720 +--- + gdb/dwarf2/index-write.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c +index d10583568c0..ea67f73ac3c 100644 +--- a/gdb/dwarf2/index-write.c ++++ b/gdb/dwarf2/index-write.c +@@ -294,7 +294,7 @@ symtab_index_entry::minimize () + auto from = std::unique (cu_indices.begin (), cu_indices.end ()); + cu_indices.erase (from, cu_indices.end ()); + +- /* We don't want to enter a variable or type more than once, so ++ /* We don't want to enter a type more than once, so + remove any such duplicates from the list as well. When doing + this, we want to keep the entry from the first CU -- but this is + implicit due to the sort. This choice is done because it's +@@ -304,8 +304,7 @@ symtab_index_entry::minimize () + [&] (offset_type val) + { + gdb_index_symbol_kind kind = GDB_INDEX_SYMBOL_KIND_VALUE (val); +- if (kind != GDB_INDEX_SYMBOL_KIND_TYPE +- && kind != GDB_INDEX_SYMBOL_KIND_VARIABLE) ++ if (kind != GDB_INDEX_SYMBOL_KIND_TYPE) + return false; + + val &= ~GDB_INDEX_CU_MASK; + +base-commit: 2521ac7ed0c495b9e804c4356939b9be7166853c +-- +2.35.3 + diff --git a/gdb-symtab-don-t-defer-backward-refs-inter-cu-intra-.patch b/gdb-symtab-don-t-defer-backward-refs-inter-cu-intra-.patch new file mode 100644 index 0000000..2bfa876 --- /dev/null +++ b/gdb-symtab-don-t-defer-backward-refs-inter-cu-intra-.patch @@ -0,0 +1,74 @@ +From 6d472b241c96f181f88867860e92f1dfe7364903 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Sat, 16 Sep 2023 04:07:22 +0200 +Subject: [PATCH 08/11] [gdb/symtab] Don't defer backward refs, inter-cu + intra-shard case + +In patch "[gdb/symtab] Resolve deferred entries, inter-shard case" we've +solved the generic case of handling deferred entries. + +Add an optimization that doesn't defer inter-CU intra-shard dependencies that +are present in the shard's parent map. + +Tested on x86_64-linux. +--- + gdb/dwarf2/read.c | 29 ++++++++++++++++++++++++++++- + 1 file changed, 28 insertions(+), 1 deletion(-) + +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index 0ab3e1a1500..d2d50b5c9cc 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -6709,6 +6709,12 @@ class cooked_index_storage + m_index->set_parent_valid (start, end); + } + ++ /* Return true if find_parents can be relied upon. */ ++ bool parent_valid (CORE_ADDR addr) ++ { ++ return m_index->parent_valid (addr); ++ } ++ + private: + + /* Hash function for a cutu_reader. */ +@@ -6857,6 +6863,12 @@ class cooked_indexer + { + m_index_storage->set_parent_valid (start, end); + } ++ ++ /* Return true if find_parents can be relied upon. */ ++ bool parent_valid (CORE_ADDR addr) ++ { ++ return m_index_storage->parent_valid (addr); ++ } + }; + + /* Subroutine of dwarf2_build_psymtabs_hard to simplify it. +@@ -18387,7 +18399,22 @@ cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu, + else + { + /* Inter-CU case. */ +- *maybe_defer = addr; ++ if (parent_valid (addr)) ++ { ++ auto tmp = find_parent (addr); ++ if (tmp == &parent_map::deferred) ++ { ++ /* Defer because origin is deferred. */ ++ *maybe_defer = addr; ++ } ++ else ++ *parent_entry = tmp; ++ } ++ else ++ { ++ /* Defer because origin is in other shard. */ ++ *maybe_defer = addr; ++ } + } + } + +-- +2.35.3 + diff --git a/gdb-symtab-factor-out-m_deferred_entries-usage.patch b/gdb-symtab-factor-out-m_deferred_entries-usage.patch new file mode 100644 index 0000000..fdb1c48 --- /dev/null +++ b/gdb-symtab-factor-out-m_deferred_entries-usage.patch @@ -0,0 +1,76 @@ +From dac6c3b27a77589078add7e4e4586515ac85610d Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Fri, 15 Sep 2023 08:38:00 +0200 +Subject: [PATCH 04/11] [gdb/symtab] Factor out m_deferred_entries usage + +Factor out usage of cooked_indexer::m_deferred_entries in new member +functions defer_entry, handle_deferred_entries and resolve_deferred_entry. + +Tested on x86_64-linux. +--- + gdb/dwarf2/read.c | 35 ++++++++++++++++++++++++++++------- + 1 file changed, 28 insertions(+), 7 deletions(-) + +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index 1092cb1dca9..ff5be8e7dc5 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -6822,6 +6822,32 @@ class cooked_indexer + we'll know the containing context of all the DIEs that we might + have scanned. This vector stores these deferred entries. */ + std::vector m_deferred_entries; ++ ++ /* Defer creating a cooked_index_entry corresponding to deferred_entry DE. */ ++ void defer_entry (const deferred_entry &de) ++ { ++ m_deferred_entries.push_back (de); ++ } ++ ++ /* Create a cooked_index_entry corresponding to deferred_entry DE with ++ parent PARENT_ENTRY. */ ++ const cooked_index_entry *resolve_deferred_entry ++ (const deferred_entry &de, const cooked_index_entry *parent_entry) ++ { ++ return m_index_storage->add (de.die_offset, de.tag, de.flags, de.name, ++ parent_entry, m_per_cu); ++ } ++ ++ /* Create cooked_index_entries for the deferred entries. */ ++ void handle_deferred_entries () ++ { ++ for (const auto &entry : m_deferred_entries) ++ { ++ const cooked_index_entry *parent_entry ++ = find_parent (entry.spec_offset); ++ resolve_deferred_entry (entry, parent_entry); ++ } ++ } + }; + + /* Subroutine of dwarf2_build_psymtabs_hard to simplify it. +@@ -18519,7 +18545,7 @@ cooked_indexer::index_dies (cutu_reader *reader, + if (name != nullptr) + { + if (defer != 0) +- m_deferred_entries.push_back ({ ++ defer_entry ({ + this_die, name, defer, abbrev->tag, flags + }); + else +@@ -18624,12 +18650,7 @@ cooked_indexer::make_index (cutu_reader *reader) + return; + index_dies (reader, reader->info_ptr, nullptr, false); + +- for (const auto &entry : m_deferred_entries) +- { +- const cooked_index_entry *parent = find_parent (entry.spec_offset); +- m_index_storage->add (entry.die_offset, entry.tag, entry.flags, +- entry.name, parent, m_per_cu); +- } ++ handle_deferred_entries (); + } + + /* An implementation of quick_symbol_functions for the cooked DWARF +-- +2.35.3 + diff --git a/gdb-symtab-factor-out-m_die_range_map-usage.patch b/gdb-symtab-factor-out-m_die_range_map-usage.patch new file mode 100644 index 0000000..1592aeb --- /dev/null +++ b/gdb-symtab-factor-out-m_die_range_map-usage.patch @@ -0,0 +1,153 @@ +From 6ac3acf29782a059258fdfe21bd55f1716fc46ed Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Tue, 22 Aug 2023 13:17:47 +0200 +Subject: [PATCH 02/11] [gdb/symtab] Factor out m_die_range_map usage + +Factor out usage of cooked_indexer::m_die_range_map into new class parent_map +with member functions find_parent and set_parent, and static member function +form_addr. + +Tested on x86_64-linux. +--- + gdb/dwarf2/cooked-index.h | 32 ++++++++++++++++++++++++++ + gdb/dwarf2/read.c | 48 +++++++++++++++++++++------------------ + 2 files changed, 58 insertions(+), 22 deletions(-) + +diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h +index 2ef1f4b27e9..1c967bdbf86 100644 +--- a/gdb/dwarf2/cooked-index.h ++++ b/gdb/dwarf2/cooked-index.h +@@ -233,6 +233,38 @@ struct cooked_index_entry : public allocate_on_obstack + bool for_name) const; + }; + ++class parent_map ++{ ++public: ++ /* A helper function to turn a section offset into an address that ++ can be used in a parent_map. */ ++ static CORE_ADDR form_addr (sect_offset offset, bool is_dwz) ++ { ++ CORE_ADDR value = to_underlying (offset); ++ if (is_dwz) ++ value |= ((CORE_ADDR) 1) << (8 * sizeof (CORE_ADDR) - 1); ++ return value; ++ } ++ ++ /* Find the parent of DIE LOOKUP. */ ++ const cooked_index_entry *find_parent (CORE_ADDR lookup) const ++ { ++ const void *obj = m_parent_map.find (lookup); ++ return static_cast (obj); ++ } ++ ++ /* Set the parent of DIES in range [START, END] to PARENT_ENTRY. */ ++ void set_parent (CORE_ADDR start, CORE_ADDR end, ++ const cooked_index_entry *parent_entry) ++ { ++ m_parent_map.set_empty (start, end, (void *)parent_entry); ++ } ++ ++private: ++ /* An addrmap that maps from section offsets to cooked_index_entry *. */ ++ addrmap_mutable m_parent_map; ++}; ++ + class cooked_index_vector; + + /* An index of interesting DIEs. This is "cooked", in contrast to a +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index 00471d20d41..1092cb1dca9 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -6722,16 +6722,6 @@ class cooked_indexer + + private: + +- /* A helper function to turn a section offset into an address that +- can be used in an addrmap. */ +- CORE_ADDR form_addr (sect_offset offset, bool is_dwz) +- { +- CORE_ADDR value = to_underlying (offset); +- if (is_dwz) +- value |= ((CORE_ADDR) 1) << (8 * sizeof (CORE_ADDR) - 1); +- return value; +- } +- + /* A helper function to scan the PC bounds of READER and record them + in the storage's addrmap. */ + void check_bounds (cutu_reader *reader); +@@ -6799,7 +6789,20 @@ class cooked_indexer + /* An addrmap that maps from section offsets (see the form_addr + method) to newly-created entries. See m_deferred_entries to + understand this. */ +- addrmap_mutable m_die_range_map; ++ parent_map m_die_range_map; ++ ++ /* Find the parent of DIE LOOKUP. */ ++ const cooked_index_entry *find_parent (CORE_ADDR lookup) const ++ { ++ return m_die_range_map.find_parent (lookup); ++ } ++ ++ /* Set the parent of DIES in range [START, END] to PARENT_ENTRY. */ ++ void set_parent (CORE_ADDR start, CORE_ADDR end, ++ const cooked_index_entry *parent_entry) ++ { ++ m_die_range_map.set_parent (start, end, parent_entry); ++ } + + /* A single deferred entry. */ + struct deferred_entry +@@ -18317,15 +18320,13 @@ cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu, + + if (*parent_entry == nullptr) + { +- CORE_ADDR addr = form_addr (origin_offset, origin_is_dwz); ++ CORE_ADDR addr ++ = parent_map::form_addr (origin_offset, origin_is_dwz); + if (new_reader->cu == reader->cu + && new_info_ptr > watermark_ptr) + *maybe_defer = addr; + else +- { +- void *obj = m_die_range_map.find (addr); +- *parent_entry = static_cast (obj); +- } ++ *parent_entry = find_parent (addr); + } + + unsigned int bytes_read; +@@ -18444,11 +18445,15 @@ cooked_indexer::recurse (cutu_reader *reader, + + if (parent_entry != nullptr) + { +- CORE_ADDR start = form_addr (parent_entry->die_offset, +- reader->cu->per_cu->is_dwz); +- CORE_ADDR end = form_addr (sect_offset (info_ptr - 1 - reader->buffer), ++ /* Both start and end are inclusive, so use both "+ 1" and "- 1" to ++ limit the range to the children of parent_entry. */ ++ CORE_ADDR start ++ = parent_map::form_addr (parent_entry->die_offset + 1, ++ reader->cu->per_cu->is_dwz); ++ CORE_ADDR end ++ = parent_map::form_addr (sect_offset (info_ptr - 1 - reader->buffer), + reader->cu->per_cu->is_dwz); +- m_die_range_map.set_empty (start, end, (void *) parent_entry); ++ set_parent (start, end, parent_entry); + } + + return info_ptr; +@@ -18621,8 +18626,7 @@ cooked_indexer::make_index (cutu_reader *reader) + + for (const auto &entry : m_deferred_entries) + { +- void *obj = m_die_range_map.find (entry.spec_offset); +- cooked_index_entry *parent = static_cast (obj); ++ const cooked_index_entry *parent = find_parent (entry.spec_offset); + m_index_storage->add (entry.die_offset, entry.tag, entry.flags, + entry.name, parent, m_per_cu); + } +-- +2.35.3 + diff --git a/gdb-symtab-find-main-language-without-symtab-expansi.patch b/gdb-symtab-find-main-language-without-symtab-expansi.patch new file mode 100644 index 0000000..71c43d0 --- /dev/null +++ b/gdb-symtab-find-main-language-without-symtab-expansi.patch @@ -0,0 +1,202 @@ +From e2f41776aa9ca2f625bbc50e9bb498e2a95dba25 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Sat, 5 Aug 2023 17:57:13 +0200 +Subject: [PATCH] [gdb/symtab] Find main language without symtab expansion + +When loading an executable using "file a.out", the language is set according +to a.out, which can involve looking up the language of symbol "main", which +will cause the symtab expansion for the containing CU. + +Expansion of lto debug info can be slow, so in commit d3214198119 ("[gdb] Use +partial symbol table to find language for main") a feature was added to avoid +the symtab expansion. + +This feature stopped working after commit 7f4307436fd ("Fix "start" for D, +Rust, etc"). + +[ The commit addresses problems related to command start, which requires finding +the main function: +- for language D, "main" was found instead of "D main", and +- for Rust, the correct function was found, but attributed the wrong name + (not fully qualified). ] + +Reimplement the feature by adding +cooked_index_functions::lookup_global_symbol_language. + +Tested on x86_64-linux. + +PR symtab/30661 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30661 +--- + gdb/dwarf2/read.c | 41 +++++++++++++++++++++++++++++++ + gdb/testsuite/gdb.base/main-c.exp | 33 +++++++++++++++++++++++++ + gdb/testsuite/gdb.cp/main-cp.exp | 33 +++++++++++++++++++++++++ + gdb/testsuite/gdb.cp/main.cc | 22 +++++++++++++++++ + 4 files changed, 129 insertions(+) + create mode 100644 gdb/testsuite/gdb.base/main-c.exp + create mode 100644 gdb/testsuite/gdb.cp/main-cp.exp + create mode 100644 gdb/testsuite/gdb.cp/main.cc + +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index 04bc0e1cbbd..8aa7f8c31e5 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -18621,6 +18621,47 @@ struct cooked_index_functions : public dwarf2_base_index_functions + if (dwarf2_has_info (objfile, nullptr)) + dwarf2_build_psymtabs (objfile); + } ++ ++ enum language lookup_global_symbol_language (struct objfile *objfile, ++ const char *name, ++ domain_enum domain, ++ bool *symbol_found_p) override ++ { ++ *symbol_found_p = false; ++ ++ if (!(domain == VAR_DOMAIN && streq (name, "main"))) ++ return language_unknown; ++ ++ dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile); ++ struct dwarf2_per_bfd *per_bfd = per_objfile->per_bfd; ++ if (per_bfd->index_table == nullptr) ++ return language_unknown; ++ ++ /* Expansion of large CUs can be slow. By returning the language of main ++ here for C and C++, we avoid CU expansion during set_initial_language. ++ But by doing a symbol lookup in the cooked index, we are forced to wait ++ for finalization to complete. See PR symtab/30174 for ideas how to ++ bypass that as well. */ ++ cooked_index_vector *table ++ = (gdb::checked_static_cast ++ (per_objfile->per_bfd->index_table.get ())); ++ table->wait (); ++ ++ for (const cooked_index_entry *entry : table->find (name, false)) ++ { ++ if (entry->tag != DW_TAG_subprogram) ++ continue; ++ ++ enum language lang = entry->per_cu->lang (); ++ if (!(lang == language_c || lang == language_cplus)) ++ continue; ++ ++ *symbol_found_p = true; ++ return lang; ++ } ++ ++ return language_unknown; ++ } + }; + + dwarf2_per_cu_data * +diff --git a/gdb/testsuite/gdb.base/main-c.exp b/gdb/testsuite/gdb.base/main-c.exp +new file mode 100644 +index 00000000000..bcbd0fca7e4 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/main-c.exp +@@ -0,0 +1,33 @@ ++# Copyright 2023 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# Check that finding main to set the current language doesn't cause any symtab ++# to be expanded. ++ ++standard_testfile main.c ++ ++if { [readnow] } { ++ return -1 ++} ++ ++if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { ++ return -1 ++} ++ ++if { ![string eq [have_index $binfile] ""] } { ++ return -1 ++} ++ ++gdb_test_no_output "maint info symtabs" +diff --git a/gdb/testsuite/gdb.cp/main-cp.exp b/gdb/testsuite/gdb.cp/main-cp.exp +new file mode 100644 +index 00000000000..86d626bdbaf +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/main-cp.exp +@@ -0,0 +1,33 @@ ++# Copyright 2023 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# Check that finding main to set the current language doesn't cause any symtab ++# to be expanded. ++ ++standard_testfile main.cc ++ ++if { [readnow] } { ++ return -1 ++} ++ ++if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { ++ return -1 ++} ++ ++if { ![string eq [have_index $binfile] ""] } { ++ return -1 ++} ++ ++gdb_test_no_output "maint info symtabs" +diff --git a/gdb/testsuite/gdb.cp/main.cc b/gdb/testsuite/gdb.cp/main.cc +new file mode 100644 +index 00000000000..c6beff77dbe +--- /dev/null ++++ b/gdb/testsuite/gdb.cp/main.cc +@@ -0,0 +1,22 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2023 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++int ++main (void) ++{ ++ return 0; ++} + +base-commit: ebceffa1196651683a7a6d31abb4b3b5adc6c168 +-- +2.35.3 + diff --git a/gdb-symtab-fix-dw_tag_inlined_subroutine-entries-in-.patch b/gdb-symtab-fix-dw_tag_inlined_subroutine-entries-in-.patch new file mode 100644 index 0000000..d855b27 --- /dev/null +++ b/gdb-symtab-fix-dw_tag_inlined_subroutine-entries-in-.patch @@ -0,0 +1,112 @@ +From 19185006cfe0901da907da4f09fbc197aba976a2 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Fri, 11 Aug 2023 01:36:50 +0200 +Subject: [PATCH 11/11] [gdb/symtab] Fix DW_TAG_inlined_subroutine entries in + the cooked index + +We get incorrect qualified names in the cooked index for +DW_TAG_inlined_subroutine DIEs with abstract origin, due to the fact that the +DIE parent is used instead of the abstract origin. + +Fix this by preferring the abstract origin parent, if available. + +Tested on x86_64-linux. + +PR symtab/30728 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30728 +--- + gdb/dwarf2/read.c | 67 ++++++++++++++++++++++------------------------- + 1 file changed, 32 insertions(+), 35 deletions(-) + +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index e2d4fe8cde6..418acaabc60 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -18369,52 +18369,49 @@ cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu, + const gdb_byte *new_info_ptr = (new_reader->buffer + + to_underlying (origin_offset)); + +- if (*parent_entry == nullptr) ++ gdb_assert (reader->cu->per_cu->is_debug_types ++ == new_reader->cu->per_cu->is_debug_types); ++ CORE_ADDR addr ++ = parent_map::form_addr (origin_offset, origin_is_dwz, ++ reader->cu->per_cu->is_debug_types); ++ if (new_reader->cu == reader->cu) + { +- gdb_assert (reader->cu->per_cu->is_debug_types +- == new_reader->cu->per_cu->is_debug_types); +- CORE_ADDR addr +- = parent_map::form_addr (origin_offset, origin_is_dwz, +- reader->cu->per_cu->is_debug_types); +- if (new_reader->cu == reader->cu) ++ /* Intra-CU case. */ ++ if (new_info_ptr > watermark_ptr) + { +- /* Intra-CU case. */ +- if (new_info_ptr > watermark_ptr) +- { +- /* Defer because origin is not read yet. */ +- *maybe_defer = addr; +- } +- else +- { +- auto tmp = find_parent (addr); +- if (tmp == &parent_map::deferred) +- { +- /* Defer because origin is deferred. */ +- *maybe_defer = addr; +- } +- else +- *parent_entry = tmp; +- } ++ /* Defer because origin is not read yet. */ ++ *maybe_defer = addr; + } + else + { +- /* Inter-CU case. */ +- if (parent_valid (addr)) ++ auto tmp = find_parent (addr); ++ if (tmp == &parent_map::deferred) + { +- auto tmp = find_parent (addr); +- if (tmp == &parent_map::deferred) +- { +- /* Defer because origin is deferred. */ +- *maybe_defer = addr; +- } +- else +- *parent_entry = tmp; ++ /* Defer because origin is deferred. */ ++ *maybe_defer = addr; + } + else ++ *parent_entry = tmp; ++ } ++ } ++ else ++ { ++ /* Inter-CU case. */ ++ if (parent_valid (addr)) ++ { ++ auto tmp = find_parent (addr); ++ if (tmp == &parent_map::deferred) + { +- /* Defer because origin is in other shard. */ ++ /* Defer because origin is deferred. */ + *maybe_defer = addr; + } ++ else ++ *parent_entry = tmp; ++ } ++ else ++ { ++ /* Defer because origin is in other shard. */ ++ *maybe_defer = addr; + } + } + +-- +2.35.3 + diff --git a/gdb-symtab-fix-line-number-of-static-const-class-mem.patch b/gdb-symtab-fix-line-number-of-static-const-class-mem.patch new file mode 100644 index 0000000..5e61420 --- /dev/null +++ b/gdb-symtab-fix-line-number-of-static-const-class-mem.patch @@ -0,0 +1,84 @@ +From e5972def532f3ed248dfbd2f220f28dc367f4ca1 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Fri, 24 Mar 2023 15:45:56 +0100 +Subject: [PATCH 07/12] [gdb/symtab] Fix line number of static const class + member + +Since commit 6d263fe46e0 ("Avoid bad breakpoints with --gc-sections"), there +was a silent regression on openSUSE Leap 15.4 for test-case +gdb.cp/m-static.exp, from: +... +(gdb) info variable everywhere^M +All variables matching regular expression "everywhere":^M +^M +File /home/vries/tmp.local-remote-host-native/m-static.h:^M +8: const int gnu_obj_4::everywhere;^M +(gdb) +... +to: +... +(gdb) info variable everywhere^M +All variables matching regular expression "everywhere":^M +^M +File /data/vries/gdb/src/gdb/testsuite/gdb.cp/m-static.h:^M +8: const int gnu_obj_4::everywhere;^M +^M +File /data/vries/gdb/src/gdb/testsuite/gdb.cp/m-static1.cc:^M +8: const int gnu_obj_4::everywhere;^M +(gdb) +... + +Another regression was found due to that commit, and it was fixed in commit +99d679e7b30 ("[gdb/symtab] Fix "file index out of range" complaint") by +limiting the scope of the fix in the original commit. + +Fix this regression by yet further limiting the scope of that fix, making sure +that this bit in dwarf_decode_lines is executed again for m-static1.cc: +... + /* Make sure a symtab is created for every file, even files + which contain only variables (i.e. no code with associated + line numbers). */ +... + +Tested on x86_64-linux. + +PR symtab/30265 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30265 +--- + gdb/dwarf2/read.c | 3 +-- + gdb/testsuite/gdb.cp/m-static.exp | 4 +++- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index f39eba7a008..04bc0e1cbbd 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -9633,8 +9633,7 @@ handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu, + then there won't be any interesting code in the CU, but a check later on + (in lnp_state_machine::check_line_address) will fail to properly exclude + an entry that was removed via --gc-sections. */ +- if (have_code) +- dwarf_decode_lines (cu->line_header, cu, lowpc, decode_mapping); ++ dwarf_decode_lines (cu->line_header, cu, lowpc, decode_mapping && have_code); + } + + /* Process DW_TAG_compile_unit or DW_TAG_partial_unit. */ +diff --git a/gdb/testsuite/gdb.cp/m-static.exp b/gdb/testsuite/gdb.cp/m-static.exp +index a67b4cd3736..049e88299da 100644 +--- a/gdb/testsuite/gdb.cp/m-static.exp ++++ b/gdb/testsuite/gdb.cp/m-static.exp +@@ -183,8 +183,10 @@ gdb_test "print test4.somewhere" "\\$\[0-9\].* = 3.14\[0-9\]*" "static const flo + if { $non_dwarf } { setup_xfail *-*-* } + gdb_test "info variable everywhere" \ + [multi_line \ ++ {All variables matching regular expression "everywhere":} \ ++ "" \ + "File (.*/)?m-static\[.\]h:" \ +- "$decimal:\tconst int gnu_obj_4::everywhere;.*"] ++ "$decimal:\tconst int gnu_obj_4::everywhere;"] + + # Perhaps at some point test4 should also include a test for a static + # const int that was initialized in the header file. But I'm not sure +-- +2.35.3 + diff --git a/gdb-symtab-fix-too-many-symbols-in-gdbpy_lookup_stat.patch b/gdb-symtab-fix-too-many-symbols-in-gdbpy_lookup_stat.patch new file mode 100644 index 0000000..afadfbe --- /dev/null +++ b/gdb-symtab-fix-too-many-symbols-in-gdbpy_lookup_stat.patch @@ -0,0 +1,66 @@ +From 1362bc937bd54dbd22dd7b3c7ae9d8ab6ca7bbfc Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Wed, 6 Sep 2023 11:00:01 +0200 +Subject: [PATCH 10/12] [gdb/symtab] Fix too many symbols in + gdbpy_lookup_static_symbols + +When running test-case gdb.python/py-symbol.exp with target board +cc-with-dwz-m, we run into: +... +(gdb) python print (len (gdb.lookup_static_symbols ('rr')))^M +4^M +(gdb) FAIL: gdb.python/py-symbol.exp: \ + print (len (gdb.lookup_static_symbols ('rr'))) +... +while with target board unix we have instead: +... +(gdb) python print (len (gdb.lookup_static_symbols ('rr')))^M +2^M +(gdb) PASS: gdb.python/py-symbol.exp: \ + print (len (gdb.lookup_static_symbols ('rr'))) +... + +The problem is that the loop in gdbpy_lookup_static_symbols loops over compunits +representing both CUs and PUs: +... + for (compunit_symtab *cust : objfile->compunits ()) +... + +When doing a lookup on a PU, the user link is followed until we end up at a CU, +and the lookup is done in that CU. + +In other words, when doing a lookup in the loop for a PU we duplicate the +lookup for a CU that is already handled by the loop. + +Fix this by skipping PUs in the loop in gdb.lookup_static_symbols. + +Tested on x86_64-linux. + +PR symtab/25261 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=25261 +--- + gdb/python/py-symbol.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c +index b8777966c47..ed4250bc2c7 100644 +--- a/gdb/python/py-symbol.c ++++ b/gdb/python/py-symbol.c +@@ -582,9 +582,12 @@ gdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw) + { + for (compunit_symtab *cust : objfile->compunits ()) + { +- const struct blockvector *bv; ++ /* Skip included compunits to prevent including compunits from ++ being searched twice. */ ++ if (cust->user != nullptr) ++ continue; + +- bv = cust->blockvector (); ++ const struct blockvector *bv = cust->blockvector (); + const struct block *block = bv->static_block (); + + if (block != nullptr) +-- +2.35.3 + diff --git a/gdb-symtab-handle-nullptr-parent-in-parent_map-set_p.patch b/gdb-symtab-handle-nullptr-parent-in-parent_map-set_p.patch new file mode 100644 index 0000000..d0d24ec --- /dev/null +++ b/gdb-symtab-handle-nullptr-parent-in-parent_map-set_p.patch @@ -0,0 +1,37 @@ +From 933f8ee225d4ccd3db9b81312dba76ae5a50b4ea Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Fri, 25 Aug 2023 09:30:54 +0200 +Subject: [PATCH 03/11] [gdb/symtab] Handle nullptr parent in + parent_map::set_parent + +Set_parent uses m_die_range_map.set_empty, which doesn't allow +parent_entry == nullptr. + +So it may be necessary to guard calls to set_parent with +"if (parent_entry != nullptr)". + +Fix this by handling the parent_entry == nullptr case in set_parent. + +Tested on x86_64-linux. +--- + gdb/dwarf2/cooked-index.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h +index 1c967bdbf86..f4abc7a974e 100644 +--- a/gdb/dwarf2/cooked-index.h ++++ b/gdb/dwarf2/cooked-index.h +@@ -257,7 +257,9 @@ class parent_map + void set_parent (CORE_ADDR start, CORE_ADDR end, + const cooked_index_entry *parent_entry) + { +- m_parent_map.set_empty (start, end, (void *)parent_entry); ++ /* Calling set_empty with nullptr is currently not allowed. */ ++ if (parent_entry != nullptr) ++ m_parent_map.set_empty (start, end, (void *)parent_entry); + } + + private: +-- +2.35.3 + diff --git a/gdb-symtab-handle-pu-in-iterate_over_some_symtabs.patch b/gdb-symtab-handle-pu-in-iterate_over_some_symtabs.patch new file mode 100644 index 0000000..2b0047d --- /dev/null +++ b/gdb-symtab-handle-pu-in-iterate_over_some_symtabs.patch @@ -0,0 +1,59 @@ +From c67e982325c5b2249b0e29d07a9dc1985614e898 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Wed, 6 Sep 2023 10:14:50 +0200 +Subject: [PATCH 08/12] [gdb/symtab] Handle PU in iterate_over_some_symtabs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When running test-case gdb.base/setshow.exp with target board cc-with-dwz I +run into: +... +(gdb) info line 1^M +Line 1 of "setshow.c" is at address 0x400527
but contains no code.^M +Line 1 of "setshow.c" is at address 0x400527
but contains no code.^M +(gdb) FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1 +... +while the expected output is: +... +Line 1 of "setshow.c" is at address 0x400527
but contains no code. +��setshow.c:1:0:beg:0x400527 +... + +The second line of the expected output is missing due to the first line of the +expected output being repeated, so the problem is that the "Line 1" line is +printed twice. + +This happens because the PU imported by the CU reuses the filetab of the CU, +and both the CU and PU are visited by iterate_over_some_symtabs. + +Fix this by skipping PUs in iterate_over_some_symtabs. + +Tested on x86_64-linux, target boards unix, cc-with-dwz and cc-with-dwz-m. + +Approved-By: Tom Tromey + +PR symtab/30797 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30797 +--- + gdb/symtab.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/gdb/symtab.c b/gdb/symtab.c +index a662d7d1869..fe7cc679b6b 100644 +--- a/gdb/symtab.c ++++ b/gdb/symtab.c +@@ -550,6 +550,10 @@ iterate_over_some_symtabs (const char *name, + + for (cust = first; cust != NULL && cust != after_last; cust = cust->next) + { ++ /* Skip included compunits. */ ++ if (cust->user != nullptr) ++ continue; ++ + for (symtab *s : cust->filetabs ()) + { + if (compare_filenames_for_search (s->filename, name)) +-- +2.35.3 + diff --git a/gdb-symtab-handle-self-reference-die.patch b/gdb-symtab-handle-self-reference-die.patch new file mode 100644 index 0000000..2e57175 --- /dev/null +++ b/gdb-symtab-handle-self-reference-die.patch @@ -0,0 +1,159 @@ +From 8f53ac47d3f9c3800c8429d9187961ba81707d8b Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Wed, 16 Aug 2023 23:43:25 +0200 +Subject: [PATCH 1/2] [gdb/symtab] Handle self-reference DIE + +While working on a dwarf assembly test-case I accidentally created the +following pathological dwarf: +... + <1>: Abbrev Number: 3 (DW_TAG_class_type) + DW_AT_name : c1 + DW_AT_specification: <0xbe> +... +and noticed gdb segfaulting during cooked index creating due to running out of +stack. This is a regression from gdb-12, where gdb just hung. + +Fix this by inhibiting the scan_attributes self-recursion for self-references. + +The same test-case with -readnow makes gdb hang, so also fix this in +dwarf2_attr and follow_die_ref. + +Note that this doesn't fix the same problems for the more complicated case of: +... + <1>: Abbrev Number: 3 (DW_TAG_class_type) + DW_AT_name : c1 + DW_AT_specification: <0xc6> + <1>: Abbrev Number: 4 (DW_TAG_class_type) + DW_AT_name : c2 + DW_AT_specification: <0xbe> +... +but the approach for deciding whether to fix pathological dwarf cases is as +per PR27981 comment 3: +... +yes if it is cheap/obvious, and no if it is something complicated or expensive. +... +and at this point I'm not sure whether fixing this will fall in the first +category. + +Tested on x86_64-linux. + +Approved-By: Tom Tromey +--- + gdb/dwarf2/read.c | 22 +++++++++-- + gdb/testsuite/gdb.dwarf2/self-spec.exp | 54 ++++++++++++++++++++++++++ + 2 files changed, 73 insertions(+), 3 deletions(-) + create mode 100644 gdb/testsuite/gdb.dwarf2/self-spec.exp + +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index 61f4bd75013..1be5f381432 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -18289,9 +18289,15 @@ cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu, + new_info_ptr, + &bytes_read); + new_info_ptr += bytes_read; +- scan_attributes (scanning_per_cu, new_reader, new_info_ptr, new_info_ptr, +- new_abbrev, name, linkage_name, flags, nullptr, +- parent_entry, maybe_defer, true); ++ ++ if (new_reader->cu == reader->cu && new_info_ptr == watermark_ptr) ++ { ++ /* Self-reference, we're done. */ ++ } ++ else ++ scan_attributes (scanning_per_cu, new_reader, new_info_ptr, ++ new_info_ptr, new_abbrev, name, linkage_name, ++ flags, nullptr, parent_entry, maybe_defer, true); + } + } + +@@ -19783,7 +19789,11 @@ dwarf2_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *cu) + if (!spec) + break; + ++ struct die_info *prev_die = die; + die = follow_die_ref (die, spec, &cu); ++ if (die == prev_die) ++ /* Self-reference, we're done. */ ++ break; + } + + return NULL; +@@ -22521,6 +22531,12 @@ follow_die_ref (struct die_info *src_die, const struct attribute *attr, + struct dwarf2_cu *cu = *ref_cu; + struct die_info *die; + ++ if (attr->form != DW_FORM_GNU_ref_alt && src_die->sect_off == sect_off) ++ { ++ /* Self-reference, we're done. */ ++ return src_die; ++ } ++ + die = follow_die_offset (sect_off, + (attr->form == DW_FORM_GNU_ref_alt + || cu->per_cu->is_dwz), +diff --git a/gdb/testsuite/gdb.dwarf2/self-spec.exp b/gdb/testsuite/gdb.dwarf2/self-spec.exp +new file mode 100644 +index 00000000000..77e92549fd1 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/self-spec.exp +@@ -0,0 +1,54 @@ ++# Copyright 2023 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# Check that gdb doesn't hang or segfault on reading a DIE with a ++# specification reference to itself. ++ ++load_lib dwarf.exp ++ ++if {![dwarf2_support]} { ++ return 0 ++} ++ ++standard_testfile main.c .S ++ ++# Create the DWARF. ++set asm_file [standard_output_file $srcfile2] ++Dwarf::assemble $asm_file { ++ cu {} { ++ compile_unit {{language @DW_LANG_C_plus_plus}} { ++ declare_labels c1 ++ c1: class_type { ++ {name c1} ++ {specification :$c1} ++ } ++ } ++ } ++} ++ ++if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}] { ++ return -1 ++} ++ ++set index [have_index $binfile] ++if { ![string eq $index ""] } { ++ return 0 ++} ++ ++if { [readnow] } { ++ return 0 ++} ++ ++gdb_test "maint expand-symtabs" + +base-commit: 6c9e159dbd1a35aafa134fcd52982174236a8dd9 +-- +2.35.3 + diff --git a/gdb-symtab-handle-self-reference-in-inherit_abstract.patch b/gdb-symtab-handle-self-reference-in-inherit_abstract.patch new file mode 100644 index 0000000..b2a6977 --- /dev/null +++ b/gdb-symtab-handle-self-reference-in-inherit_abstract.patch @@ -0,0 +1,92 @@ +From 800c393f89a94f49b01dff99f693cb13c5e28116 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 28 Aug 2023 16:27:58 +0200 +Subject: [PATCH 2/2] [gdb/symtab] Handle self-reference in + inherit_abstract_dies + +Building gdb with gcc 7.5.0 and -flto -O2 -flto-partition=one generates a +self-referencing DIE: +... + <2><91dace>: Abbrev Number: 405 (DW_TAG_label) + <91dad0> DW_AT_abstract_origin: <0x91dace> +... + +When encountering the self-reference DIE in inherit_abstract_dies we loop +following the abstract origin, effectively hanging gdb. + +Fix this by handling self-referencing DIEs in the loop in +inherit_abstract_dies. + +Tested on x86_64-linux. + +Approved-By: Tom Tromey + +PR symtab/30799 +https://sourceware.org/bugzilla/show_bug.cgi?id=30799 +--- + gdb/dwarf2/read.c | 7 +++++++ + gdb/testsuite/gdb.dwarf2/self-spec.exp | 16 +++++++++++++++- + 2 files changed, 22 insertions(+), 1 deletion(-) + +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index 1be5f381432..970dd54c7a5 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -11938,8 +11938,15 @@ inherit_abstract_dies (struct die_info *die, struct dwarf2_cu *cu) + if (attr == nullptr) + break; + ++ die_info *prev_child_origin_die = child_origin_die; + child_origin_die = follow_die_ref (child_origin_die, attr, + &child_origin_cu); ++ ++ if (prev_child_origin_die == child_origin_die) ++ { ++ /* Handle DIE with self-reference. */ ++ break; ++ } + } + + /* If missing DW_AT_abstract_origin, try the corresponding child +diff --git a/gdb/testsuite/gdb.dwarf2/self-spec.exp b/gdb/testsuite/gdb.dwarf2/self-spec.exp +index 77e92549fd1..f04ff6da42e 100644 +--- a/gdb/testsuite/gdb.dwarf2/self-spec.exp ++++ b/gdb/testsuite/gdb.dwarf2/self-spec.exp +@@ -14,7 +14,7 @@ + # along with this program. If not, see . + + # Check that gdb doesn't hang or segfault on reading a DIE with a +-# specification reference to itself. ++# specification/abstract_origin reference to itself. + + load_lib dwarf.exp + +@@ -29,11 +29,25 @@ set asm_file [standard_output_file $srcfile2] + Dwarf::assemble $asm_file { + cu {} { + compile_unit {{language @DW_LANG_C_plus_plus}} { ++ # Check handling of self-referencing DIE. + declare_labels c1 + c1: class_type { + {name c1} + {specification :$c1} + } ++ ++ # Check handling of self-referencing child DIE. Regression test ++ # for PR30799. ++ declare_labels f1 abstract_f1 f1_l ++ abstract_f1: subprogram {} ++ f1: subprogram { ++ {MACRO_AT_func {main}} ++ {abstract_origin :$abstract_f1} ++ } { ++ f1_l: label { ++ {abstract_origin :$f1_l} ++ } ++ } + } + } + } +-- +2.35.3 + diff --git a/gdb-symtab-keep-track-of-all-parents-for-cooked-inde.patch b/gdb-symtab-keep-track-of-all-parents-for-cooked-inde.patch new file mode 100644 index 0000000..bee6ba7 --- /dev/null +++ b/gdb-symtab-keep-track-of-all-parents-for-cooked-inde.patch @@ -0,0 +1,38 @@ +From be9718e911aff34896dcf1c3dfa41bfe34e5a9f4 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Thu, 7 Dec 2023 10:38:05 +0100 +Subject: [PATCH 10/11] [gdb/symtab] Keep track of all parents for cooked index + +Keep track of all parents for cooked index. + +Tested on x86_64-linux. +--- + gdb/dwarf2/read.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index 39f6e480e19..e2d4fe8cde6 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -18626,9 +18626,15 @@ cooked_indexer::index_dies (cutu_reader *reader, + }); + } + else +- this_entry = m_index_storage->add (this_die, abbrev->tag, flags, +- name, this_parent_entry, +- m_per_cu); ++ { ++ CORE_ADDR addr ++ = parent_map::form_addr (this_die, reader->cu->per_cu->is_dwz, ++ reader->cu->per_cu->is_debug_types); ++ set_parent (addr, addr, this_parent_entry); ++ this_entry = m_index_storage->add (this_die, abbrev->tag, flags, ++ name, this_parent_entry, ++ m_per_cu); ++ } + } + + if (linkage_name != nullptr) +-- +2.35.3 + diff --git a/gdb-symtab-keep-track-of-processed-dies-in-shard.patch b/gdb-symtab-keep-track-of-processed-dies-in-shard.patch new file mode 100644 index 0000000..6733975 --- /dev/null +++ b/gdb-symtab-keep-track-of-processed-dies-in-shard.patch @@ -0,0 +1,126 @@ +From 439271c6fc28387ea7b6fb6e8bb07963e8b3fd7d Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Sun, 24 Sep 2023 11:41:39 +0200 +Subject: [PATCH 06/11] [gdb/symtab] Keep track of processed DIEs in shard + +For optimizations in two following patches, we keep track in each shard which +DIEs have been processed. + +Tested on x86_64-linux. +--- + gdb/dwarf2/cooked-index.c | 1 + + gdb/dwarf2/cooked-index.h | 15 +++++++++++++++ + gdb/dwarf2/read.c | 24 ++++++++++++++++++++++++ + 3 files changed, 40 insertions(+) + +diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c +index 4a0ccc78c5d..cef57a96384 100644 +--- a/gdb/dwarf2/cooked-index.c ++++ b/gdb/dwarf2/cooked-index.c +@@ -541,6 +541,7 @@ cooked_index_vector::handle_deferred_entries () + { + shard->m_die_range_map.reset (nullptr); + shard->m_deferred_entries.reset (nullptr); ++ shard->m_die_range_map_valid.reset (nullptr); + } + } + +diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h +index a06d99532ed..9d836379666 100644 +--- a/gdb/dwarf2/cooked-index.h ++++ b/gdb/dwarf2/cooked-index.h +@@ -312,6 +312,7 @@ class cooked_index + { + m_die_range_map.reset (new parent_map); + m_deferred_entries.reset (new std::vector); ++ m_die_range_map_valid.reset (new addrmap_mutable); + } + + /* Create a new cooked_index_entry and register it with this object. +@@ -403,6 +404,18 @@ class cooked_index + const cooked_index_entry *resolve_deferred_entry + (const deferred_entry &entry, const cooked_index_entry *parent_entry); + ++ /* Mark parents in range [START, END] as valid . */ ++ void set_parent_valid (CORE_ADDR start, CORE_ADDR end) ++ { ++ m_die_range_map_valid->set_empty (start, end, (void *) 1); ++ } ++ ++ /* Return true if find_parents can be relied upon. */ ++ bool parent_valid (CORE_ADDR addr) ++ { ++ return m_die_range_map_valid->find (addr) != nullptr; ++ } ++ + private: + + /* Return the entry that is believed to represent the program's +@@ -466,6 +479,8 @@ class cooked_index + understand this. */ + std::unique_ptr m_die_range_map; + ++ std::unique_ptr m_die_range_map_valid; ++ + /* The generated DWARF can sometimes have the declaration for a + method in a class (or perhaps namespace) scope, with the + definition appearing outside this scope... just one of the many +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index 41fa8affcd0..ba21b6a14c9 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -6697,6 +6697,12 @@ class cooked_index_storage + m_index->defer_entry (de); + } + ++ /* Mark parents in range [START, END] as valid . */ ++ void set_parent_valid (CORE_ADDR start, CORE_ADDR end) ++ { ++ m_index->set_parent_valid (start, end); ++ } ++ + private: + + /* Hash function for a cutu_reader. */ +@@ -6840,6 +6846,11 @@ class cooked_indexer + { + m_index_storage->defer_entry (de); + } ++ ++ void set_parent_valid (CORE_ADDR start, CORE_ADDR end) ++ { ++ m_index_storage->set_parent_valid (start, end); ++ } + }; + + /* Subroutine of dwarf2_build_psymtabs_hard to simplify it. +@@ -18512,6 +18523,11 @@ cooked_indexer::index_dies (cutu_reader *reader, + + to_underlying (reader->cu->header.sect_off) + + reader->cu->header.get_length ()); + ++ const CORE_ADDR start_cu ++ = parent_map::form_addr (sect_offset (info_ptr - reader->buffer), ++ reader->cu->per_cu->is_dwz, ++ reader->cu->per_cu->is_debug_types); ++ + while (info_ptr < end_ptr) + { + sect_offset this_die = (sect_offset) (info_ptr - reader->buffer); +@@ -18662,6 +18678,14 @@ cooked_indexer::index_dies (cutu_reader *reader, + } + } + ++ { ++ CORE_ADDR end_prev_die ++ = parent_map::form_addr (sect_offset (info_ptr - reader->buffer - 1), ++ reader->cu->per_cu->is_dwz, ++ reader->cu->per_cu->is_debug_types); ++ set_parent_valid (start_cu, end_prev_die); ++ } ++ + return info_ptr; + } + +-- +2.35.3 + diff --git a/gdb-symtab-recurse-into-c-dw_tag_subprogram-dies-for.patch b/gdb-symtab-recurse-into-c-dw_tag_subprogram-dies-for.patch new file mode 100644 index 0000000..97f126a --- /dev/null +++ b/gdb-symtab-recurse-into-c-dw_tag_subprogram-dies-for.patch @@ -0,0 +1,31 @@ +From 541d6970c278dc5a8e9e32246b7139261a687592 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Thu, 7 Dec 2023 10:36:07 +0100 +Subject: [PATCH 09/11] [gdb/symtab] Recurse into c++ DW_TAG_subprogram DIEs + for cooked index + +Recurse into c++ DW_TAG_subprogram DIEs for cooked index, to add +DW_TAG_inlined_subroutine entries. + +Tested on x86_64-linux. +--- + gdb/dwarf2/read.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index d2d50b5c9cc..39f6e480e19 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -18689,7 +18689,8 @@ cooked_indexer::index_dies (cutu_reader *reader, + + case DW_TAG_subprogram: + if ((m_language == language_fortran +- || m_language == language_ada) ++ || m_language == language_ada ++ || m_language == language_cplus) + && this_entry != nullptr) + { + info_ptr = recurse (reader, info_ptr, this_entry, true); +-- +2.35.3 + diff --git a/gdb-symtab-refactor-condition-in-scan_attributes.patch b/gdb-symtab-refactor-condition-in-scan_attributes.patch new file mode 100644 index 0000000..4116a36 --- /dev/null +++ b/gdb-symtab-refactor-condition-in-scan_attributes.patch @@ -0,0 +1,70 @@ +From 0bba1c5bdbcb404327ba4d5f35254b96d2e48108 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 11 Dec 2023 15:41:26 +0100 +Subject: [PATCH 01/11] [gdb/symtab] Refactor condition in scan_attributes + +In scan_attributes there's code: +... + if (new_reader->cu == reader->cu + && new_info_ptr > watermark_ptr + && *parent_entry == nullptr) + ... + else if (*parent_entry == nullptr) + ... +... +that uses the "*parent_entry == nullptr" condition twice. + +Make this somewhat more readable by factoring out the condition: +... + if (*parent_entry == nullptr) + { + if (new_reader->cu == reader->cu + && new_info_ptr > watermark_ptr) + ... + else + ... + } +... + +This also allows us to factor out "form_addr (origin_offset, origin_is_dwz)". + +Tested on x86_64-linux. +--- + gdb/dwarf2/read.c | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index 2339cceb829..00471d20d41 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -18315,15 +18315,17 @@ cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu, + const gdb_byte *new_info_ptr = (new_reader->buffer + + to_underlying (origin_offset)); + +- if (new_reader->cu == reader->cu +- && new_info_ptr > watermark_ptr +- && *parent_entry == nullptr) +- *maybe_defer = form_addr (origin_offset, origin_is_dwz); +- else if (*parent_entry == nullptr) ++ if (*parent_entry == nullptr) + { +- CORE_ADDR lookup = form_addr (origin_offset, origin_is_dwz); +- *parent_entry +- = (cooked_index_entry *) m_die_range_map.find (lookup); ++ CORE_ADDR addr = form_addr (origin_offset, origin_is_dwz); ++ if (new_reader->cu == reader->cu ++ && new_info_ptr > watermark_ptr) ++ *maybe_defer = addr; ++ else ++ { ++ void *obj = m_die_range_map.find (addr); ++ *parent_entry = static_cast (obj); ++ } + } + + unsigned int bytes_read; + +base-commit: d445b7300b129a4886132ec31a23c7c2c894fa75 +-- +2.35.3 + diff --git a/gdb-symtab-resolve-deferred-entries-inter-shard-case.patch b/gdb-symtab-resolve-deferred-entries-inter-shard-case.patch new file mode 100644 index 0000000..7c1c9a4 --- /dev/null +++ b/gdb-symtab-resolve-deferred-entries-inter-shard-case.patch @@ -0,0 +1,502 @@ +From 7464f06e1a7ccf4c5908e563e4cf684744919dac Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Tue, 22 Aug 2023 14:24:42 +0200 +Subject: [PATCH 05/11] [gdb/symtab] Resolve deferred entries, inter-shard case + +Generically solve the case of inter-CU dependencies, including inter-shard +dependencies: +- mark deferred entries in new data structure m_deferred, +- return &parent_map::deferred in find_parent for deferred entries, +- defer all intra-CU dependencies that depend on deferred entries, +- defer all inter-CU dependencies (note that two subsequent patches implement + optimizations to deal with this more optimally), +- move m_die_range_map and m_deferred_dies to cooked_index_shard, and +- move handle_deferred_dies to the cooked_index, where it is called in the + constructor, and update it to handle the intra-shard case. + +Handling units from the .debug_info section alongside units from the +.debug_types section requires us to extend form_addr to take is_debug_types +into account. + +Tested on x86_64-linux. + +PR symtab/30846 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30846 +--- + gdb/dwarf2/cooked-index.c | 77 +++++++++++++++++++++++ + gdb/dwarf2/cooked-index.h | 105 ++++++++++++++++++++++++++++++- + gdb/dwarf2/read.c | 128 ++++++++++++++++++++++---------------- + 3 files changed, 254 insertions(+), 56 deletions(-) + +diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c +index 2b7f9054fe5..4a0ccc78c5d 100644 +--- a/gdb/dwarf2/cooked-index.c ++++ b/gdb/dwarf2/cooked-index.c +@@ -200,6 +200,12 @@ cooked_index_entry::write_scope (struct obstack *storage, + + /* See cooked-index.h. */ + ++cooked_index_entry parent_map::deferred((sect_offset)0, (dwarf_tag)0, ++ (cooked_index_flag)0, nullptr, ++ nullptr, nullptr); ++ ++/* See cooked-index.h. */ ++ + const cooked_index_entry * + cooked_index::add (sect_offset die_offset, enum dwarf_tag tag, + cooked_index_flag flags, const char *name, +@@ -402,6 +408,8 @@ cooked_index::find (const std::string &name, bool completing) + cooked_index_vector::cooked_index_vector (vec_type &&vec) + : m_vector (std::move (vec)) + { ++ handle_deferred_entries (); ++ + for (auto &idx : m_vector) + idx->finalize (); + } +@@ -467,6 +475,75 @@ cooked_index_vector::get_main () const + return result; + } + ++/* See cooked-index.h. */ ++ ++const cooked_index_entry * ++cooked_index::resolve_deferred_entry ++ (const deferred_entry &de, const cooked_index_entry *parent_entry) ++{ ++ reset_parent_deferred (parent_map::form_addr (de.die_offset, de.per_cu_2->is_dwz, ++ de.per_cu_2->is_debug_types)); ++ return add (de.die_offset, de.tag, de.flags, de.name, ++ parent_entry, de.per_cu); ++} ++ ++/* See cooked-index.h. */ ++ ++const cooked_index_entry * ++cooked_index_vector::find_parent_deferred_entry ++ (const cooked_index::deferred_entry &entry) const ++{ ++ const cooked_index_entry *parent_entry = nullptr; ++ for (auto &parent_map_shard : m_vector) ++ { ++ auto res = parent_map_shard->find_parent (entry.spec_offset); ++ if (res != nullptr) ++ { ++ parent_entry = res; ++ break; ++ } ++ } ++ ++ return parent_entry; ++} ++ ++/* See cooked-index.h. */ ++ ++void ++cooked_index_vector::handle_deferred_entries () ++{ ++ bool changed; ++ bool deferred; ++ do ++ { ++ deferred = false; ++ changed = false; ++ for (auto &shard : m_vector) ++ for (auto it = shard->m_deferred_entries->begin (); ++ it != shard->m_deferred_entries->end (); ) ++ { ++ const cooked_index_entry *parent_entry ++ = find_parent_deferred_entry (*it); ++ if (parent_entry == &parent_map::deferred) ++ { ++ deferred = true; ++ it++; ++ continue; ++ } ++ shard->resolve_deferred_entry (*it, parent_entry); ++ it = shard->m_deferred_entries->erase (it); ++ changed = true; ++ } ++ } ++ while (changed && deferred); ++ ++ for (auto &shard : m_vector) ++ { ++ shard->m_die_range_map.reset (nullptr); ++ shard->m_deferred_entries.reset (nullptr); ++ } ++} ++ + void _initialize_cooked_index (); + void + _initialize_cooked_index () +diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h +index f4abc7a974e..a06d99532ed 100644 +--- a/gdb/dwarf2/cooked-index.h ++++ b/gdb/dwarf2/cooked-index.h +@@ -34,6 +34,7 @@ + #include "dwarf2/mapped-index.h" + #include "dwarf2/tag.h" + #include "gdbsupport/range-chain.h" ++#include + + struct dwarf2_per_cu_data; + +@@ -236,19 +237,29 @@ struct cooked_index_entry : public allocate_on_obstack + class parent_map + { + public: ++ /* A dummy cooked_index_entry to mark that computing the parent has been ++ deferred. */ ++ static cooked_index_entry deferred; ++ + /* A helper function to turn a section offset into an address that + can be used in a parent_map. */ +- static CORE_ADDR form_addr (sect_offset offset, bool is_dwz) ++ static CORE_ADDR form_addr (sect_offset offset, bool is_dwz, ++ bool is_debug_types) + { + CORE_ADDR value = to_underlying (offset); + if (is_dwz) + value |= ((CORE_ADDR) 1) << (8 * sizeof (CORE_ADDR) - 1); ++ if (is_debug_types) ++ value |= ((CORE_ADDR) 1) << (8 * sizeof (CORE_ADDR) - 2); + return value; + } + + /* Find the parent of DIE LOOKUP. */ + const cooked_index_entry *find_parent (CORE_ADDR lookup) const + { ++ if (m_deferred.find (lookup) != m_deferred.end ()) ++ return &parent_map::deferred; ++ + const void *obj = m_parent_map.find (lookup); + return static_cast (obj); + } +@@ -259,12 +270,28 @@ class parent_map + { + /* Calling set_empty with nullptr is currently not allowed. */ + if (parent_entry != nullptr) +- m_parent_map.set_empty (start, end, (void *)parent_entry); ++ { ++ gdb_assert (parent_entry != &parent_map::deferred); ++ m_parent_map.set_empty (start, end, (void *)parent_entry); ++ } ++ } ++ ++ void set_parent_deferred (CORE_ADDR addr) ++ { ++ m_deferred.emplace (addr); ++ } ++ ++ void reset_parent_deferred (CORE_ADDR addr) ++ { ++ m_deferred.erase (addr); + } + + private: + /* An addrmap that maps from section offsets to cooked_index_entry *. */ + addrmap_mutable m_parent_map; ++ ++ /* DIEs that are deffered. */ ++ std::unordered_set m_deferred; + }; + + class cooked_index_vector; +@@ -279,9 +306,14 @@ class cooked_index_vector; + class cooked_index + { + public: +- cooked_index () = default; + DISABLE_COPY_AND_ASSIGN (cooked_index); + ++ cooked_index () ++ { ++ m_die_range_map.reset (new parent_map); ++ m_deferred_entries.reset (new std::vector); ++ } ++ + /* Create a new cooked_index_entry and register it with this object. + Entries are owned by this object. The new item is returned. */ + const cooked_index_entry *add (sect_offset die_offset, enum dwarf_tag tag, +@@ -325,6 +357,52 @@ class cooked_index + for completion, will be returned. */ + range find (const std::string &name, bool completing); + ++ /* Find the parent of DIE LOOKUP. */ ++ const cooked_index_entry * ++ find_parent (CORE_ADDR lookup) const ++ { ++ return m_die_range_map->find_parent (lookup); ++ } ++ ++ /* Set the parent of DIES in range [START, END] to PARENT_ENTRY. */ ++ void set_parent (CORE_ADDR start, CORE_ADDR end, ++ const cooked_index_entry *parent_entry) ++ { ++ m_die_range_map->set_parent (start, end, parent_entry); ++ } ++ ++ void set_parent_deferred (CORE_ADDR addr) ++ { ++ m_die_range_map->set_parent_deferred (addr); ++ } ++ ++ void reset_parent_deferred (CORE_ADDR addr) ++ { ++ m_die_range_map->reset_parent_deferred (addr); ++ } ++ ++ /* A single deferred entry. See m_deferred_entries. */ ++ struct deferred_entry ++ { ++ sect_offset die_offset; ++ const char *name; ++ CORE_ADDR spec_offset; ++ dwarf_tag tag; ++ cooked_index_flag flags; ++ dwarf2_per_cu_data *per_cu; ++ dwarf2_per_cu_data *per_cu_2; ++ }; ++ ++ /* Defer creating a cooked_index_entry corresponding to DEFERRED. */ ++ void defer_entry (deferred_entry de) ++ { ++ m_deferred_entries->push_back (de); ++ } ++ ++ /* Variant of add that takes a deferred_entry as parameter. */ ++ const cooked_index_entry *resolve_deferred_entry ++ (const deferred_entry &entry, const cooked_index_entry *parent_entry); ++ + private: + + /* Return the entry that is believed to represent the program's +@@ -382,6 +460,20 @@ class cooked_index + that the 'get' method is never called on this future, only + 'wait'. */ + gdb::future m_future; ++ ++ /* An addrmap that maps from section offsets (see the form_addr ++ method) to newly-created entries. See m_deferred_entries to ++ understand this. */ ++ std::unique_ptr m_die_range_map; ++ ++ /* The generated DWARF can sometimes have the declaration for a ++ method in a class (or perhaps namespace) scope, with the ++ definition appearing outside this scope... just one of the many ++ bad things about DWARF. In order to handle this situation, we ++ defer certain entries until the end of scanning, at which point ++ we'll know the containing context of all the DIEs that we might ++ have scanned. This vector stores these deferred entries. */ ++ std::unique_ptr> m_deferred_entries; + }; + + /* The main index of DIEs. The parallel DIE indexers create +@@ -459,6 +551,13 @@ class cooked_index_vector : public dwarf_scanner_base + + private: + ++ /* Find the parent corresponding to deferred entry ENTRY. */ ++ const cooked_index_entry *find_parent_deferred_entry ++ (const cooked_index::deferred_entry &entry) const; ++ ++ /* Create cooked_index_entries for the deferred entries. */ ++ void handle_deferred_entries (); ++ + /* The vector of cooked_index objects. This is stored because the + entries are stored on the obstacks in those objects. */ + vec_type m_vector; +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index ff5be8e7dc5..41fa8affcd0 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -6672,6 +6672,31 @@ class cooked_index_storage + return &m_addrmap; + } + ++ /* Find the parent of DIE LOOKUP. */ ++ const cooked_index_entry *find_parent (CORE_ADDR lookup) ++ { ++ return m_index->find_parent (lookup); ++ } ++ ++ /* Set the parent of DIES in range [START, END] to PARENT_ENTRY. */ ++ void set_parent (CORE_ADDR start, CORE_ADDR end, ++ const cooked_index_entry *parent_entry) ++ { ++ m_index->set_parent (start, end, parent_entry); ++ } ++ ++ /* Set the parent of DIE at ADDR as deferred. */ ++ void set_parent_deferred (CORE_ADDR addr) ++ { ++ m_index->set_parent_deferred (addr); ++ } ++ ++ /* Defer creating a cooked_index_entry corresponding to deferred_entry DE. */ ++ void defer_entry (cooked_index::deferred_entry de) ++ { ++ m_index->defer_entry (de); ++ } ++ + private: + + /* Hash function for a cutu_reader. */ +@@ -6794,59 +6819,26 @@ class cooked_indexer + /* Find the parent of DIE LOOKUP. */ + const cooked_index_entry *find_parent (CORE_ADDR lookup) const + { +- return m_die_range_map.find_parent (lookup); ++ return m_index_storage->find_parent (lookup); + } + + /* Set the parent of DIES in range [START, END] to PARENT_ENTRY. */ + void set_parent (CORE_ADDR start, CORE_ADDR end, + const cooked_index_entry *parent_entry) + { +- m_die_range_map.set_parent (start, end, parent_entry); ++ m_index_storage->set_parent (start, end, parent_entry); + } + +- /* A single deferred entry. */ +- struct deferred_entry +- { +- sect_offset die_offset; +- const char *name; +- CORE_ADDR spec_offset; +- dwarf_tag tag; +- cooked_index_flag flags; +- }; +- +- /* The generated DWARF can sometimes have the declaration for a +- method in a class (or perhaps namespace) scope, with the +- definition appearing outside this scope... just one of the many +- bad things about DWARF. In order to handle this situation, we +- defer certain entries until the end of scanning, at which point +- we'll know the containing context of all the DIEs that we might +- have scanned. This vector stores these deferred entries. */ +- std::vector m_deferred_entries; +- +- /* Defer creating a cooked_index_entry corresponding to deferred_entry DE. */ +- void defer_entry (const deferred_entry &de) ++ /* Set the parent of DIE at ADDR as deferred. */ ++ void set_parent_deferred (CORE_ADDR addr) + { +- m_deferred_entries.push_back (de); ++ m_index_storage->set_parent_deferred (addr); + } + +- /* Create a cooked_index_entry corresponding to deferred_entry DE with +- parent PARENT_ENTRY. */ +- const cooked_index_entry *resolve_deferred_entry +- (const deferred_entry &de, const cooked_index_entry *parent_entry) +- { +- return m_index_storage->add (de.die_offset, de.tag, de.flags, de.name, +- parent_entry, m_per_cu); +- } +- +- /* Create cooked_index_entries for the deferred entries. */ +- void handle_deferred_entries () ++ /* Defer creating a cooked_index_entry corresponding to deferred_entry DE. */ ++ void defer_entry (const cooked_index::deferred_entry &de) + { +- for (const auto &entry : m_deferred_entries) +- { +- const cooked_index_entry *parent_entry +- = find_parent (entry.spec_offset); +- resolve_deferred_entry (entry, parent_entry); +- } ++ m_index_storage->defer_entry (de); + } + }; + +@@ -18346,13 +18338,36 @@ cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu, + + if (*parent_entry == nullptr) + { ++ gdb_assert (reader->cu->per_cu->is_debug_types ++ == new_reader->cu->per_cu->is_debug_types); + CORE_ADDR addr +- = parent_map::form_addr (origin_offset, origin_is_dwz); +- if (new_reader->cu == reader->cu +- && new_info_ptr > watermark_ptr) +- *maybe_defer = addr; ++ = parent_map::form_addr (origin_offset, origin_is_dwz, ++ reader->cu->per_cu->is_debug_types); ++ if (new_reader->cu == reader->cu) ++ { ++ /* Intra-CU case. */ ++ if (new_info_ptr > watermark_ptr) ++ { ++ /* Defer because origin is not read yet. */ ++ *maybe_defer = addr; ++ } ++ else ++ { ++ auto tmp = find_parent (addr); ++ if (tmp == &parent_map::deferred) ++ { ++ /* Defer because origin is deferred. */ ++ *maybe_defer = addr; ++ } ++ else ++ *parent_entry = tmp; ++ } ++ } + else +- *parent_entry = find_parent (addr); ++ { ++ /* Inter-CU case. */ ++ *maybe_defer = addr; ++ } + } + + unsigned int bytes_read; +@@ -18475,10 +18490,12 @@ cooked_indexer::recurse (cutu_reader *reader, + limit the range to the children of parent_entry. */ + CORE_ADDR start + = parent_map::form_addr (parent_entry->die_offset + 1, +- reader->cu->per_cu->is_dwz); ++ reader->cu->per_cu->is_dwz, ++ reader->cu->per_cu->is_debug_types); + CORE_ADDR end + = parent_map::form_addr (sect_offset (info_ptr - 1 - reader->buffer), +- reader->cu->per_cu->is_dwz); ++ reader->cu->per_cu->is_dwz, ++ reader->cu->per_cu->is_debug_types); + set_parent (start, end, parent_entry); + } + +@@ -18545,9 +18562,16 @@ cooked_indexer::index_dies (cutu_reader *reader, + if (name != nullptr) + { + if (defer != 0) +- defer_entry ({ +- this_die, name, defer, abbrev->tag, flags +- }); ++ { ++ CORE_ADDR addr ++ = parent_map::form_addr (this_die, reader->cu->per_cu->is_dwz, ++ reader->cu->per_cu->is_debug_types); ++ set_parent_deferred (addr); ++ defer_entry ({ ++ this_die, name, defer, abbrev->tag, flags, m_per_cu, ++ reader->cu->per_cu ++ }); ++ } + else + this_entry = m_index_storage->add (this_die, abbrev->tag, flags, + name, this_parent_entry, +@@ -18649,8 +18673,6 @@ cooked_indexer::make_index (cutu_reader *reader) + if (!reader->comp_unit_die->has_children) + return; + index_dies (reader, reader->info_ptr, nullptr, false); +- +- handle_deferred_entries (); + } + + /* An implementation of quick_symbol_functions for the cooked DWARF +-- +2.35.3 + diff --git a/gdb-symtab-resolve-deferred-entries-intra-shard-case.patch b/gdb-symtab-resolve-deferred-entries-intra-shard-case.patch new file mode 100644 index 0000000..d843f34 --- /dev/null +++ b/gdb-symtab-resolve-deferred-entries-intra-shard-case.patch @@ -0,0 +1,120 @@ +From a4bf216accd43b25ea9b9b7507c93eb973872a82 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Sun, 24 Sep 2023 11:43:24 +0200 +Subject: [PATCH 07/11] [gdb/symtab] Resolve deferred entries, intra-shard case + +In patch "[gdb/symtab] Resolve deferred entries, inter-shard case" we've +solved the generic case of handling deferred entries. + +Now add an optimization that handles deferred entries with an intra-shard +dependency in the parallel for. + +Tested on x86_64-linux. +--- + gdb/dwarf2/cooked-index.c | 35 +++++++++++++++++++++++++++++++++++ + gdb/dwarf2/cooked-index.h | 7 +++++++ + gdb/dwarf2/read.c | 10 ++++++++++ + 3 files changed, 52 insertions(+) + +diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c +index cef57a96384..d8a12bee265 100644 +--- a/gdb/dwarf2/cooked-index.c ++++ b/gdb/dwarf2/cooked-index.c +@@ -408,6 +408,7 @@ cooked_index::find (const std::string &name, bool completing) + cooked_index_vector::cooked_index_vector (vec_type &&vec) + : m_vector (std::move (vec)) + { ++ /* Handle deferred entries, inter-cu case. */ + handle_deferred_entries (); + + for (auto &idx : m_vector) +@@ -477,6 +478,40 @@ cooked_index_vector::get_main () const + + /* See cooked-index.h. */ + ++const cooked_index_entry * ++cooked_index::find_parent_deferred_entry ++ (const cooked_index::deferred_entry &entry) const ++{ ++ return find_parent (entry.spec_offset); ++} ++ ++/* See cooked-index.h. */ ++ ++void ++cooked_index::handle_deferred_entries () ++{ ++ for (auto it = m_deferred_entries->begin (); it != m_deferred_entries->end (); ) ++ { ++ const deferred_entry & deferred_entry = *it; ++ if (!parent_valid (deferred_entry.spec_offset)) ++ { ++ it++; ++ continue; ++ } ++ const cooked_index_entry *parent_entry ++ = find_parent_deferred_entry (deferred_entry); ++ if (parent_entry == &parent_map::deferred) ++ { ++ it++; ++ continue; ++ } ++ resolve_deferred_entry (deferred_entry, parent_entry); ++ it = m_deferred_entries->erase (it); ++ } ++} ++ ++/* See cooked-index.h. */ ++ + const cooked_index_entry * + cooked_index::resolve_deferred_entry + (const deferred_entry &de, const cooked_index_entry *parent_entry) +diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h +index 9d836379666..bda1ed1e155 100644 +--- a/gdb/dwarf2/cooked-index.h ++++ b/gdb/dwarf2/cooked-index.h +@@ -404,6 +404,13 @@ class cooked_index + const cooked_index_entry *resolve_deferred_entry + (const deferred_entry &entry, const cooked_index_entry *parent_entry); + ++ /* Find the parent entry for deferred_entry ENTRY. */ ++ const cooked_index_entry *find_parent_deferred_entry ++ (const cooked_index::deferred_entry &entry) const; ++ ++ /* Create cooked_index_entries for the deferred entries. */ ++ void handle_deferred_entries (); ++ + /* Mark parents in range [START, END] as valid . */ + void set_parent_valid (CORE_ADDR start, CORE_ADDR end) + { +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index ba21b6a14c9..0ab3e1a1500 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -6697,6 +6697,12 @@ class cooked_index_storage + m_index->defer_entry (de); + } + ++ /* Handle deferred entries, intra-cu case. */ ++ void handle_deferred_entries () ++ { ++ m_index->handle_deferred_entries (); ++ } ++ + /* Mark parents in range [START, END] as valid . */ + void set_parent_valid (CORE_ADDR start, CORE_ADDR end) + { +@@ -7183,6 +7189,10 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile) + errors.push_back (std::move (except)); + } + } ++ ++ /* Handle deferred entries, intra-cu case. */ ++ thread_storage.handle_deferred_entries (); ++ + return result_type (thread_storage.release (), std::move (errors)); + }, task_size); + +-- +2.35.3 + diff --git a/gdb-symtab-set-default-dwarf-max-cache-age-1000.patch b/gdb-symtab-set-default-dwarf-max-cache-age-1000.patch new file mode 100644 index 0000000..fcfeadc --- /dev/null +++ b/gdb-symtab-set-default-dwarf-max-cache-age-1000.patch @@ -0,0 +1,13 @@ +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index f8797537108..cb8f86fa352 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -1250,7 +1250,7 @@ struct field_info + compilation units. Set this to zero to disable caching. Cache + sizes of up to at least twenty will improve startup time for + typical inter-CU-reference binaries, at an obvious memory cost. */ +-static int dwarf_max_cache_age = 5; ++static int dwarf_max_cache_age = 1000; + static void + show_dwarf_max_cache_age (struct ui_file *file, int from_tty, + struct cmd_list_element *c, const char *value) diff --git a/gdb-symtab-work-around-gas-pr28629.patch b/gdb-symtab-work-around-gas-pr28629.patch new file mode 100644 index 0000000..cac66a4 --- /dev/null +++ b/gdb-symtab-work-around-gas-pr28629.patch @@ -0,0 +1,278 @@ +From b1136560e772dd4c74f1fbb41f6ba840b92fb9d6 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Wed, 1 Nov 2023 00:33:12 +0100 +Subject: [PATCH 2/2] [gdb/symtab] Work around gas PR28629 + +When running test-case gdb.tui/tui-layout-asm-short-prog.exp on AlmaLinux 9.2 +ppc64le, I run into: +... +FAIL: gdb.tui/tui-layout-asm-short-prog.exp: check asm box contents +... + +The problem is that we get: +... + 7 [ No Assembly Available ] +... +because tui_get_begin_asm_address doesn't succeed. + +In more detail, tui_get_begin_asm_address calls: +... + find_line_pc (sal.symtab, sal.line, &addr); +... +with: +... +(gdb) p *sal.symtab +$5 = {next = 0x130393c0, m_compunit = 0x130392f0, m_linetable = 0x0, + filename = "tui-layout-asm-short-prog.S", + filename_for_id = "$gdb/build/gdb/testsuite/tui-layout-asm-short-prog.S", + m_language = language_asm, fullname = 0x0} +(gdb) p sal.line +$6 = 1 +... + +The problem is the filename_for_id which is the source file prefixed with the +compilation dir rather than the source dir. + +This is due to faulty debug info generated by gas, PR28629: +... + <1a> DW_AT_name : tui-layout-asm-short-prog.S + <1e> DW_AT_comp_dir : $gdb/build/gdb/testsuite + <22> DW_AT_producer : GNU AS 2.35.2 +... + +The DW_AT_name is relative, and it's relative to the DW_AT_comp_dir entry, +making the effective name $gdb/build/gdb/testsuite/tui-layout-asm-short-prog.S. + +The bug is fixed starting version 2.38, where we get instead: +... + <1a> DW_AT_name : + $gdb/src/gdb/testsuite/gdb.tui/tui-layout-asm-short-prog.S + <1e> DW_AT_comp_dir : $gdb/build/gdb/testsuite + <22> DW_AT_producer : GNU AS 2.38 +... + +Work around the faulty debug info by constructing the filename_for_id using +the second directory from the directory table in the .debug_line header: +... + The Directory Table (offset 0x22, lines 2, columns 1): + Entry Name + 0 $gdb/build/gdb/testsuite + 1 $gdb/src/gdb/testsuite/gdb.tui +... + +Note that the used gas contains a backport of commit 3417bfca676 ("GAS: +DWARF-5: Ensure that the 0'th entry in the directory table contains the +current working directory."), because directory 0 is correct. With the +unpatched 2.35.2 release the directory 0 entry is incorrect: it's a copy of +entry 1. + +Add a dwarf assembly test-case that reflects the debug info as generated by +unpatched gas 2.35.2. + +Tested on x86_64-linux. + +Approved-By: Tom Tromey +--- + gdb/dwarf2/cu.c | 1 + + gdb/dwarf2/cu.h | 1 + + gdb/dwarf2/read.c | 37 +++++++- + .../gdb.dwarf2/dw2-gas-workaround.exp | 94 +++++++++++++++++++ + 4 files changed, 132 insertions(+), 1 deletion(-) + create mode 100644 gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp + +diff --git a/gdb/dwarf2/cu.c b/gdb/dwarf2/cu.c +index 42fd4f4441b..6b5d956649f 100644 +--- a/gdb/dwarf2/cu.c ++++ b/gdb/dwarf2/cu.c +@@ -40,6 +40,7 @@ dwarf2_cu::dwarf2_cu (dwarf2_per_cu_data *per_cu, + producer_is_icc_lt_14 (false), + producer_is_codewarrior (false), + producer_is_clang (false), ++ producer_is_gas_lt_2_38 (false), + producer_is_gas_2_39 (false), + processing_has_namespace_info (false), + load_all_dies (false) +diff --git a/gdb/dwarf2/cu.h b/gdb/dwarf2/cu.h +index 710aeb5b237..9b1e8775ff4 100644 +--- a/gdb/dwarf2/cu.h ++++ b/gdb/dwarf2/cu.h +@@ -265,6 +265,7 @@ struct dwarf2_cu + bool producer_is_icc_lt_14 : 1; + bool producer_is_codewarrior : 1; + bool producer_is_clang : 1; ++ bool producer_is_gas_lt_2_38 : 1; + bool producer_is_gas_2_39 : 1; + + /* When true, the file that we're processing is known to have +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index 472684a5817..2339cceb829 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -146,6 +146,8 @@ static int dwarf2_loclist_index; + static int dwarf2_locexpr_block_index; + static int dwarf2_loclist_block_index; + ++static bool producer_is_gas_lt_2_38 (struct dwarf2_cu *cu); ++ + /* Size of .debug_loclists section header for 32-bit DWARF format. */ + #define LOCLIST_HEADER_SIZE32 12 + +@@ -9663,6 +9665,27 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu) + + file_and_directory &fnd = find_file_and_directory (die, cu); + ++ /* GAS supports generating dwarf-5 info starting version 2.35. Versions ++ 2.35-2.37 generate an incorrect CU name attribute: it's relative, ++ implicitly prefixing it with the compilation dir. Work around this by ++ prefixing it with the source dir instead. */ ++ if (cu->header.version == 5 && !IS_ABSOLUTE_PATH (fnd.get_name ()) ++ && producer_is_gas_lt_2_38 (cu)) ++ { ++ attr = dwarf2_attr (die, DW_AT_stmt_list, cu); ++ if (attr != nullptr && attr->form_is_unsigned ()) ++ { ++ sect_offset line_offset = (sect_offset) attr->as_unsigned (); ++ line_header_up lh = dwarf_decode_line_header (line_offset, cu, ++ fnd.get_comp_dir ()); ++ if (lh->version == 5 && lh->is_valid_file_index (1)) ++ { ++ std::string dir = lh->include_dir_at (1); ++ fnd.set_comp_dir (std::move (dir)); ++ } ++ } ++ } ++ + cu->start_compunit_symtab (fnd.get_name (), fnd.intern_comp_dir (objfile), + lowpc); + +@@ -13377,7 +13400,10 @@ check_producer (struct dwarf2_cu *cu) + else if (producer_is_clang (cu->producer, &major, &minor)) + cu->producer_is_clang = true; + else if (producer_is_gas (cu->producer, &major, &minor)) +- cu->producer_is_gas_2_39 = major == 2 && minor == 39; ++ { ++ cu->producer_is_gas_lt_2_38 = major < 2 || (major == 2 && minor < 38); ++ cu->producer_is_gas_2_39 = major == 2 && minor == 39; ++ } + else + { + /* For other non-GCC compilers, expect their behavior is DWARF version +@@ -13413,6 +13439,15 @@ producer_is_codewarrior (struct dwarf2_cu *cu) + return cu->producer_is_codewarrior; + } + ++static bool ++producer_is_gas_lt_2_38 (struct dwarf2_cu *cu) ++{ ++ if (!cu->checked_producer) ++ check_producer (cu); ++ ++ return cu->producer_is_gas_lt_2_38; ++} ++ + static bool + producer_is_gas_2_39 (struct dwarf2_cu *cu) + { +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp b/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp +new file mode 100644 +index 00000000000..416778f51b7 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/dw2-gas-workaround.exp +@@ -0,0 +1,94 @@ ++# Copyright 2023 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# Test line number information in various configurations. ++ ++load_lib dwarf.exp ++ ++# This test can only be run on targets which support DWARF-2 and use gas. ++if { ![dwarf2_support] } { ++ return -1 ++} ++ ++standard_testfile dw2-lines.c -dw2.S ++ ++with_shared_gdb { ++ set func_info_vars [get_func_info bar] ++} ++ ++# Helper function. ++proc line_for { l } { ++ global srcfile ++ set line [gdb_get_line_number "$l:" $srcfile] ++ return [expr $line + 1] ++} ++ ++set asm_file [standard_output_file $srcfile2] ++Dwarf::assemble $asm_file { ++ declare_labels Llines ++ global srcdir subdir srcfile objdir ++ global func_info_vars ++ foreach var $func_info_vars { ++ global $var ++ } ++ ++ cu { version 5 } { ++ compile_unit { ++ {language @DW_LANG_Mips_Assembler} ++ {name $srcfile} ++ {comp_dir $objdir} ++ {stmt_list $Llines DW_FORM_sec_offset} ++ {producer "GNU AS 2.35.2"} ++ } { ++ subprogram { ++ {external 1 flag} ++ {name bar} ++ {low_pc $bar_start addr} ++ {high_pc "$bar_start + $bar_len" addr} ++ } ++ } ++ } ++ ++ lines [list version 5] Llines { ++ set diridx1 [include_dir "${srcdir}/${subdir}"] ++ set diridx2 [include_dir "${srcdir}/${subdir}"] ++ file_name "$srcfile" $diridx1 ++ file_name "$srcfile" $diridx2 ++ ++ program { ++ DW_LNE_set_address bar_label ++ line [line_for bar_label] ++ DW_LNS_copy ++ ++ DW_LNE_set_address bar_label_2 ++ DW_LNE_end_sequence ++ } ++ } ++} ++ ++if { [prepare_for_testing "failed to prepare" ${testfile} \ ++ [list $srcfile $asm_file] {nodebug}] } { ++ return -1 ++} ++ ++gdb_test_no_output "set debug symtab-create 1" ++gdb_test_multiple "ptype bar" "" { ++ -re -wrap "$objdir.*" { ++ fail $gdb_test_name ++ } ++ -re -wrap "" { ++ pass $gdb_test_name ++ } ++} +-- +2.35.3 + diff --git a/gdb-symtab-work-around-pr-gas-29517.patch b/gdb-symtab-work-around-pr-gas-29517.patch new file mode 100644 index 0000000..e01ff39 --- /dev/null +++ b/gdb-symtab-work-around-pr-gas-29517.patch @@ -0,0 +1,255 @@ +From 92a5f5ae1b71d152d943ee896bf6cd073d50daa7 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Thu, 28 Sep 2023 13:55:07 +0200 +Subject: [PATCH 02/12] [gdb/symtab] Work around PR gas/29517 + +When using glibc debuginfo generated with gas 2.39, we run into PR gas/29517: +... +$ gdb -q -batch a.out -ex start -ex "p (char *)strstr (\"haha\", \"ah\")" +Temporary breakpoint 1 at 0x40051b: file hello.c, line 6. + +Temporary breakpoint 1, main () at hello.c:6 +6 printf ("hello\n"); +Invalid cast. +... +while without glibc debuginfo installed we get the expected result: +... +$n = 0x7ffff7daa1b1 "aha" +... +and likewise with glibc debuginfo generated with gas 2.40. + +The strstr ifunc resolves to __strstr_sse2_unaligned. The problem is that gas +generates dwarf that states that the return type is void: +... +<1><3e1e58>: Abbrev Number: 2 (DW_TAG_subprogram) + <3e1e59> DW_AT_name : __strstr_sse2_unaligned + <3e1e5d> DW_AT_external : 1 + <3e1e5e> DW_AT_low_pc : 0xbbd2e + <3e1e66> DW_AT_high_pc : 0xbc1c3 +... +while the return type should be a DW_TAG_unspecified_type, as is the case +with gas 2.40. + +We can still use the workaround of casting to another function type for both +__strstr_sse2_unaligned: +... +(gdb) p ((char * (*) (const char *, const char *))__strstr_sse2_unaligned) \ + ("haha", "ah") +$n = 0x7ffff7daa211 "aha" +... +and strstr (which requires using *strstr to dereference the ifunc before we +cast): +... +gdb) p ((char * (*) (const char *, const char *))*strstr) ("haha", "ah") +$n = 0x7ffff7daa251 "aha" +... +but that's a bit cumbersome to use. + +Work around this in the dwarf reader, such that we have instead: +... +(gdb) p (char *)strstr ("haha", "ah") +$n = 0x7ffff7daa1b1 "aha" +... + +This also requires fixing producer_is_gcc to stop returning true for +producer "GNU AS 2.39.0". + +Tested on x86_64-linux. + +PR symtab/30911 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30911 +--- + gdb/dwarf2/cu.c | 1 + + gdb/dwarf2/cu.h | 1 + + gdb/dwarf2/read.c | 22 ++++++++++++ + gdb/producer.c | 8 ++++- + .../gdb.dwarf2/dw2-unspecified-type.c | 9 ++++- + .../gdb.dwarf2/dw2-unspecified-type.exp | 36 +++++++++++++++---- + 6 files changed, 68 insertions(+), 9 deletions(-) + +diff --git a/gdb/dwarf2/cu.c b/gdb/dwarf2/cu.c +index 9c1691c90e9..42fd4f4441b 100644 +--- a/gdb/dwarf2/cu.c ++++ b/gdb/dwarf2/cu.c +@@ -40,6 +40,7 @@ dwarf2_cu::dwarf2_cu (dwarf2_per_cu_data *per_cu, + producer_is_icc_lt_14 (false), + producer_is_codewarrior (false), + producer_is_clang (false), ++ producer_is_gas_2_39 (false), + processing_has_namespace_info (false), + load_all_dies (false) + { +diff --git a/gdb/dwarf2/cu.h b/gdb/dwarf2/cu.h +index e8dbde9c019..710aeb5b237 100644 +--- a/gdb/dwarf2/cu.h ++++ b/gdb/dwarf2/cu.h +@@ -265,6 +265,7 @@ struct dwarf2_cu + bool producer_is_icc_lt_14 : 1; + bool producer_is_codewarrior : 1; + bool producer_is_clang : 1; ++ bool producer_is_gas_2_39 : 1; + + /* When true, the file that we're processing is known to have + debugging info for C++ namespaces. GCC 3.3.x did not produce +diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c +index b9e7e18f2a6..f39eba7a008 100644 +--- a/gdb/dwarf2/read.c ++++ b/gdb/dwarf2/read.c +@@ -13370,6 +13370,8 @@ check_producer (struct dwarf2_cu *cu) + cu->producer_is_codewarrior = true; + else if (producer_is_clang (cu->producer, &major, &minor)) + cu->producer_is_clang = true; ++ else if (startswith (cu->producer, "GNU AS 2.39.0")) ++ cu->producer_is_gas_2_39 = true; + else + { + /* For other non-GCC compilers, expect their behavior is DWARF version +@@ -13405,6 +13407,15 @@ producer_is_codewarrior (struct dwarf2_cu *cu) + return cu->producer_is_codewarrior; + } + ++static bool ++producer_is_gas_2_39 (struct dwarf2_cu *cu) ++{ ++ if (!cu->checked_producer) ++ check_producer (cu); ++ ++ return cu->producer_is_gas_2_39; ++} ++ + /* Return the accessibility of DIE, as given by DW_AT_accessibility. + If that attribute is not available, return the appropriate + default. */ +@@ -16581,6 +16592,17 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu) + + type = die_type (die, cu); + ++ if (type->code () == TYPE_CODE_VOID ++ && !type->is_stub () ++ && die->child == nullptr ++ && producer_is_gas_2_39 (cu)) ++ { ++ /* Work around PR gas/29517, pretend we have an DW_TAG_unspecified_type ++ return type. */ ++ type = init_type (cu->per_objfile->objfile, TYPE_CODE_VOID, 0, NULL); ++ type->set_is_stub (true); ++ } ++ + /* The die_type call above may have already set the type for this DIE. */ + ftype = get_die_type (die, cu); + if (ftype) +diff --git a/gdb/producer.c b/gdb/producer.c +index 655eb971283..9fcf749e3d4 100644 +--- a/gdb/producer.c ++++ b/gdb/producer.c +@@ -54,13 +54,19 @@ producer_is_gcc (const char *producer, int *major, int *minor) + if (minor == NULL) + minor = &min; + ++ /* Skip GNU. */ ++ cs = &producer[strlen ("GNU ")]; ++ ++ /* Bail out for GNU AS. */ ++ if (startswith (cs, "AS ")) ++ return 0; ++ + /* Skip any identifier after "GNU " - such as "C11" "C++" or "Java". + A full producer string might look like: + "GNU C 4.7.2" + "GNU Fortran 4.8.2 20140120 (Red Hat 4.8.2-16) -mtune=generic ..." + "GNU C++14 5.0.0 20150123 (experimental)" + */ +- cs = &producer[strlen ("GNU ")]; + while (*cs && !isspace (*cs)) + cs++; + if (*cs && isspace (*cs)) +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.c b/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.c +index 1df09214d4a..e07d9517ff2 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.c ++++ b/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.c +@@ -17,9 +17,16 @@ + + extern int foo (void); + ++int ++bar (void) ++{ ++ asm ("bar_label: .globl bar_label"); ++ return 0; ++} ++ + int + main (void) + { +- int res = foo (); ++ int res = foo () + bar (); + return res; + } +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.exp b/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.exp +index a353395592e..bd707204fba 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.exp ++++ b/gdb/testsuite/gdb.dwarf2/dw2-unspecified-type.exp +@@ -29,10 +29,18 @@ lassign $foo_res \ + foo_start foo_len + set foo_end "$foo_start + $foo_len" + ++set bar_res \ ++ [function_range bar \ ++ [list ${srcdir}/${subdir}/$srcfile ${srcdir}/${subdir}/$srcfile2]] ++lassign $bar_res \ ++ bar_start bar_len ++set bar_end "$bar_start + $bar_len" ++ + # Create the DWARF. + set asm_file [standard_output_file $srcfile3] + Dwarf::assemble $asm_file { + global foo_start foo_end ++ global bar_start bar_end + declare_labels unspecified_type_label + + cu {} { +@@ -47,7 +55,19 @@ Dwarf::assemble $asm_file { + {high_pc $foo_end addr} + {type :$unspecified_type_label} + } ++ } ++ } + ++ cu {} { ++ compile_unit { ++ {language @DW_LANG_Mips_Assembler} ++ {producer "GNU AS 2.39.0"} ++ } { ++ DW_TAG_subprogram { ++ {name bar} ++ {low_pc $bar_start addr} ++ {high_pc $bar_end addr} ++ } + } + } + } +@@ -61,12 +81,14 @@ if ![runto_main] { + return -1 + } + +-# Print the function type. Return type should be stub type, which is printed +-# as void. +-gdb_test "ptype foo" "type = void \\(void\\)" ++foreach f {foo bar} { ++ # Print the function type. Return type should be stub type, which is printed ++ # as void. ++ gdb_test "ptype $f" "type = void \\(void\\)" + +-# Call the function, casting the function to the correct function type. +-gdb_test "p ((int (*) ()) foo) ()" " = 0" ++ # Call the function, casting the function to the correct function type. ++ gdb_test "p ((int (*) ()) $f) ()" " = 0" + +-# Call the function, casting the function result to the correct type. +-gdb_test "p (int) foo ()" " = 0" ++ # Call the function, casting the function result to the correct type. ++ gdb_test "p (int) $f ()" " = 0" ++} +-- +2.35.3 + diff --git a/gdb-tdep-aarch64-fix-frame-address-of-last-insn.patch b/gdb-tdep-aarch64-fix-frame-address-of-last-insn.patch new file mode 100644 index 0000000..fe8224d --- /dev/null +++ b/gdb-tdep-aarch64-fix-frame-address-of-last-insn.patch @@ -0,0 +1,140 @@ +From 433568090645c05d3b7fdbb1a4ae0887e96d9cc0 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 23 Jan 2023 16:49:36 +0100 +Subject: [PATCH 1/2] [gdb/tdep, aarch64] Fix frame address of last insn + +Consider the test-case test.c, compiled without debug info: +... +void +foo (const char *s) +{ +} + +int +main (void) +{ + foo ("foo"); + return 0; +} +... + +Disassembly of foo: +... +0000000000400564 : + 400564: d10043ff sub sp, sp, #0x10 + 400568: f90007e0 str x0, [sp, #8] + 40056c: d503201f nop + 400570: 910043ff add sp, sp, #0x10 + 400574: d65f03c0 ret +... + +Now, let's do "info frame" at each insn in foo, as well as printing $sp +and $x29 (and strip the output of info frame to the first line, for brevity): +... +$ gdb -q a.out +Reading symbols from a.out... +(gdb) b *foo +Breakpoint 1 at 0x400564 +(gdb) r +Starting program: a.out + +Breakpoint 1, 0x0000000000400564 in foo () +(gdb) display /x $sp +1: /x $sp = 0xfffffffff3a0 +(gdb) display /x $x29 +2: /x $x29 = 0xfffffffff3a0 +(gdb) info frame +Stack level 0, frame at 0xfffffffff3a0: +(gdb) si +0x0000000000400568 in foo () +1: /x $sp = 0xfffffffff390 +2: /x $x29 = 0xfffffffff3a0 +(gdb) info frame +Stack level 0, frame at 0xfffffffff3a0: +(gdb) si +0x000000000040056c in foo () +1: /x $sp = 0xfffffffff390 +2: /x $x29 = 0xfffffffff3a0 +(gdb) info frame +Stack level 0, frame at 0xfffffffff3a0: +(gdb) si +0x0000000000400570 in foo () +1: /x $sp = 0xfffffffff390 +2: /x $x29 = 0xfffffffff3a0 +(gdb) info frame +Stack level 0, frame at 0xfffffffff3a0: +(gdb) si +0x0000000000400574 in foo () +1: /x $sp = 0xfffffffff3a0 +2: /x $x29 = 0xfffffffff3a0 +(gdb) info frame +Stack level 0, frame at 0xfffffffff3b0: + pc = 0x400574 in foo; saved pc = 0x40058c +(gdb) si +0x000000000040058c in main () +1: /x $sp = 0xfffffffff3a0 +2: /x $x29 = 0xfffffffff3a0 +... + +The "frame at" bit lists 0xfffffffff3a0 except at the last insn, where it +lists 0xfffffffff3b0. + +The frame address is calculated here in aarch64_make_prologue_cache_1: +... + unwound_fp = get_frame_register_unsigned (this_frame, cache->framereg); + if (unwound_fp == 0) + return; + + cache->prev_sp = unwound_fp + cache->framesize; +... + +For insns after the prologue, we have cache->framereg == sp and +cache->framesize == 16, so unwound_fp + cache->framesize gives the wrong +answer once sp has been restored to entry value by the before-last insn. + +Fix this by detecting the situation that the sp has been restored. + +This fixes PRs tdep/30010 and tdep/30011. + +This also fixes the aarch64 FAILs in gdb.reverse/solib-precsave.exp and +gdb.reverse/solib-reverse.exp I reported in PR gdb/PR29721. + +Tested on aarch64-linux. +PR tdep/30010 +PR tdep/30011 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30010 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30011 +--- + gdb/aarch64-tdep.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c +index 3cc0d3b234d..499b87ef480 100644 +--- a/gdb/aarch64-tdep.c ++++ b/gdb/aarch64-tdep.c +@@ -145,6 +145,8 @@ static const char *const aarch64_mte_register_names[] = + "tag_ctl" + }; + ++static int aarch64_stack_frame_destroyed_p (struct gdbarch *, CORE_ADDR); ++ + /* AArch64 prologue cache structure. */ + struct aarch64_prologue_cache + { +@@ -996,7 +998,10 @@ aarch64_make_prologue_cache_1 (frame_info_ptr this_frame, + if (unwound_fp == 0) + return; + +- cache->prev_sp = unwound_fp + cache->framesize; ++ cache->prev_sp = unwound_fp; ++ if (!aarch64_stack_frame_destroyed_p (get_frame_arch (this_frame), ++ cache->prev_pc)) ++ cache->prev_sp += cache->framesize; + + /* Calculate actual addresses of saved registers using offsets + determined by aarch64_analyze_prologue. */ + +base-commit: 11c93dc64f6137214809583d9c5a775b18b4f027 +-- +2.35.3 + diff --git a/gdb-tdep-fix-nr-array-elements-in-ppc64_aggregate_ca.patch b/gdb-tdep-fix-nr-array-elements-in-ppc64_aggregate_ca.patch new file mode 100644 index 0000000..9720b49 --- /dev/null +++ b/gdb-tdep-fix-nr-array-elements-in-ppc64_aggregate_ca.patch @@ -0,0 +1,86 @@ +From 3f0c512dc37dbede372a018732d315726a56d10e Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Wed, 1 Nov 2023 08:07:15 +0100 +Subject: [PATCH] [gdb/tdep] Fix nr array elements in ppc64_aggregate_candidate + +On AlmaLinux 9.2 powerpc64le I run into: +... +(gdb) PASS: gdb.ada/array_return.exp: continuing to Create_Small_Float_Vector +finish^M +Run till exit from #0 pck.create_small_float_vector () at pck.adb:30^M +0x00000000100022d4 in p () at p.adb:25^M +25 Vector := Create_Small_Float_Vector;^M +Value returned is $3 = (2.80259693e-45, 2.80259693e-45)^M +(gdb) FAIL: gdb.ada/array_return.exp: value printed by finish of Create_Small_Float_Vector +... +while this is expected: +... +Value returned is $3 = (4.25, 4.25)^M +... + +The problem is here in ppc64_aggregate_candidate: +... + if (!get_array_bounds (type, &low_bound, &high_bound)) + return -1; + count *= high_bound - low_bound +... + +The array type (containing 2 elements) is: +... + type Small_Float_Vector is array (1 .. 2) of Float; +... +so we have: +... +(gdb) p low_bound +$1 = 1 +(gdb) p high_bound +$2 = 2 +... +but we calculate the number of elements in the array using +"high_bound - low_bound", which is 1. + +Consequently, gdb fails to correctly classify the type as a ELFv2 homogeneous +aggregate. + +Fix this by calculating the number of elements in the array by using +"high_bound - low_bound + 1" instead. + +Furthermore, high_bound can (in general, though perhaps not here) be also be +smaller than low_bound, so to be safe take that into account as well: +... + LONGEST nr_array_elements = (low_bound > high_bound + ? 0 + : (high_bound - low_bound + 1)); + count *= nr_array_elements; +... + +Tested on powerpc64le-linux. + +PR tdep/31015 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31015 +--- + gdb/ppc-sysv-tdep.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c +index 9cea63307e6..dc89201eed2 100644 +--- a/gdb/ppc-sysv-tdep.c ++++ b/gdb/ppc-sysv-tdep.c +@@ -1126,7 +1126,11 @@ ppc64_aggregate_candidate (struct type *type, + + if (!get_array_bounds (type, &low_bound, &high_bound)) + return -1; +- count *= high_bound - low_bound; ++ ++ LONGEST nr_array_elements = (low_bound > high_bound ++ ? 0 ++ : (high_bound - low_bound + 1)); ++ count *= nr_array_elements; + + /* There must be no padding. */ + if (count == 0) + +base-commit: b1136560e772dd4c74f1fbb41f6ba840b92fb9d6 +-- +2.35.3 + diff --git a/gdb-test-bt-cfi-without-die.patch b/gdb-test-bt-cfi-without-die.patch new file mode 100644 index 0000000..6167c14 --- /dev/null +++ b/gdb-test-bt-cfi-without-die.patch @@ -0,0 +1,214 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-test-bt-cfi-without-die.patch + +;; [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604). +;;=fedoratest + +http://sourceware.org/ml/archer/2010-q3/msg00028.html + +On Wed, 25 Feb 2009 00:14:29 +0100, Jan Kratochvil wrote: +> commit 6a37c2b9962258ecf9299cc34a650e64a06acaa5 +> +> There was a regression on gdb.base/savedregs.exp. +> +> quick_addrmap/require_partial_symbols should be used even for the unwind debug +> info checking as its load has been also delayed by this branch. +[...] +> --- a/gdb/dwarf2-frame.c +> +++ b/gdb/dwarf2-frame.c +[...] +> @@ -1499,6 +1500,14 @@ dwarf2_frame_find_fde (CORE_ADDR *pc) +> struct dwarf2_fde *fde; +> CORE_ADDR offset; +> +> + if (objfile->quick_addrmap) +> + { +> + if (!addrmap_find (objfile->quick_addrmap, *pc)) +> + continue; +> + } +> + /* FIXME: Read-in only .debug_frame/.eh_frame without .debug_info? */ +> + require_partial_symbols (objfile); +> + + +but this has caused a different regression (as discussed in the confcall). + +QUICK_ADDRMAP is built only from .debug_aranges. But we can have existing +built .debug_aranges for CUs in OBJFILE but still some CUs do not need to have +DWARF at all while they can feature CFIs (.eh_frame or .debug_frame). +It has been described by Daniel Jacobowitz at: + Re: [2/4] RFC: check psymtabs_addrmap before reading FDEs + http://sourceware.org/ml/gdb-patches/2010-07/msg00012.html + +Sorry for this regression by me (in that fix of a different regression). + +Fixed it the "slow way" as this branch is now obsoleted by .gdb-index. + +No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu. + +Checked-in. + +Thanks, +Jan + +eb8df8566acc1ed963e3e9b77c13b9c2c3db03fb + +Test CFI is parsed even for range (function) not described by any DIE. + +https://bugzilla.redhat.com/show_bug.cgi?id=614028 + +gdb/ + * dwarf2-frame.c (dwarf2_frame_find_fde): Remove the + OBJFILE->QUICK_ADDRMAP check. New comment why. + +gdb/testsuite/ + * gdb.base/cfi-without-die.exp, gdb.base/cfi-without-die-main.c, + gdb.base/cfi-without-die-caller.c: New files. + +diff --git a/gdb/testsuite/gdb.base/cfi-without-die-caller.c b/gdb/testsuite/gdb.base/cfi-without-die-caller.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/cfi-without-die-caller.c +@@ -0,0 +1,28 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++typedef int (*callback_t) (void); ++ ++int ++caller (callback_t callback) ++{ ++ /* Ensure some frame content to push away the return address. */ ++ volatile const long one = 1; ++ ++ /* Modify the return value to prevent any tail-call optimization. */ ++ return (*callback) () - one; ++} +diff --git a/gdb/testsuite/gdb.base/cfi-without-die-main.c b/gdb/testsuite/gdb.base/cfi-without-die-main.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/cfi-without-die-main.c +@@ -0,0 +1,32 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++typedef int (*callback_t) (void); ++ ++extern int caller (callback_t callback); ++ ++int ++callback (void) ++{ ++ return 1; ++} ++ ++int ++main (void) ++{ ++ return caller (callback); ++} +diff --git a/gdb/testsuite/gdb.base/cfi-without-die.exp b/gdb/testsuite/gdb.base/cfi-without-die.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.base/cfi-without-die.exp +@@ -0,0 +1,71 @@ ++# Copyright 2010 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# Test CFI is parsed even for range (function) not described by any DIE. ++ ++set testfile cfi-without-die ++set srcmainfile ${testfile}-main.c ++set srccallerfile ${testfile}-caller.c ++set executable ${testfile} ++set objmainfile [standard_output_file ${testfile}-main.o] ++set objcallerfile [standard_output_file ${testfile}-caller.o] ++set binfile [standard_output_file ${executable}] ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srccallerfile}" ${objcallerfile} \ ++ object [list {additional_flags=-fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables}]] != "" ++ || [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" ${objmainfile} object {debug}] != "" ++ || [gdb_compile "${objmainfile} ${objcallerfile}" ${binfile} executable {}] != "" } { ++ untested ${testfile}.exp ++ return -1 ++} ++ ++clean_restart $executable ++ ++if ![runto callback] then { ++ fail "verify unwinding: Can't run to callback" ++ return 0 ++} ++set test "verify unwinding breaks without CFI" ++gdb_test_multiple "bt" $test { ++ -re " in \[?\]\[?\] .*\r\n$gdb_prompt $" { ++ # It may backtrace through some random frames even to main(). ++ pass $test ++ } ++ -re " in main .*\r\n$gdb_prompt $" { ++ fail $test ++ } ++ -re "\r\n$gdb_prompt $" { ++ pass $test ++ } ++} ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srccallerfile}" ${objcallerfile} \ ++ object [list {additional_flags=-fomit-frame-pointer -funwind-tables -fasynchronous-unwind-tables}]] != "" ++ || [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" ${objmainfile} object {debug}] != "" ++ || [gdb_compile "${objmainfile} ${objcallerfile}" ${binfile} executable {}] != "" } { ++ untested ${testfile}.exp ++ return -1 ++} ++ ++clean_restart $executable ++ ++if ![runto callback] then { ++ fail "test CFI without DIEs: Can't run to callback" ++ return 0 ++} ++# #0 callback () at ... ++# #1 0x00000000004004e9 in caller () ++# #2 0x00000000004004cd in main () at ... ++gdb_test "bt" "#0 +callback \[^\r\n\]+\r\n#1 \[^\r\n\]+ in caller \[^\r\n\]+\r\n#2 \[^\r\n\]+ in main \[^\r\n\]+" "verify unwindin works for CFI without DIEs" diff --git a/gdb-test-dw2-aranges.patch b/gdb-test-dw2-aranges.patch new file mode 100644 index 0000000..458e8ba --- /dev/null +++ b/gdb-test-dw2-aranges.patch @@ -0,0 +1,220 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-test-dw2-aranges.patch + +;; [archer-tromey-delayed-symfile] New test gdb.dwarf2/dw2-aranges.exp. +;;=fedoratest + +[archer-tromey-delayed-symfile] + +commit 77fa7778a37b0d28a7e4e5235f074a10ecf1815d +Author: Jan Kratochvil +Date: Sat Aug 15 15:05:54 2009 +0200 + + Test for "handle incorrect aranges". + + readelf: + Contents of the .debug_aranges section: + + Length: 8 + Version: 2 + Offset into .debug_info: 0x0 + Pointer Size: 0 + Segment Size: 0 + + Address Length + Floating point exception + + * gdb.dwarf2/dw2-aranges.exp, gdb.dwarf2/dw2-aranges.S: New files. + +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.S b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S +@@ -0,0 +1,140 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2004, 2007, 2008, 2009 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* Test .debug_aranges containing zero address_size. */ ++ ++/* Dummy function to provide debug information for. */ ++ ++ .text ++.Lbegin_text1: ++ .globl main ++ .type main, %function ++main: ++.Lbegin_main: ++ .int 0 ++.Lend_main: ++ .size main, .-main ++.Lend_text1: ++ ++/* Debug information */ ++ ++ .section .debug_info ++.Lcu1_begin: ++ /* CU header */ ++ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */ ++.Lcu1_start: ++ .2byte 2 /* DWARF Version */ ++ .4byte .Labbrev1_begin /* Offset into abbrev section */ ++ .byte 4 /* Pointer size */ ++ ++ /* CU die */ ++ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ ++ .4byte .Lend_text1 /* DW_AT_high_pc */ ++ .4byte .Lbegin_text1 /* DW_AT_low_pc */ ++ .ascii "file1.txt\0" /* DW_AT_name */ ++ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */ ++ .byte 1 /* DW_AT_language (C) */ ++ ++ /* main */ ++ .uleb128 2 /* Abbrev: DW_TAG_subprogram */ ++ .byte 1 /* DW_AT_external */ ++ .byte 1 /* DW_AT_decl_file */ ++ .byte 2 /* DW_AT_decl_line */ ++ .ascii "main\0" /* DW_AT_name */ ++ .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */ ++ .4byte .Lbegin_main /* DW_AT_low_pc */ ++ .4byte .Lend_main /* DW_AT_high_pc */ ++ .byte 1 /* DW_AT_frame_base: length */ ++ .byte 0x55 /* DW_AT_frame_base: DW_OP_reg5 */ ++ ++.Ltype_int: ++ .uleb128 3 /* Abbrev: DW_TAG_base_type */ ++ .ascii "int\0" /* DW_AT_name */ ++ .byte 4 /* DW_AT_byte_size */ ++ .byte 5 /* DW_AT_encoding */ ++ ++ .byte 0 /* End of children of CU */ ++ ++.Lcu1_end: ++ ++/* Abbrev table */ ++ .section .debug_abbrev ++.Labbrev1_begin: ++ .uleb128 1 /* Abbrev code */ ++ .uleb128 0x11 /* DW_TAG_compile_unit */ ++ .byte 1 /* has_children */ ++ .uleb128 0x12 /* DW_AT_high_pc */ ++ .uleb128 0x1 /* DW_FORM_addr */ ++ .uleb128 0x11 /* DW_AT_low_pc */ ++ .uleb128 0x1 /* DW_FORM_addr */ ++ .uleb128 0x3 /* DW_AT_name */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .uleb128 0x25 /* DW_AT_producer */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .uleb128 0x13 /* DW_AT_language */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 2 /* Abbrev code */ ++ .uleb128 0x2e /* DW_TAG_subprogram */ ++ .byte 0 /* has_children */ ++ .uleb128 0x3f /* DW_AT_external */ ++ .uleb128 0xc /* DW_FORM_flag */ ++ .uleb128 0x3a /* DW_AT_decl_file */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .uleb128 0x3b /* DW_AT_decl_line */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .uleb128 0x3 /* DW_AT_name */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .uleb128 0x49 /* DW_AT_type */ ++ .uleb128 0x13 /* DW_FORM_ref4 */ ++ .uleb128 0x11 /* DW_AT_low_pc */ ++ .uleb128 0x1 /* DW_FORM_addr */ ++ .uleb128 0x12 /* DW_AT_high_pc */ ++ .uleb128 0x1 /* DW_FORM_addr */ ++ .uleb128 0x40 /* DW_AT_frame_base */ ++ .uleb128 0xa /* DW_FORM_block1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .uleb128 3 /* Abbrev code */ ++ .uleb128 0x24 /* DW_TAG_base_type */ ++ .byte 0 /* has_children */ ++ .uleb128 0x3 /* DW_AT_name */ ++ .uleb128 0x8 /* DW_FORM_string */ ++ .uleb128 0xb /* DW_AT_byte_size */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .uleb128 0x3e /* DW_AT_encoding */ ++ .uleb128 0xb /* DW_FORM_data1 */ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++ .byte 0x0 /* Terminator */ ++ .byte 0x0 /* Terminator */ ++ ++/* aranges table */ ++ .section .debug_aranges ++ .long .Laranges_end - 1f ++1: ++ .2byte 2 /* aranges Version */ ++ .4byte .Lcu1_begin - .debug_info /* Offset into .debug_info section */ ++ /* The GDB crasher is this zero value. */ ++ .byte 0 /* aranges address_size */ ++ .byte 0 /* aranges segment_size */ ++ ++.Laranges_end: +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.dwarf2/dw2-aranges.exp +@@ -0,0 +1,40 @@ ++# Copyright 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# Test .debug_aranges containing zero address_size. ++ ++# This test can only be run on targets which support DWARF-2 and use gas. ++# For now pick a sampling of likely targets. ++if {![istarget *-*-linux*] ++ && ![istarget *-*-gnu*] ++ && ![istarget *-*-elf*] ++ && ![istarget *-*-openbsd*] ++ && ![istarget arm-*-eabi*] ++ && ![istarget powerpc-*-eabi*]} { ++ return 0 ++} ++ ++set testfile "dw2-aranges" ++set srcfile ${testfile}.S ++set binfile [standard_output_file ${testfile}] ++ ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {nodebug}] != "" } { ++ return -1 ++} ++ ++clean_restart $testfile ++ ++# Failed gdb_load would abort the testcase execution earlier. ++pass "file loaded" diff --git a/gdb-test-pid0-core.patch b/gdb-test-pid0-core.patch new file mode 100644 index 0000000..fea4def --- /dev/null +++ b/gdb-test-pid0-core.patch @@ -0,0 +1,92 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Fedora GDB patches +Date: Fri, 27 Oct 2017 21:07:50 +0200 +Subject: gdb-test-pid0-core.patch + +;; New test gdb.arch/x86_64-pid0-core.exp for kernel PID 0 cores (BZ 611435). +;;=fedoratest + +https://bugzilla.redhat.com/show_bug.cgi?id=611435 + +Fix: +Re: [RFA]corelow.c: Add tid to add_to_thread_list +http://sourceware.org/ml/gdb-patches/2010-08/msg00085.html +http://sourceware.org/ml/gdb-cvs/2010-08/msg00026.html +2e5bcfdef1ec3883d48c3f87a4be5c0dff25e17e + +diff --git a/gdb/testsuite/gdb.arch/x86_64-pid0-core.core.bz2.uu b/gdb/testsuite/gdb.arch/x86_64-pid0-core.core.bz2.uu +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/x86_64-pid0-core.core.bz2.uu +@@ -0,0 +1,20 @@ ++begin 600 x86_64-pid0-core.core.bz2 ++M0EIH.3%!629362,CA>P!$/'_____^*#EZ-A!SP36P&_:G0#=14``04A&8,'U ++M2*9`>$$)P`*RN"#*;#4R()IJ8C$TT&FC3$&@`T`#:C1H8C0T,@,FC,D"4T2! ++M"/2CU'B90]31ZAD#U`&AZF@/4:``!HT&F@!H<`#0-`-#0``#3$-&F@```#0R ++M``#")2FD]2>4]0TTT-!HTT--,0,"#$`R!I@AD`#1H,3&GZT.4TO$#H40/`0C ++M2$IRXS,<55!8T,&&,R.Z441"?J9I%G6GUA2!.[]Z"C5S[&19,%VS7E6[3"60 ++M@`-*2G)QEQ(;?0Y<=MK]/U?Q)LB%+F37TJ9BI*46)H'*Z@V"`"$"P7]&XZ:JE0E<*:#1M$P3G]>VCI)(A!O$64`5$4`E$$-.``7&(09`8HO`B6K!Q^& ++M562%N)2+0@*HB@%D@5$%!*0!L1&0D4D6\:-$A`)`+<6D82PP*H(J(H!?F;0$ ++M%PXB7N!2D4!44`W7"ADEQM6O9TBO5,_]1) ++M($Q2))#),UE,QQK)E$,3D\W.>!4)QO8A_@^Z_SXS4;Q8=HV6[:&$@2$@$R29IBW)K%3"O` ++M9^Y0YJ&BXY1U2HTZ5)2H-V\_(.DZHWE+C#WS($(!I"3CUH2#(+(OWUV"*<<9 ++MJ%A!J[%O.P&V%GI.`L7<1@0>,^1F\MY=V5UT,&NOG%7TTZ[03!@BHB@&)P` ++` ++end +diff --git a/gdb/testsuite/gdb.arch/x86_64-pid0-core.exp b/gdb/testsuite/gdb.arch/x86_64-pid0-core.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/x86_64-pid0-core.exp +@@ -0,0 +1,46 @@ ++# This testcase is part of GDB, the GNU debugger. ++# ++# Copyright 2010 Free Software Foundation, Inc. ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ ++# Some kernel core files have PID 0 - for the idle task. ++ ++if ![istarget "x86_64-*-*"] { ++ verbose "Skipping x86_64-pid0-core test." ++ return ++} ++ ++set testfile "x86_64-pid0-core" ++set corebz2uufile ${srcdir}/${subdir}/${testfile}.core.bz2.uu ++set corefile [standard_output_file ${testfile}.core] ++ ++if {[catch "system \"uudecode -o - ${corebz2uufile} | bzip2 -dc >${corefile}\""] != 0} { ++ untested "failed uudecode or bzip2" ++ return -1 ++} ++file stat ${corefile} corestat ++if {$corestat(size) != 8798208} { ++ untested "uudecode or bzip2 produce invalid result" ++ return -1 ++} ++ ++gdb_exit ++gdb_start ++gdb_reinitialize_dir $srcdir/$subdir ++ ++# Former crash was: ++# thread.c:884: internal-error: switch_to_thread: Assertion `inf != NULL' failed. ++gdb_test "core-file ${corefile}" "Program terminated with signal (11|SIGSEGV), Segmentation fault\\.\r\n.*" diff --git a/gdb-testsuite-ada-pie.patch b/gdb-testsuite-ada-pie.patch new file mode 100644 index 0000000..48efb36 --- /dev/null +++ b/gdb-testsuite-ada-pie.patch @@ -0,0 +1,118 @@ +From e9faa078c28b14386609a12d307471cb142547d6 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Fri, 21 Apr 2023 09:12:35 +0200 +Subject: [PATCH 2/5] [gdb/testsuite] Compile ada hello world for + skip_ada_tests + +For openSUSE Leap 15.0 with gcc-PIE installed (which makes gcc create PIE +executables by default) we get: +... +FAIL: gdb.ada/O2_float_param.exp: compilation foo.adb +... + +The problem is that while gcc-PIE affects gcc, it does not affect gnatlink, +so it links in the libgnat.a, rather than libgnat_pic.a. [ This is +bsc#1115034. ] + +[ Without gcc-PIE, we have a related problem: if we run ada tests with +--target_board=unix/-fPIE/-pie, which makes sure PIE executables are generated +for c/c++ test-cases, still we get non-PIE ada executables, because gnatmake +does not pass -pie to gnatlink. And if gnatmake would pass -pie to gnatlink, +we'd run into the same FAIL as above because gnatlink does not use use +libgnat_pic.a when -pie is specified (this is PR gcc/87936). So, in order to +have ada tests generate PIE executables, we need +--target_board=unix/-fPIE/-largs/-pie/-lgnat_pic/-margs, which will not work +with c/c++ test-cases. ] + +For now, we check whether we can compile an ada hello world, and if not, +generate an UNSUPPORTED in either skip_ada_tests or gdb_compile_ada, to +not have this problem result in ~200 FAILs. + +gdb/testsuite/ChangeLog: + +2020-11-06 Tom de Vries + + * lib/ada.exp (gdb_compile_ada): Call gdb_can_compile_ada. + (gdb_can_compile_ada): New gdb_caching_proc. + * lib/gdb.exp: Add load_lib ada.exp. + (skip_ada_tests): Return 1 if !gdb_can_compile_ada. +--- + gdb/testsuite/lib/ada.exp | 31 +++++++++++++++++++++++++++++++ + gdb/testsuite/lib/gdb.exp | 6 ++++++ + 2 files changed, 37 insertions(+) + +diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp +index f5bf2dcbb71..48dcd00bbe3 100644 +--- a/gdb/testsuite/lib/ada.exp ++++ b/gdb/testsuite/lib/ada.exp +@@ -85,12 +85,43 @@ proc gdb_compile_ada_1 {source dest type options} { + # compile was successful. + + proc gdb_compile_ada {source dest type options} { ++ if { [gdb_can_compile_ada] == 0 } { ++ global gdb_test_file_name ++ unsupported "$gdb_test_file_name" ++ return "Cannot compile ada" ++ } + set result [gdb_compile_ada_1 $source $dest $type $options] + + gdb_compile_test $source $result + return $result + } + ++gdb_caching_proc gdb_can_compile_ada { ++ set name "hello" ++ set dir "[pwd]/tmp-ada-hello-[pid]" ++ set src "$dir/$name.adb" ++ set dest "$dir/$name" ++ ++ set code { ++ with Ada.Text_IO; ++ ++ procedure Hello is ++ begin ++ Ada.Text_IO.Put_Line("Hello, world!"); ++ end Hello; ++ } ++ ++ file mkdir $dir ++ gdb_produce_source $src $code ++ set res [gdb_compile_ada_1 $src $dest executable {debug}] ++ file delete -force $dir ++ ++ if { $res != "" } { ++ return 0 ++ } ++ return 1 ++} ++ + # Like standard_testfile, but for Ada. Historically the Ada tests + # used a different naming convention from many of the other gdb tests, + # and this difference was preserved during the conversion to +diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp +index 31856fa3721..85c0bfb897f 100644 +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -137,6 +137,7 @@ load_lib cache.exp + load_lib gdb-utils.exp + load_lib memory.exp + load_lib check-test-names.exp ++load_lib ada.exp + + # The path to the GDB binary to test. + global GDB +@@ -2450,6 +2451,11 @@ proc skip_fortran_tests {} { + # Return a 1 if I don't even want to try to test ada. + + proc skip_ada_tests {} { ++ if { [gdb_can_compile_ada] == 0 } { ++ global gdb_test_file_name ++ unsupported "$gdb_test_file_name" ++ return 1 ++ } + return 0 + } + +-- +2.35.3 + diff --git a/gdb-testsuite-add-basic-lmap-for-tcl-8.6.patch b/gdb-testsuite-add-basic-lmap-for-tcl-8.6.patch new file mode 100644 index 0000000..d839302 --- /dev/null +++ b/gdb-testsuite-add-basic-lmap-for-tcl-8.6.patch @@ -0,0 +1,80 @@ +From f54470964a1781c0e5a92b5ff2f1979a79b4a4b1 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 24 Apr 2023 14:48:06 +0200 +Subject: [PATCH 1/9] [gdb/testsuite] Add basic lmap for tcl < 8.6 + +With test-case gdb.dwarf2/dw2-abs-hi-pc.exp and tcl 8.5, I run into: +... +ERROR: tcl error sourcing gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp. +ERROR: invalid command name "lmap" + while executing +"::gdb_tcl_unknown lmap i {dw2-abs-hi-pc.c dw2-abs-hi-pc-hello.c \ + dw2-abs-hi-pc-world.c} { expr { "$srcdir/$subdir/$i" } }" +... + +Fix this by adding basic lmap support for tcl version < 8.6. + +Tested on x86_64-linux. +--- + gdb/testsuite/gdb.testsuite/lmap.exp | 20 ++++++++++++++++++++ + gdb/testsuite/lib/gdb.exp | 15 +++++++++++++++ + 2 files changed, 35 insertions(+) + create mode 100644 gdb/testsuite/gdb.testsuite/lmap.exp + +diff --git a/gdb/testsuite/gdb.testsuite/lmap.exp b/gdb/testsuite/gdb.testsuite/lmap.exp +new file mode 100644 +index 00000000000..501e18bdd92 +--- /dev/null ++++ b/gdb/testsuite/gdb.testsuite/lmap.exp +@@ -0,0 +1,20 @@ ++# Copyright 2023 Free Software Foundation, Inc. ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++set one 1 ++set l1 { $one 2 } ++set res1 [lmap item $l1 {expr $item + 1}] ++gdb_assert { [lindex $res1 0] == 2 } ++gdb_assert { [lindex $res1 1] == 3 } ++gdb_assert { $item == 2 } +diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp +index b6e30204371..0b8a15f61cb 100644 +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -1524,6 +1524,21 @@ if { [tcl_version_at_least 8 5] == 0 } { + } + } + ++if { [tcl_version_at_least 8 6] == 0 } { ++ # lmap was added in tcl 8.6. Only add if missing. ++ ++ # Note that we only implement the simple variant for now. ++ proc lmap { varname list body } { ++ set res {} ++ foreach val $list { ++ uplevel 1 "set $varname $val" ++ lappend res [uplevel 1 $body] ++ } ++ ++ return $res ++ } ++} ++ + # gdb_test_no_output [-prompt PROMPT_REGEXP] [-nopass] COMMAND [MESSAGE] + # Send a command to GDB and verify that this command generated no output. + # + +base-commit: fdf0253385db9239c44ea5a4ec879eeeae12fca1 +-- +2.35.3 + diff --git a/gdb-testsuite-add-gdb.suse-debranding.exp.patch b/gdb-testsuite-add-gdb.suse-debranding.exp.patch new file mode 100644 index 0000000..b5bee13 --- /dev/null +++ b/gdb-testsuite-add-gdb.suse-debranding.exp.patch @@ -0,0 +1,68 @@ +From b08bf94f170dd39db21cf8f62941f1866b6978c0 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Thu, 16 Feb 2023 11:36:47 +0100 +Subject: [PATCH 080/155] Add gdb.suse/debranding.exp + +--- + gdb/testsuite/gdb.suse/debranding.exp | 49 +++++++++++++++++++++++++++ + 1 file changed, 49 insertions(+) + create mode 100644 gdb/testsuite/gdb.suse/debranding.exp + +diff --git a/gdb/testsuite/gdb.suse/debranding.exp b/gdb/testsuite/gdb.suse/debranding.exp +new file mode 100644 +index 00000000000..cdee10b75a7 +--- /dev/null ++++ b/gdb/testsuite/gdb.suse/debranding.exp +@@ -0,0 +1,49 @@ ++# Copyright 2023 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# There's a problem with dumping the entire output into gdb.log ++# on SLE-11, so redirect to file instead. Also means the gdb.log ++# is smaller. ++set f [standard_output_file "gdb-strings.txt"] ++ ++# Not using remote_exec due to using file redirection. ++set cmd "exec strings $GDB > $f" ++set status [catch $cmd msg] ++verbose -log "status: $status" ++verbose -log "msg: $msg" ++gdb_assert { $status == 0 } ++ ++set fp [open $f r] ++set output [read $fp] ++close $fp ++ ++set re {^.*(?:fedora|red[^a-z]?hat).*$} ++set matches [regexp -line -nocase -all -inline $re $output] ++ ++set disallowed_matches 0 ++set allowed_re "warning: deprecated Red Hat reloc" ++foreach match $matches { ++ if { [regexp -nocase $allowed_re $match] } { ++ verbose -log "allowed_match: '$match'" ++ continue ++ } ++ ++ verbose -log "disallowed_match: '$match'" ++ incr disallowed_matches ++} ++ ++gdb_assert { $disallowed_matches == 0 } ++ ++remote_file build delete $f +-- +2.35.3 + diff --git a/gdb-testsuite-add-gdb.suse-zypper-hint.exp.patch b/gdb-testsuite-add-gdb.suse-zypper-hint.exp.patch new file mode 100644 index 0000000..5a7f4c1 --- /dev/null +++ b/gdb-testsuite-add-gdb.suse-zypper-hint.exp.patch @@ -0,0 +1,101 @@ +gdb-testsuite-add-gdb.suse-zypper-hint.exp + +[gdb/testsuite] Add gdb.suse/zypper-hint.exp + +--- + gdb/testsuite/gdb.suse/zypper-hint.c | 25 ++++++++++++++++ + gdb/testsuite/gdb.suse/zypper-hint.exp | 55 ++++++++++++++++++++++++++++++++++ + 2 files changed, 80 insertions(+) + +diff --git a/gdb/testsuite/gdb.suse/zypper-hint.c b/gdb/testsuite/gdb.suse/zypper-hint.c +new file mode 100644 +index 00000000000..e179788f04f +--- /dev/null ++++ b/gdb/testsuite/gdb.suse/zypper-hint.c +@@ -0,0 +1,25 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2021 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#include ++ ++int ++main (void) ++{ ++ printf ("hello\n"); ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.suse/zypper-hint.exp b/gdb/testsuite/gdb.suse/zypper-hint.exp +new file mode 100644 +index 00000000000..c2b9a1134bd +--- /dev/null ++++ b/gdb/testsuite/gdb.suse/zypper-hint.exp +@@ -0,0 +1,55 @@ ++# 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 . ++ ++standard_testfile .c ++ ++if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { ++ return -1 ++} ++ ++clean_restart ${binfile} ++ ++gdb_test_no_output "set build-id-verbose 1" ++ ++set test "zypper hint printed" ++if { ![gdb_breakpoint main qualified] } { ++ unresolved $test ++ return -1 ++} ++ ++gdb_run_cmd ++ ++set re_64 \ ++ "Missing separate debuginfos, use: zypper install glibc-debuginfo-" ++set re_32 \ ++ "Missing separate debuginfos, use: zypper install glibc-32bit-debuginfo-" ++ ++set hexno0x "\[0-9A-Fa-f\]+" ++set re_nolibrpm \ ++ [multi_line \ ++ "Missing separate debuginfo for .*libc.so.*" \ ++ "Try: zypper install -C \"debuginfo\\(build-id\\)=$hexno0x\""] ++ ++gdb_test_multiple "" $test { ++ -re -wrap ($re_64|$re_32).* { ++ pass "$gdb_test_name (librpm)" ++ } ++ -re -wrap $re_nolibrpm.* { ++ pass "$gdb_test_name (no librpm)" ++ } ++} ++ ++# To give some background information in case the previous test failed. ++gdb_test "info shared" diff --git a/gdb-testsuite-add-have_host_locale.patch b/gdb-testsuite-add-have_host_locale.patch new file mode 100644 index 0000000..3e2d0a0 --- /dev/null +++ b/gdb-testsuite-add-have_host_locale.patch @@ -0,0 +1,148 @@ +From f26e9f1ce8e47bca399116a99ffdbf0aff9f2080 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 12 Jun 2023 18:00:10 +0200 +Subject: [PATCH 3/9] [gdb/testsuite] Add have_host_locale + +With test-case gdb.tui/pr30056.exp, I run into: +... +sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)^M +... +and then subsequently into: +... +WARNING: timeout in accept_gdb_output +FAIL: gdb.tui/pr30056.exp: Control-C +... + +This is on a CentOS 7 distro for powerpc64le. + +Either it has no C.UTF-8 support, or it's not installed: +... +$ locale -a | grep ^C +C +$ +... + +Fix this by: +- adding a new proc have_host_locale, and +- using it in all test-cases using setenv LC_ALL. + +Tested on powerpc64le-linux and x86_64-linux. +--- + gdb/testsuite/gdb.ada/non-ascii-latin-1.exp | 1 + + gdb/testsuite/gdb.ada/non-ascii-latin-3.exp | 1 + + gdb/testsuite/gdb.ada/non-ascii-utf-8.exp | 1 + + gdb/testsuite/gdb.base/utf8-identifiers.exp | 2 ++ + gdb/testsuite/gdb.rust/unicode.exp | 1 + + gdb/testsuite/lib/gdb.exp | 36 +++++++++++++++++++++ + 6 files changed, 42 insertions(+) + +diff --git a/gdb/testsuite/gdb.ada/non-ascii-latin-1.exp b/gdb/testsuite/gdb.ada/non-ascii-latin-1.exp +index ad4ccde625b..472e049737b 100644 +--- a/gdb/testsuite/gdb.ada/non-ascii-latin-1.exp ++++ b/gdb/testsuite/gdb.ada/non-ascii-latin-1.exp +@@ -18,6 +18,7 @@ + load_lib "ada.exp" + + if { [skip_ada_tests] } { return -1 } ++if { ![have_host_locale C.UTF-8] } { return -1 } + + # Enable basic use of UTF-8. LC_ALL gets reset for each testfile. We + # want this despite the program itself using Latin-1, as this test is +diff --git a/gdb/testsuite/gdb.ada/non-ascii-latin-3.exp b/gdb/testsuite/gdb.ada/non-ascii-latin-3.exp +index f2bdd99d243..6f826427ad3 100644 +--- a/gdb/testsuite/gdb.ada/non-ascii-latin-3.exp ++++ b/gdb/testsuite/gdb.ada/non-ascii-latin-3.exp +@@ -18,6 +18,7 @@ + load_lib "ada.exp" + + if { [skip_ada_tests] } { return -1 } ++if { ![have_host_locale C.UTF-8] } { return -1 } + + # Enable basic use of UTF-8. LC_ALL gets reset for each testfile. We + # want this despite the program itself using Latin-1, as this test is +diff --git a/gdb/testsuite/gdb.ada/non-ascii-utf-8.exp b/gdb/testsuite/gdb.ada/non-ascii-utf-8.exp +index d3c1ac4d0cf..7dcfb71bbb3 100644 +--- a/gdb/testsuite/gdb.ada/non-ascii-utf-8.exp ++++ b/gdb/testsuite/gdb.ada/non-ascii-utf-8.exp +@@ -18,6 +18,7 @@ + load_lib "ada.exp" + + if { [skip_ada_tests] } { return -1 } ++if { ![have_host_locale C.UTF-8] } { return -1 } + + # Enable basic use of UTF-8. LC_ALL gets reset for each testfile. + setenv LC_ALL C.UTF-8 +diff --git a/gdb/testsuite/gdb.base/utf8-identifiers.exp b/gdb/testsuite/gdb.base/utf8-identifiers.exp +index a6ef80fb0bd..7babe237dfb 100644 +--- a/gdb/testsuite/gdb.base/utf8-identifiers.exp ++++ b/gdb/testsuite/gdb.base/utf8-identifiers.exp +@@ -21,6 +21,8 @@ + + load_lib completion-support.exp + ++if { ![have_host_locale C.UTF-8] } { return -1 } ++ + standard_testfile + + # Enable basic use of UTF-8. LC_ALL gets reset for each testfile. +diff --git a/gdb/testsuite/gdb.rust/unicode.exp b/gdb/testsuite/gdb.rust/unicode.exp +index 63ed8d1250c..185eae008f6 100644 +--- a/gdb/testsuite/gdb.rust/unicode.exp ++++ b/gdb/testsuite/gdb.rust/unicode.exp +@@ -19,6 +19,7 @@ load_lib rust-support.exp + if {[skip_rust_tests]} { + return + } ++if { ![have_host_locale C.UTF-8] } { return } + + # Non-ASCII identifiers were allowed starting in 1.53. + set v [split [rust_compiler_version] .] +diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp +index 0b8a15f61cb..cd043ce3436 100644 +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -9452,5 +9452,41 @@ proc have_syscall { name } { + return [gdb_can_simple_compile have_syscall_$name $src object] + } + ++# Return a list of supported host locales. ++ ++gdb_caching_proc host_locales { ++ set result [remote_exec host "locale -a"] ++ set status [lindex $result 0] ++ set output [lindex $result 1] ++ ++ if { $status != 0 } { ++ return {} ++ } ++ ++ # Split into list. ++ set output [string trim $output] ++ set l [split $output \n] ++ ++ # Trim items. ++ set l [lmap v $l { string trim $v }] ++ ++ # Normalize items to lower-case. ++ set l [lmap v $l { string tolower $v }] ++ ++ return $l ++} ++ ++# Return 1 if host locale LOCALE is supported. ++ ++proc have_host_locale { locale } { ++ # Normalize to lower-case. ++ set locale [string tolower $locale] ++ # Normalize to without dash. ++ set locale [string map { "-" "" } $locale] ++ ++ set idx [lsearch [host_locales] $locale] ++ return [expr $idx != -1] ++} ++ + # Always load compatibility stuff. + load_lib future.exp +-- +2.35.3 + diff --git a/gdb-testsuite-add-kfail-for-pr-ada-30908.patch b/gdb-testsuite-add-kfail-for-pr-ada-30908.patch new file mode 100644 index 0000000..4bb803c --- /dev/null +++ b/gdb-testsuite-add-kfail-for-pr-ada-30908.patch @@ -0,0 +1,108 @@ +From 0b29bc75761b11387f89912ce827311b8eac18a6 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Sun, 1 Oct 2023 15:10:32 +0200 +Subject: [PATCH 04/12] [gdb/testsuite] Add KFAIL for PR ada/30908 + +With gcc 13.2.1, I run into a cluster of fails: +... +FAIL: gdb.ada/str_binop_equal.exp: print my_str = "ABCD" +FAIL: gdb.ada/widewide.exp: print my_wws = " helo" +FAIL: gdb.ada/widewide.exp: print my_ws = "wide" +... + +The problem is that the debug info contains information about function +ada.strings.maps."=", and gdb uses it to implement the comparison. +The function is supposed to compare two char sets, not strings, so gdb +shouldn't use it. This is PR ada/30908. + +I don't see the same problem with gcc 7.5.0, because the exec doesn't contain +the debug info for the function, because the corresponding object is not +linked in. Adter adding "with Ada.Strings.Maps; use Ada.Strings.Maps;" to +gdb.ada/widewide/foo.adb I run into the same problem with gcc 7.5.0. + +Add KFAILs for the PR. + +Tested on x86_64-linux: +- openSUSE Leap 15.4 (using gcc 7.5.0), and +- openSUSE Tumbleweed (using gcc 13.2.1). + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30908 +--- + gdb/testsuite/gdb.ada/str_binop_equal.exp | 20 ++++++++++++++-- + gdb/testsuite/gdb.ada/widewide.exp | 28 +++++++++++++++++++++-- + 2 files changed, 44 insertions(+), 4 deletions(-) + +diff --git a/gdb/testsuite/gdb.ada/str_binop_equal.exp b/gdb/testsuite/gdb.ada/str_binop_equal.exp +index 5eb531c1453..2c1b8414c5c 100644 +--- a/gdb/testsuite/gdb.ada/str_binop_equal.exp ++++ b/gdb/testsuite/gdb.ada/str_binop_equal.exp +@@ -31,8 +31,24 @@ runto "foo_p211_061.adb:$bp_location" + gdb_test "print my_str = my_str" \ + " = true" + +-gdb_test "print my_str = \"ABCD\"" \ +- " = true" ++set kfail_re \ ++ [multi_line \ ++ [string_to_regexp {Symbol: ada.strings.maps."="}] \ ++ ".*" \ ++ "\\$$decimal = false"] ++ ++gdb_test_no_output "set debug expr 1" ++ ++gdb_test_multiple {print my_str = "ABCD"} "" { ++ -re -wrap " = true" { ++ pass $gdb_test_name ++ } ++ -re -wrap $kfail_re { ++ kfail ada/30908 $gdb_test_name ++ } ++} ++ ++gdb_test "set debug expr 0" + + gdb_test "print my_str = \"EFGH\"" \ + " = false" +diff --git a/gdb/testsuite/gdb.ada/widewide.exp b/gdb/testsuite/gdb.ada/widewide.exp +index 5de5d52b8cb..b91b6bc746b 100644 +--- a/gdb/testsuite/gdb.ada/widewide.exp ++++ b/gdb/testsuite/gdb.ada/widewide.exp +@@ -42,9 +42,33 @@ gdb_test "print my_wws(1)" "= 32 ' '" + + gdb_test "print my_wws(2)" "= 104 'h'" + +-gdb_test "print my_wws = \" helo\"" " = true" ++set kfail_re \ ++ [multi_line \ ++ [string_to_regexp {Symbol: ada.strings.maps."="}] \ ++ ".*" \ ++ "\\$$decimal = false"] ++ ++gdb_test_no_output "set debug expr 1" ++ ++gdb_test_multiple {print my_wws = " helo"} "" { ++ -re -wrap " = true" { ++ pass $gdb_test_name ++ } ++ -re -wrap $kfail_re { ++ kfail ada/30908 $gdb_test_name ++ } ++} ++gdb_test_multiple {print my_ws = "wide"} "" { ++ -re -wrap " = true" { ++ pass $gdb_test_name ++ } ++ -re -wrap $kfail_re { ++ kfail ada/30908 $gdb_test_name ++ } ++} ++ ++gdb_test "set debug expr 0" + +-gdb_test "print my_ws = \"wide\"" " = true" + gdb_test "print my_ws = \"nope\"" " = false" + + gdb_test "print \"x\" & my_ws & \"y\"" " = \"xwidey\"" +-- +2.35.3 + diff --git a/gdb-testsuite-add-wait_for_msg-arg-to-term-resize-fi.patch b/gdb-testsuite-add-wait_for_msg-arg-to-term-resize-fi.patch new file mode 100644 index 0000000..664a1c5 --- /dev/null +++ b/gdb-testsuite-add-wait_for_msg-arg-to-term-resize-fi.patch @@ -0,0 +1,49 @@ +From 028d19e262b4086bc266b2657edd566bb4757927 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 13 Nov 2023 11:33:23 +0100 +Subject: [PATCH 5/6] [gdb/testsuite] Add wait_for_msg arg to Term::resize fix + +From commit deb1ba4e38b ("[gdb/tui] Fix TUI resizing for TERM=ansi"). + +Required for "[gdb/tui] Fix resizing of terminal to 1 or 2 lines". +--- + gdb/testsuite/lib/tuiterm.exp | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp +index 591c4ca9c4c..eaac09581e9 100644 +--- a/gdb/testsuite/lib/tuiterm.exp ++++ b/gdb/testsuite/lib/tuiterm.exp +@@ -1066,7 +1066,7 @@ namespace eval Term { + } + } + +- proc resize {rows cols} { ++ proc resize {rows cols {wait_for_msg 1}} { + variable _rows + variable _cols + variable _resize_count +@@ -1080,14 +1080,18 @@ namespace eval Term { + # Due to the strange column resizing behavior, and because we + # don't care about this intermediate resize, we don't check + # the size here. +- wait_for "@@ resize done $_resize_count" ++ if { $wait_for_msg } { ++ wait_for "@@ resize done $_resize_count" ++ } + incr _resize_count + # Somehow the number of columns transmitted to gdb is one less + # than what we request from expect. We hide this weird + # details from the caller. + _do_resize $_rows $cols + stty columns [expr {$_cols + 1}] < $::gdb_tty_name +- wait_for "@@ resize done $_resize_count, size = ${_cols}x${rows}" ++ if { $wait_for_msg } { ++ wait_for "@@ resize done $_resize_count, size = ${_cols}x${rows}" ++ } + incr _resize_count + } + } +-- +2.35.3 + diff --git a/gdb-testsuite-add-xfail-case-in-gdb.python-py-record.patch b/gdb-testsuite-add-xfail-case-in-gdb.python-py-record.patch new file mode 100644 index 0000000..9db08d7 --- /dev/null +++ b/gdb-testsuite-add-xfail-case-in-gdb.python-py-record.patch @@ -0,0 +1,57 @@ +From 835a10f8541c7c4150098c82e097c4f606475cfa Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 20 Feb 2023 11:16:02 +0100 +Subject: [PATCH] [gdb/testsuite] Add xfail case in + gdb.python/py-record-btrace.exp + +I came across: +... +gdb) PASS: gdb.python/py-record-btrace.exp: prepare record: stepi 100 +python insn = r.instruction_history^M +warning: Non-contiguous trace at instruction 1 (offset = 0x3e10).^M +(gdb) FAIL: gdb.python/py-record-btrace.exp: prepare record: python insn = r.i\ +nstruction_history +... + +I'm assuming it's the same root cause as for the already present XFAIL. + +Fix this by recognizing above warning in the xfail regexp. + +Tested on x86_64-linux, although sofar I was not able to trigger the warning +again. + +Approved-By: Markus T. Metzger +--- + gdb/testsuite/gdb.python/py-record-btrace.exp | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.python/py-record-btrace.exp b/gdb/testsuite/gdb.python/py-record-btrace.exp +index ca8740bc967..a930d17264d 100644 +--- a/gdb/testsuite/gdb.python/py-record-btrace.exp ++++ b/gdb/testsuite/gdb.python/py-record-btrace.exp +@@ -86,6 +86,11 @@ with_test_prefix "prepare record" { + "warning: Decode error \\($nonl_re*\\) at instruction $decimal" \ + "\\(offset = $hex, pc = $hex\\):" \ + "$nonl_re*\\."]] ++ set xfail_re_2 \ ++ [join \ ++ [list \ ++ "warning: Non-contiguous trace at instruction $decimal" \ ++ "\\(offset = $hex\\)\\."]] + + set got_xfail 0 + set cmd "python insn = r.instruction_history" +@@ -93,7 +98,7 @@ with_test_prefix "prepare record" { + -re "^[string_to_regexp $cmd]\r\n$::gdb_prompt $" { + pass $gdb_test_name + } +- -re -wrap "$xfail_re" { ++ -re -wrap "($xfail_re|$xfail_re_2)" { + if { $have_xfail } { + xfail $gdb_test_name + set got_xfail 1 + +base-commit: f168a48adf97a36c88c65a075b42e6b7083063df +-- +2.35.3 + diff --git a/gdb-testsuite-add-xfail-for-gdb-29965-in-gdb.threads.patch b/gdb-testsuite-add-xfail-for-gdb-29965-in-gdb.threads.patch new file mode 100644 index 0000000..f3bf055 --- /dev/null +++ b/gdb-testsuite-add-xfail-for-gdb-29965-in-gdb.threads.patch @@ -0,0 +1,65 @@ +From ebceffa1196651683a7a6d31abb4b3b5adc6c168 Mon Sep 17 00:00:00 2001 +From: Simon Marchi +Date: Thu, 7 Sep 2023 21:53:55 -0400 +Subject: [PATCH 12/12] gdb/testsuite: add xfail for gdb/29965 in + gdb.threads/process-exit-status-is-leader-exit-status.exp + +Bug 29965 shows on a Linux kernel >= 6.1, that test fails consistently +with: + + FAIL: gdb.threads/process-exit-status-is-leader-exit-status.exp: iteration=0: continue (the program exited) + ... + FAIL: gdb.threads/process-exit-status-is-leader-exit-status.exp: iteration=9: continue (the program exited) + +This is due to a change in Linux kernel behavior [1] that affects +exactly what this test tests. That is, if multiple threads (including +the leader) call SYS_exit, the exit status of the process should be the +exit status of the leader. After that change in the kernel, it is no +longer the case. + +Add an xfail in the test, based on the Linux kernel version. The goal +is that if a regression is introduced in GDB regarding this feature, it +should be caught if running on an older kernel where the behavior was +consistent. + +[1] https://bugzilla.suse.com/show_bug.cgi?id=1206926 + +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29965 +Change-Id: If6ab7171c92bfc1a3b961c7179e26611773969eb +Approved-By: Tom de Vries +--- + ...cess-exit-status-is-leader-exit-status.exp | 19 ++++++++++++++++++- + 1 file changed, 18 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.exp b/gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.exp +index f64d6a73dea..e470fe29110 100644 +--- a/gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.exp ++++ b/gdb/testsuite/gdb.threads/process-exit-status-is-leader-exit-status.exp +@@ -41,6 +41,23 @@ for {set iteration 0} {$iteration < 10} {incr iteration} { + return + } + +- gdb_test "continue" "\\\[Inferior 1 \\(.*\\) exited with code 01\\\]" ++ gdb_test_multiple "continue" "" { ++ -re -wrap "\\\[Inferior 1 \\(.*\\) exited with code 01\\\]" { ++ pass $gdb_test_name ++ } ++ ++ -re -wrap "\\\[Inferior 1 \\(.*\\) exited with code $::decimal\\\]" { ++ set lkv [linux_kernel_version] ++ ++ if { [llength $lkv] != 0 } { ++ if { [version_compare {6 1 0} <= $lkv] } { ++ xfail "$gdb_test_name (PR 29965)" ++ return ++ } ++ } ++ ++ fail $gdb_test_name ++ } ++ } + } + } +-- +2.35.3 + diff --git a/gdb-testsuite-add-xfail-in-gdb.arch-i386-pkru.exp.patch b/gdb-testsuite-add-xfail-in-gdb.arch-i386-pkru.exp.patch new file mode 100644 index 0000000..a4ca605 --- /dev/null +++ b/gdb-testsuite-add-xfail-in-gdb.arch-i386-pkru.exp.patch @@ -0,0 +1,154 @@ +From 090d15fb9c7f7a48210783bddcf1d620bce6bf2a Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Fri, 21 Apr 2023 17:57:05 +0200 +Subject: [PATCH 3/5] [gdb/testsuite] Add xfail in gdb.arch/i386-pkru.exp + +On a x86_64-linux machine with pkru register, I run into: +... +(gdb) PASS: gdb.arch/i386-pkru.exp: set pkru value +info register pkru^M +pkru 0x12345678 305419896^M +(gdb) FAIL: gdb.arch/i386-pkru.exp: read value after setting value +... + +This is a regression due to kernel commit e84ba47e313d ("x86/fpu: Hook up PKRU +onto ptrace()"). This is fixed by recent kernel commit 4a804c4f8356 +("x86/fpu: Allow PKRU to be (once again) written by ptrace."). + +The regression occurs for kernel versions v5.14-rc1 (the first tag containing +the regression) up to but excluding v6.2-rc1 (the first tag containing the fix). + +Fix this by adding an xfail for the appropriate kernel versions. + +Tested on x86_64-linux. + +PR testsuite/29790 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29790 +--- + gdb/testsuite/gdb.arch/i386-pkru.exp | 45 +++++++++++++++++++++++--- + gdb/testsuite/lib/gdb-utils.exp | 48 ++++++++++++++++++++++++++++ + 2 files changed, 89 insertions(+), 4 deletions(-) + +diff --git a/gdb/testsuite/gdb.arch/i386-pkru.exp b/gdb/testsuite/gdb.arch/i386-pkru.exp +index f5d74380a61..5d2b1a24a15 100644 +--- a/gdb/testsuite/gdb.arch/i386-pkru.exp ++++ b/gdb/testsuite/gdb.arch/i386-pkru.exp +@@ -58,6 +58,26 @@ if { !$supports_pkru } { + return + } + ++# Linux kernel versions 5.14.0 to 6.1.x contain a regression related to writing ++# the PKRU using ptrace, see commit 4a804c4f8356 ("x86/fpu: Allow PKRU to be ++# (once again) written by ptrace."). ++set have_xfail 0 ++if { [istarget *-*-linux*] } { ++ set res [remote_exec target "uname -r"] ++ set status [lindex $res 0] ++ set output [lindex $res 1] ++ ++ set re ^($decimal)\\.($decimal)\\.($decimal) ++ if { $status == 0 ++ && [regexp $re $output dummy v1 v2 v3] == 1 } { ++ set v [list $v1 $v2 $v3] ++ set have_xfail \ ++ [expr \ ++ [version_compare [list 5 14 0] <= $v] \ ++ && [version_compare $v < [list 6 2 0]]] ++ } ++} ++ + # Test pkru register at startup + gdb_test "print /x \$pkru" "= $default_pkru_re" "pkru register" + +@@ -65,11 +85,28 @@ gdb_test "print /x \$pkru" "= $default_pkru_re" "pkru register" + gdb_breakpoint [ gdb_get_line_number "break here 1" ] + gdb_continue_to_breakpoint "break here 1" ".*break here 1.*" + +-gdb_test "info register pkru" ".*pkru.*0x12345678.*" "read pkru register" +-gdb_test "print /x \$pkru = 0x44444444" "= 0x44444444" "set pkru value" +-gdb_test "info register pkru" ".*pkru.*0x44444444.*" "read value after setting value" ++set val1 0x12345678 ++gdb_test "info register pkru" ".*pkru.*$val1.*" "read pkru register" ++ ++set val2 0x44444444 ++gdb_test "print /x \$pkru = $val2" "= $val2" "set pkru value" ++ ++set xval $val2 ++gdb_test_multiple "info register pkru" "read value after setting value" { ++ -re -wrap ".*pkru.*$val2.*" { ++ pass $gdb_test_name ++ } ++ -re -wrap ".*pkru.*$val1.*" { ++ if { $have_xfail } { ++ xfail $gdb_test_name ++ } else { ++ fail $gdb_test_name ++ } ++ set xval $val1 ++ } ++} + + gdb_breakpoint [ gdb_get_line_number "break here 2" ] + gdb_continue_to_breakpoint "break here 2" ".*break here 2.*" + +-gdb_test "print /x rd_value" "= 0x44444444" "variable after reading pkru" ++gdb_test "print /x rd_value" "= $xval" "variable after reading pkru" +diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp +index 78724f8b622..2757050fdfd 100644 +--- a/gdb/testsuite/lib/gdb-utils.exp ++++ b/gdb/testsuite/lib/gdb-utils.exp +@@ -100,3 +100,51 @@ proc gdb_get_bp_addr { num } { + } + return "" + } ++ ++# Compare the version numbers in L1 to those in L2 using OP, and return ++# 1 if the comparison is true. ++ ++proc version_compare { l1 op l2 } { ++ set len [llength $l1] ++ if { $len != [llength $l2] } { ++ error "l2 not the same length as l1" ++ } ++ ++ switch -exact $op { ++ "==" - ++ "<" {} ++ "<=" { return [expr [version_compare $l1 < $l2] \ ++ || [version_compare $l1 == $l2]]} ++ default { error "unsupported op: $op" } ++ } ++ ++ # Handle ops < and ==. ++ set idx 0 ++ foreach v1 $l1 { ++ set v2 [lindex $l2 $idx] ++ incr idx ++ set last [expr $len == $idx] ++ ++ set cmp [expr $v1 $op $v2] ++ if { $op == "==" } { ++ if { $cmp } { ++ continue ++ } else { ++ return 0 ++ } ++ } else { ++ # $op == "<". ++ if { $cmp } { ++ return 1 ++ } else { ++ if { !$last && $v1 == $v2 } { ++ continue ++ } ++ return 0 ++ } ++ } ++ } ++ ++ return 1 ++} ++ +-- +2.35.3 + diff --git a/gdb-testsuite-add-xfail-in-gdb.python-py-record-btra.patch b/gdb-testsuite-add-xfail-in-gdb.python-py-record-btra.patch new file mode 100644 index 0000000..41d7631 --- /dev/null +++ b/gdb-testsuite-add-xfail-in-gdb.python-py-record-btra.patch @@ -0,0 +1,98 @@ +From 221ecdef7cc008b01832840d1fbd25d94f8abdd1 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Tue, 14 Feb 2023 13:15:49 +0100 +Subject: [PATCH 04/11] [gdb/testsuite] Add xfail in + gdb.python/py-record-btrace.exp + +There's a HW bug affecting Processor Trace on some Intel processors +(Ice Lake to Raptor Lake microarchitectures). + +The bug was exposed by linux kernel commit 670638477aed +("perf/x86/intel/pt: Opportunistically use single range output mode"), +added in version v5.5.0, and was worked around by commit ce0d998be927 +("perf/x86/intel/pt: Fix sampling using single range output") in version +6.1.0. + +The bug manifests (on a Performance-core of an i7-1250U, an Alder Lake cpu) in +a single test-case: +... +(gdb) python insn = r.instruction_history^M +warning: Decode error (-20) at instruction 33 (offset = 0x3d6a, \ + pc = 0x400501): compressed return without call.^M +(gdb) FAIL: gdb.python/py-record-btrace.exp: prepare record: \ + python insn = r.instruction_history +... + +Add a corresponding XFAIL. + +Note that the i7-1250U has both Performance-cores and Efficient-cores, and on +an Efficient-Core the test-case runs without any problems, so if the testsuite +run is not pinned to a specific cpu, the test may either PASS or XFAIL. + +Tested on x86_64-linux: +- openSUSE Leap 15.4 with linux kernel version 5.14.21 +- openSUSE Tumbleweed with linux kernel version 6.1.8 + +PR testsuite/30075 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30075 +--- + gdb/testsuite/gdb.python/py-record-btrace.exp | 43 ++++++++++++++++++- + 1 file changed, 42 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.python/py-record-btrace.exp b/gdb/testsuite/gdb.python/py-record-btrace.exp +index 8204577b866..ca8740bc967 100644 +--- a/gdb/testsuite/gdb.python/py-record-btrace.exp ++++ b/gdb/testsuite/gdb.python/py-record-btrace.exp +@@ -64,7 +64,48 @@ with_test_prefix "prepare record" { + gdb_test "python print(r.method)" "btrace" + gdb_test "python print(r.format)" "pt|bts" + gdb_test "stepi 100" ".*" +- gdb_test_no_output "python insn = r.instruction_history" ++ ++ # There's a HW bug affecting Processor Trace on some Intel processors. ++ # The bug was exposed by linux kernel commit 670638477aed ++ # ("perf/x86/intel/pt: Opportunistically use single range output mode"), ++ # added in version v5.5.0, and was worked around by commit ce0d998be927 ++ # ("perf/x86/intel/pt: Fix sampling using single range output") in version ++ # 6.1.0. Detect the kernel version range for which the problem may ++ # manifest. ++ set have_xfail 0 ++ set v [linux_kernel_version] ++ if { $v != {} } { ++ set have_xfail \ ++ [expr [version_compare [list 5 5 0] <= $v] \ ++ && [version_compare $v < [list 6 1 0]]] ++ } ++ set nonl_re \[^\r\n\] ++ set xfail_re \ ++ [join \ ++ [list \ ++ "warning: Decode error \\($nonl_re*\\) at instruction $decimal" \ ++ "\\(offset = $hex, pc = $hex\\):" \ ++ "$nonl_re*\\."]] ++ ++ set got_xfail 0 ++ set cmd "python insn = r.instruction_history" ++ gdb_test_multiple $cmd "" { ++ -re "^[string_to_regexp $cmd]\r\n$::gdb_prompt $" { ++ pass $gdb_test_name ++ } ++ -re -wrap "$xfail_re" { ++ if { $have_xfail } { ++ xfail $gdb_test_name ++ set got_xfail 1 ++ } else { ++ fail $gdb_test_name ++ } ++ } ++ } ++ if { $got_xfail } { ++ return ++ } ++ + gdb_test_no_output "python call = r.function_call_history" + gdb_test_no_output "python i = insn\[0\]" + gdb_test_no_output "python c = call\[0\]" +-- +2.35.3 + diff --git a/gdb-testsuite-don-t-use-string-cat-in-gdb.dwarf2-dw2.patch b/gdb-testsuite-don-t-use-string-cat-in-gdb.dwarf2-dw2.patch new file mode 100644 index 0000000..3831543 --- /dev/null +++ b/gdb-testsuite-don-t-use-string-cat-in-gdb.dwarf2-dw2.patch @@ -0,0 +1,39 @@ +From f3a7b8d3d63005e9e0b680688d0cde0e5d4e1de9 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 24 Apr 2023 14:48:06 +0200 +Subject: [PATCH 7/9] [gdb/testsuite] Don't use string cat in + gdb.dwarf2/dw2-abs-hi-pc.exp + +Test-case gdb.dwarf2/dw2-abs-hi-pc.exp uses string cat: +... +set sources [lmap i $sources { string cat "${srcdir}/${subdir}/" $i }] +... +but that's only supported starting tcl 8.6. + +Fix this by using "expr" instead: +... +set sources [lmap i $sources { expr { "$srcdir/$subdir/$i" } }] +... + +Tested on x86_64-linux. +--- + gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp +index 397cb38ceef..6e4b570c86d 100644 +--- a/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp ++++ b/gdb/testsuite/gdb.dwarf2/dw2-abs-hi-pc.exp +@@ -26,7 +26,8 @@ set sources \ + ${testfile}.c \ + ${testfile}-hello.c \ + ${testfile}-world.c] +-set sources [lmap i $sources { string cat "${srcdir}/${subdir}/" $i }] ++set sources [lmap i $sources { expr { "$srcdir/$subdir/$i" } }] ++ + lassign [function_range hello $sources] \ + hello_start hello_len + lassign [function_range world $sources] \ +-- +2.35.3 + diff --git a/gdb-testsuite-factor-out-proc-linux_kernel_version.patch b/gdb-testsuite-factor-out-proc-linux_kernel_version.patch new file mode 100644 index 0000000..11e1fe2 --- /dev/null +++ b/gdb-testsuite-factor-out-proc-linux_kernel_version.patch @@ -0,0 +1,81 @@ +From 8797e6c1eb8c863617cd484d469dff23d059a15f Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Fri, 21 Apr 2023 17:58:49 +0200 +Subject: [PATCH 4/5] [gdb/testsuite] Factor out proc linux_kernel_version + +Factor out new proc linux_kernel_version from test-case +gdb.arch/i386-pkru.exp. + +Tested on x86_64-linux. +--- + gdb/testsuite/gdb.arch/i386-pkru.exp | 20 ++++++-------------- + gdb/testsuite/lib/gdb.exp | 23 +++++++++++++++++++++++ + 2 files changed, 29 insertions(+), 14 deletions(-) + +diff --git a/gdb/testsuite/gdb.arch/i386-pkru.exp b/gdb/testsuite/gdb.arch/i386-pkru.exp +index 5d2b1a24a15..b2e5385c52b 100644 +--- a/gdb/testsuite/gdb.arch/i386-pkru.exp ++++ b/gdb/testsuite/gdb.arch/i386-pkru.exp +@@ -62,20 +62,12 @@ if { !$supports_pkru } { + # the PKRU using ptrace, see commit 4a804c4f8356 ("x86/fpu: Allow PKRU to be + # (once again) written by ptrace."). + set have_xfail 0 +-if { [istarget *-*-linux*] } { +- set res [remote_exec target "uname -r"] +- set status [lindex $res 0] +- set output [lindex $res 1] +- +- set re ^($decimal)\\.($decimal)\\.($decimal) +- if { $status == 0 +- && [regexp $re $output dummy v1 v2 v3] == 1 } { +- set v [list $v1 $v2 $v3] +- set have_xfail \ +- [expr \ +- [version_compare [list 5 14 0] <= $v] \ +- && [version_compare $v < [list 6 2 0]]] +- } ++set v [linux_kernel_version] ++if { $v != {} } { ++ set have_xfail \ ++ [expr \ ++ [version_compare [list 5 14 0] <= $v] \ ++ && [version_compare $v < [list 6 2 0]]] + } + + # Test pkru register at startup +diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp +index 85c0bfb897f..2be69479d70 100644 +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -9334,5 +9334,28 @@ proc decompress_bz2 { bz2 } { + return $copy + } + ++# Detect linux kernel version and return as list of 3 numbers: major, minor, ++# and patchlevel. On failure, return an empty list. ++ ++gdb_caching_proc linux_kernel_version { ++ if { ![istarget *-*-linux*] } { ++ return {} ++ } ++ ++ set res [remote_exec target "uname -r"] ++ set status [lindex $res 0] ++ set output [lindex $res 1] ++ if { $status != 0 } { ++ return {} ++ } ++ ++ set re ^($::decimal)\\.($::decimal)\\.($::decimal) ++ if { [regexp $re $output dummy v1 v2 v3] != 1 } { ++ return {} ++ } ++ ++ return [list $v1 $v2 $v3] ++} ++ + # Always load compatibility stuff. + load_lib future.exp +-- +2.35.3 + diff --git a/gdb-testsuite-fix-breakpoint-regexp-in-gdb.ada-out_o.patch b/gdb-testsuite-fix-breakpoint-regexp-in-gdb.ada-out_o.patch new file mode 100644 index 0000000..0439eff --- /dev/null +++ b/gdb-testsuite-fix-breakpoint-regexp-in-gdb.ada-out_o.patch @@ -0,0 +1,50 @@ +From 85025e0631ed4b0e8c3aa85d7561a715f142bdc6 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 12 Jun 2023 11:14:24 +0200 +Subject: [PATCH] [gdb/testsuite] Fix breakpoint regexp in + gdb.ada/out_of_line_in_inlined.exp + +With a gdb 13.2 based package on openSUSE Tumbleweed i586, I ran into: +... +(gdb) run ^M +Starting program: out_of_line_in_inlined/foo_o224_021-all ^M +[Thread debugging using libthread_db enabled]^M +Using host libthread_db library "/lib/libthread_db.so.1".^M +^M +Breakpoint 1.1, foo_o224_021.child1.child2 (s=...) at foo_o224_021.adb:26^M +26 for C of S loop^M +(gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all: \ + run to foo_o224_021.child1.child2 +... + +I can reproduce the same issue with gdb trunk on x86_64, by using optimize=-O3 +instead of optimize=-O2. + +Fix this by using $bkptno_num_re. + +Tested on x86_64-linux. + +PR testsuite/30539 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30539 +--- + gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp +index 03092a15188..08245777d84 100644 +--- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp ++++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp +@@ -34,7 +34,7 @@ foreach_with_prefix scenario {all minimal} { + + gdb_run_cmd + gdb_test "" \ +- "Breakpoint $decimal, ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \ ++ "Breakpoint ($decimal|$bkptno_num_re), ($hex in )?foo_o224_021\\.child1\\.child2 \\(s=\\.\\.\\.\\).*" \ + "run to foo_o224_021.child1.child2" + + set opt_addr_in "($hex in)?" + +base-commit: 11a41bc318ba0307248eadf29bf7d4a1af31d3a8 +-- +2.35.3 + diff --git a/gdb-testsuite-fix-buffer-overflow-in-gdb.base-signed.patch b/gdb-testsuite-fix-buffer-overflow-in-gdb.base-signed.patch new file mode 100644 index 0000000..b7c5bec --- /dev/null +++ b/gdb-testsuite-fix-buffer-overflow-in-gdb.base-signed.patch @@ -0,0 +1,120 @@ +From 6c09d2d14f44ac92d2509973ff6da376c248510f Mon Sep 17 00:00:00 2001 +From: Andrew Burgess +Date: Tue, 20 Dec 2022 12:51:50 +0000 +Subject: [PATCH 1/6] gdb/testsuite: fix buffer overflow in + gdb.base/signed-builtin-types.exp + +In commit: + + commit 9f50fe0835850645bd8ea9bb1efe1fe6c48dfb12 + Date: Wed Dec 7 15:55:25 2022 +0000 + + gdb/testsuite: new test for recent dwarf reader issue + +A new test (gdb.base/signed-builtin-types.exp) was added that made use +of 'info sources' to figure out if the debug information for a +particular object file had been fully expanded or not. Unfortunately +some lines of the 'info sources' output can be very long, this was +observed on some systems where the debug information for the +dynamic-linker was installed, in this case, the list of source files +associated with the dynamic linker was so long it would cause expect's +internal buffer to overflow. + +This commit switches from using 'info sources' to 'maint print +objfile', the output from the latter command is more compact, but +also, can be restricted to a single named object file. + +With this change in place I am no longer seeing buffer overflow errors +from expect when running gdb.base/signed-builtin-types.exp. +--- + .../gdb.base/signed-builtin-types.exp | 51 +++---------------- + 1 file changed, 8 insertions(+), 43 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/signed-builtin-types.exp b/gdb/testsuite/gdb.base/signed-builtin-types.exp +index c7eee139c74..c4afc621cee 100644 +--- a/gdb/testsuite/gdb.base/signed-builtin-types.exp ++++ b/gdb/testsuite/gdb.base/signed-builtin-types.exp +@@ -21,7 +21,8 @@ standard_testfile .c -lib.c + + # Compile the shared library. + set srcdso [file join $srcdir $subdir $srcfile2] +-set objdso [standard_output_file lib${gdb_test_file_name}.so] ++set libname "lib${gdb_test_file_name}.so" ++set objdso [standard_output_file $libname] + if {[gdb_compile_shlib $srcdso $objdso {debug}] != ""} { + untested "failed to compile dso" + return -1 +@@ -46,46 +47,10 @@ if {[readnow]} { + # library has been fully expanded or not. Return true if the debug + # information has NOT been fully expanded (which is what we want for this + # test). +-proc shared_library_debug_not_fully_expanded {} { +- set library_expanded "" +- gdb_test_multiple "info sources" "" { +- -re "^info sources\r\n" { +- exp_continue +- } +- -re "^(\[^\r\n\]+):\r\n\\(Full debug information has not yet been read for this file\\.\\)\r\n\r\n" { +- set libname $expect_out(1,string) +- if {$libname == $::objdso} { +- set library_expanded "no" +- } +- exp_continue +- } +- -re "^(\[^\r\n\]+):\r\n\\(Objfile has no debug information\\.\\)\r\n\r\n" { +- set libname $expect_out(1,string) +- if {$libname == $::objdso} { +- # For some reason the shared library has no debug +- # information, this is not expected. +- set library_expanded "missing debug" +- } +- exp_continue +- } +- -re "^(\[^\r\n\]+):\r\n\r\n" { +- set libname $expect_out(1,string) +- if {$libname == $::objdso} { +- set library_expanded "yes" +- } +- exp_continue +- } +- -re "^$::gdb_prompt $" { +- gdb_assert {[string equal $library_expanded "yes"] \ +- || [string equal $library_expanded "no"]} \ +- $gdb_test_name +- } +- -re "^(\[^\r\n:\]*)\r\n" { +- exp_continue +- } +- } +- +- return [expr $library_expanded == "no"] ++proc assert_shared_library_debug_not_fully_expanded {} { ++ gdb_test_lines "maint print objfiles $::libname" "" \ ++ "Object file \[^\r\n\]*$::libname" \ ++ -re-not "Symtabs:" + } + + foreach_with_prefix type_name {"short" "int" "long" "char"} { +@@ -93,7 +58,7 @@ foreach_with_prefix type_name {"short" "int" "long" "char"} { + with_test_prefix "before sizeof expression" { + # Check that the debug information for the shared library has + # not yet been read in. +- gdb_assert { [shared_library_debug_not_fully_expanded] } ++ assert_shared_library_debug_not_fully_expanded + } + + # Evaluate a sizeof expression for a builtin type. At one point GDB +@@ -106,7 +71,7 @@ foreach_with_prefix type_name {"short" "int" "long" "char"} { + with_test_prefix "after sizeof expression" { + # Check that the debug information for the shared library has not + # yet been read in. +- gdb_assert { [shared_library_debug_not_fully_expanded] } ++ assert_shared_library_debug_not_fully_expanded + } + } + } + +base-commit: d5d2daa1efc67fdaaefe9648bb1275608779455d +-- +2.35.3 + diff --git a/gdb-testsuite-fix-gdb-server-ext-run-exp-for-obs.patch b/gdb-testsuite-fix-gdb-server-ext-run-exp-for-obs.patch new file mode 100644 index 0000000..bb3f325 --- /dev/null +++ b/gdb-testsuite-fix-gdb-server-ext-run-exp-for-obs.patch @@ -0,0 +1,19 @@ +Fix gdb.server/ext-run.exp for obs + +--- + gdb/testsuite/gdb.server/ext-run.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.server/ext-run.exp b/gdb/testsuite/gdb.server/ext-run.exp +index ecedf6b887a..0ab56253eb9 100644 +--- a/gdb/testsuite/gdb.server/ext-run.exp ++++ b/gdb/testsuite/gdb.server/ext-run.exp +@@ -57,7 +57,7 @@ if { [istarget *-*-linux*] } { + # This is done in a way to avoid the timeout that can occur from + # applying .* regexp to large output. + gdb_test_sequence "info os processes" "get process list" \ +- { "pid +user +command" "1 +root +\[/a-z\]*(init|systemd)" } ++ { "pid +user +command" "1 +root +\[/a-z\]*(init|systemd|bash)" } + } + } + diff --git a/gdb-testsuite-fix-gdb.ada-mi_task_arg.exp-with-newer.patch b/gdb-testsuite-fix-gdb.ada-mi_task_arg.exp-with-newer.patch new file mode 100644 index 0000000..8d652cc --- /dev/null +++ b/gdb-testsuite-fix-gdb.ada-mi_task_arg.exp-with-newer.patch @@ -0,0 +1,64 @@ +From ad1be044276c4727434f84ac6c554da4f2829aaf Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Tue, 26 Sep 2023 18:57:49 +0200 +Subject: [PATCH 05/12] [gdb/testsuite] Fix gdb.ada/mi_task_arg.exp with newer + gcc + +When running test-case gdb.ada/mi_task_arg.exp on openSUSE Tumbleweed using +gcc 13.2.1, I run into (layout adapted for readability): +... +-stack-list-arguments 1^M +^done,stack-args=[ + frame={level="0",args=[]}, + frame={level="1",args=[{name="<_task>",value="0x464820"}, + {name="<_taskL>",value="129"}]}, + frame={level="2",args=[{name="self_id",value="0x464840"}]}, + frame={level="3",args=[]}, + frame={level="4",args=[]} +]^M +(gdb) ^M +FAIL: gdb.ada/mi_task_arg.exp: -stack-list-arguments 1 (unexpected output) +... + +On openSUSE Leap 15.4 with gcc 7.5.0 I get instead: +... +-stack-list-arguments 1^M +^done,stack-args=[ + frame={level="0",args=[]}, + frame={level="1",args=[{name="<_task>",value="0x444830"}]}, + frame={level="2",args=[{name="self_id",value="0x444850"}]}, + frame={level="3",args=[]}, + frame={level="4",args=[]}]^M +(gdb) ^M +PASS: gdb.ada/mi_task_arg.exp: -stack-list-arguments 1 +... + +The difference in gdb output is due to difference in the dwarf generated by +the compiler, so I don't see a problem with gdb here. + +Fix this by updating the test-case to accept this output. + +Tested on x86_64-linux. + +Approved-By: Tom Tromey +--- + gdb/testsuite/gdb.ada/mi_task_arg.exp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.ada/mi_task_arg.exp b/gdb/testsuite/gdb.ada/mi_task_arg.exp +index ffee40ad044..2820f2d3722 100644 +--- a/gdb/testsuite/gdb.ada/mi_task_arg.exp ++++ b/gdb/testsuite/gdb.ada/mi_task_arg.exp +@@ -49,7 +49,8 @@ if {![mi_runto "task_switch.break_me"]} { + set frame0 "frame=\{level=\"0\",args=\\\[\\\]\}" + # Frame for task_switch.caller + set frame1_args "\{name=\"<_task>\",value=\"$hex\"\}" +-set frame1 "frame=\{level=\"1\",args=\\\[$frame1_args\\\]\}" ++set frame1_opt_args "\{name=\"<_taskL>\",value=\"$decimal\"\}" ++set frame1 "frame=\{level=\"1\",args=\\\[${frame1_args}(,$frame1_opt_args)?\\\]\}" + # Frame for system.tasking.stages.task_wrapper + set frame2_args "(\{name=\"self_id\",value=\"($hex|)\"\})?" + set frame2 "frame=\{level=\"2\",args=\\\[$frame2_args\\\]\}" +-- +2.35.3 + diff --git a/gdb-testsuite-fix-gdb.arch-i386-signal.exp-on-x86_64.patch b/gdb-testsuite-fix-gdb.arch-i386-signal.exp-on-x86_64.patch new file mode 100644 index 0000000..87f8e1d --- /dev/null +++ b/gdb-testsuite-fix-gdb.arch-i386-signal.exp-on-x86_64.patch @@ -0,0 +1,91 @@ +From ef58dedc82b17919360bf51f7efcbf6d74c11329 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Sun, 1 Oct 2023 13:00:23 +0200 +Subject: [PATCH 01/12] [gdb/testsuite] Fix gdb.arch/i386-signal.exp on x86_64 + +On x86_64-linux, with test-case gdb.arch/i386-signal.exp I run into: +... +builtin_spawn -ignore SIGHUP gcc -fno-stack-protector i386-signal.c \ + -fdiagnostics-color=never -fno-pie -g -no-pie -lm -o i386-signal^M +/tmp/cc2xydTG.s: Assembler messages:^M +/tmp/cc2xydTG.s:50: Error: operand size mismatch for `push'^M +compiler exited with status 1 +output is: +/tmp/cc2xydTG.s: Assembler messages:^M +/tmp/cc2xydTG.s:50: Error: operand size mismatch for `push'^M + +gdb compile failed, /tmp/cc2xydTG.s: Assembler messages: +/tmp/cc2xydTG.s:50: Error: operand size mismatch for `push' +UNTESTED: gdb.arch/i386-signal.exp: failed to compile +... + +This is with gas 2.41, it compiles without problems with gas 2.40. Some more +strict checking was added in commit 5cc007751cd ("x86: further adjust +extend-to-32bit-address conditions"). + +The offending bit is: +... + " push $sigframe\n" +... +which refers to a function: +... + " .globl sigframe\n" + "sigframe:\n" +... + +The test-case passes with target board unix/-m32. + +Make the test-case work by using pushq instead of push for the +is_amd64_regs_target case. + +Tested on x86_64-linux, with target boards: +- unix/-m64 (is_amd64_regs_target == 1), and +- unix/-m32 (is_amd64_regs_target == 0), + +PR testsuite/30928 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30928 +--- + gdb/testsuite/gdb.arch/i386-signal.c | 4 ++++ + gdb/testsuite/gdb.arch/i386-signal.exp | 7 ++++++- + 2 files changed, 10 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.arch/i386-signal.c b/gdb/testsuite/gdb.arch/i386-signal.c +index 19bb1bbaaf8..4bf97e5f159 100644 +--- a/gdb/testsuite/gdb.arch/i386-signal.c ++++ b/gdb/testsuite/gdb.arch/i386-signal.c +@@ -45,7 +45,11 @@ asm(".text\n" + " .align 8\n" + " .globl setup\n" + "setup:\n" ++#if IS_AMD64_REGS_TARGET ++ " pushq $sigframe\n" ++#else + " push $sigframe\n" ++#endif + " jmp func\n" + "\n" + " .cfi_startproc\n" +diff --git a/gdb/testsuite/gdb.arch/i386-signal.exp b/gdb/testsuite/gdb.arch/i386-signal.exp +index 9806970b245..0a413f73a5b 100644 +--- a/gdb/testsuite/gdb.arch/i386-signal.exp ++++ b/gdb/testsuite/gdb.arch/i386-signal.exp +@@ -22,8 +22,13 @@ if {![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]} { + + standard_testfile + ++set opts {} ++lappend opts debug ++lappend opts nopie ++lappend opts additional_flags=-DIS_AMD64_REGS_TARGET=[is_amd64_regs_target] ++ + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ +- executable { debug nopie }] != "" } { ++ executable $opts] != "" } { + untested "failed to compile" + return -1 + } + +base-commit: b671ae32ae890a373abcfe4b19a3b662fd5e86f2 +-- +2.35.3 + 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..b6da600 --- /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.cp-m-static.exp-regression-on-.patch b/gdb-testsuite-fix-gdb.cp-m-static.exp-regression-on-.patch new file mode 100644 index 0000000..ca9c3f0 --- /dev/null +++ b/gdb-testsuite-fix-gdb.cp-m-static.exp-regression-on-.patch @@ -0,0 +1,76 @@ +From 424c96685651cc949597d700811a5fbb15256d1d Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Fri, 24 Mar 2023 09:18:07 +0100 +Subject: [PATCH 06/12] [gdb/testsuite] Fix gdb.cp/m-static.exp regression on + Ubuntu 20.04 + +In commit 722c4596034 ("[gdb/testsuite] Fix gdb.cp/*.exp for remote host"), I +needed to change ".*/" into "(.*/)?" in: +... +gdb_test "info variable everywhere" \ + "File .*/m-static\[.\]h.*const int gnu_obj_4::everywhere;" +... + +However, due to the fact that I got this output: +... +(gdb) info variable everywhere^M +All variables matching regular expression "everywhere":^M +^M +File /data/vries/gdb/src/gdb/testsuite/gdb.cp/m-static.h:^M +8: const int gnu_obj_4::everywhere;^M +^M +File /data/vries/gdb/src/gdb/testsuite/gdb.cp/m-static1.cc:^M +8: const int gnu_obj_4::everywhere;^M +... +I decided to make the matching somewhat stricter, to make sure that the two +matched lines were subsequent. + +The commit turned out to be more strict than intended, and caused a regression +on Ubuntu 20.04, where the output was instead: +... +(gdb) info variable everywhere^M +All variables matching regular expression "everywhere":^M +^M +File /data/vries/gdb/src/gdb/testsuite/gdb.cp/m-static.h:^M +8: const int gnu_obj_4::everywhere;^M +... + +At that point I realized I'm looking at a bug (filed as PR symtab/30265), +which manifests on openSUSE Leap 15.4 for native and readnow, and on Ubuntu +20.04 for readnow, but not for native. + +Before my commit, the test-case passed whether the bug manifested or not. + +After my commit, the test-case only passed when the bug manifested. + +Fix the test-case regression by reverting to the situation before the commit: +pass whether the bug manifests or not. We could add an xfail for the PR, but +I'm expecting a fix soon, so that doesn't look worth the effort. + +Tested on x86_64-linux, both on openSUSE Leap 15.4 and Ubuntu 20.04, both with +native and readnow. + +Reported-By: Simon Marchi +--- + gdb/testsuite/gdb.cp/m-static.exp | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.cp/m-static.exp b/gdb/testsuite/gdb.cp/m-static.exp +index 97a5645b53a..a67b4cd3736 100644 +--- a/gdb/testsuite/gdb.cp/m-static.exp ++++ b/gdb/testsuite/gdb.cp/m-static.exp +@@ -181,7 +181,10 @@ gdb_test "print test4.somewhere" "\\$\[0-9\].* = 3.14\[0-9\]*" "static const flo + + # Also make sure static const members can be found via "info var". + if { $non_dwarf } { setup_xfail *-*-* } +-gdb_test "info variable everywhere" "File .*/m-static\[.\]h.*const int gnu_obj_4::everywhere;" ++gdb_test "info variable everywhere" \ ++ [multi_line \ ++ "File (.*/)?m-static\[.\]h:" \ ++ "$decimal:\tconst int gnu_obj_4::everywhere;.*"] + + # Perhaps at some point test4 should also include a test for a static + # const int that was initialized in the header file. But I'm not sure +-- +2.35.3 + diff --git a/gdb-testsuite-fix-gdb.dwarf2-nullptr_t.exp-with-cc-w.patch b/gdb-testsuite-fix-gdb.dwarf2-nullptr_t.exp-with-cc-w.patch new file mode 100644 index 0000000..cd67600 --- /dev/null +++ b/gdb-testsuite-fix-gdb.dwarf2-nullptr_t.exp-with-cc-w.patch @@ -0,0 +1,38 @@ +From 335a151d834199610b515e67f1924d6e0a211db2 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Wed, 30 Aug 2023 23:33:31 +0200 +Subject: [PATCH 09/12] [gdb/testsuite] Fix gdb.dwarf2/nullptr_t.exp with + cc-with-dwz-m + +When running test-case gdb.dwarf2/nullptr_t.exp with target board +cc-with-dwz-m, I run into: +... +FAIL: gdb.dwarf2/nullptr_t.exp: decltype(nullptr) symbol +... + +The problem is that were looking for "typedef void decltype\\(nullptr\\)" +using "maint print symbols -source $srcfile", but dwz has moved the typedef to +a PU, so it's shown by "maint print symbols -source " instead. + +Fix this by dropping the "-source $srcfile" bit. + +Tested on x86_64-linux, with make-check-all.sh. +--- + gdb/testsuite/gdb.dwarf2/nullptr_t.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.dwarf2/nullptr_t.exp b/gdb/testsuite/gdb.dwarf2/nullptr_t.exp +index a02ebbf109e..e78d90fdb25 100644 +--- a/gdb/testsuite/gdb.dwarf2/nullptr_t.exp ++++ b/gdb/testsuite/gdb.dwarf2/nullptr_t.exp +@@ -34,6 +34,6 @@ with_complaints 5 { + gdb_test $cmd $re "$cmd without complaints" + } + +-gdb_test "maint print symbols -source $srcfile" \ ++gdb_test "maint print symbols" \ + "typedef void decltype\\(nullptr\\); \r\n.*" \ + "decltype(nullptr) symbol" +-- +2.35.3 + diff --git a/gdb-testsuite-fix-gdb.gdb-python-helper.exp-with-o2-.patch b/gdb-testsuite-fix-gdb.gdb-python-helper.exp-with-o2-.patch new file mode 100644 index 0000000..3065f0a --- /dev/null +++ b/gdb-testsuite-fix-gdb.gdb-python-helper.exp-with-o2-.patch @@ -0,0 +1,146 @@ +From f90de5ff0840a3807e01a250fd3379a009821a04 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 24 Apr 2023 22:08:53 +0200 +Subject: [PATCH 4/4] [gdb/testsuite] Fix gdb.gdb/python-helper.exp with -O2 + -flto + +On openSUSE Leap 15.4, with gcc 7.5.0, when building gdb with +-O2 -g -flto=auto, I run into: +... +FAIL: gdb.gdb/python-helper.exp: hit breakpoint in outer gdb +FAIL: gdb.gdb/python-helper.exp: print integer from DWARF info +FAIL: gdb.gdb/python-helper.exp: print *type->main_type +... + +Fix the first two FAILs by using $bkptno_numopt_re. + +The last FAIL is due to: +... +(outer-gdb) print *type->main_type^M +A syntax error in expression, near `->main_type'.^M +(outer-gdb) FAIL: gdb.gdb/python-helper.exp: print *type->main_type +... +because: +... +(outer-gdb) print type^M +Attempt to use a type name as an expression^M +... + +Fix this by making the test unresolved if "print type" or +"print type->main_type" doesn't succeed. + +On openSUSE Tumbleweed, with gcc 13.0.1, when building gdb with +-O2 -g -flto=auto, I run into timeouts due to the breakpoint in c_print_type +not hitting. Fix this by detecting the situation and bailing out. + +Tested on x86_64-linux. +--- + gdb/testsuite/gdb.gdb/python-helper.exp | 77 +++++++++++++++++++------ + 1 file changed, 58 insertions(+), 19 deletions(-) + +diff --git a/gdb/testsuite/gdb.gdb/python-helper.exp b/gdb/testsuite/gdb.gdb/python-helper.exp +index 8afbc0f219b..0520d5800fb 100644 +--- a/gdb/testsuite/gdb.gdb/python-helper.exp ++++ b/gdb/testsuite/gdb.gdb/python-helper.exp +@@ -127,7 +127,9 @@ proc test_python_helper {} { + # GDB, this should result in the outer GDB stopping at one of the + # breakpoints we created.. + send_inferior "print 1\n" +- gdb_test -prompt $outer_prompt_re "" "Breakpoint $decimal, value_print.*" "hit breakpoint in outer gdb" ++ gdb_test -prompt $outer_prompt_re "" \ ++ "Breakpoint $bkptno_numopt_re, value_print.*" \ ++ "hit breakpoint in outer gdb" + + # Now inspect the type of parameter VAL, this should trigger the + # pretty printers. +@@ -165,8 +167,10 @@ proc test_python_helper {} { + # information, this will include the TYPE_SPECIFIC_INT + # information. + send_inferior "print global_c.m_val\n" +- gdb_test -prompt $outer_prompt_re "" "Breakpoint $decimal, value_print.*" "print integer from DWARF info" +- ++ gdb_test -prompt $outer_prompt_re "" \ ++ "Breakpoint $bkptno_numopt_re, value_print.*" \ ++ "print integer from DWARF info" ++ + set answer [multi_line \ + "$decimal = " \ + "{name = $hex \"int\"," \ +@@ -190,23 +194,58 @@ proc test_python_helper {} { + # Send a command to the inner GDB, this should result in the outer + # GDB stopping at the value_print breakpoint again. + send_inferior "ptype global_c\n" +- gdb_test -prompt $outer_prompt_re "" "Breakpoint $bkptno_numopt_re, c_print_type.*" "hit breakpoint in outer gdb again" ++ set test "hit breakpoint in outer gdb again" ++ set in_outer_gdb 0 ++ gdb_test_multiple "" $test -prompt $outer_prompt_re { ++ -re "Breakpoint $bkptno_numopt_re, c_print_type.*\r\n$outer_prompt_re" { ++ pass $gdb_test_name ++ set in_outer_gdb 1 ++ } ++ -re "\r\n$gdb_prompt $" { ++ unsupported $gdb_test_name ++ } ++ } + +- set answer [multi_line \ +- "$decimal = " \ +- "{name = $hex \"CC\"," \ +- " code = TYPE_CODE_STRUCT," \ +- " flags = \[^\r\n\]+," \ +- " owner = $hex \\(objfile\\)," \ +- " target_type = 0x0," \ +- " flds_bnds\\.fields\\\[0\\\]:" \ +- " {m_name = $hex \"m_val\"," \ +- " m_type = $hex," \ +- " m_loc_kind = FIELD_LOC_KIND_BITPOS," \ +- " bitsize = 0," \ +- " bitpos = 0}," \ +- " cplus_stuff = $hex}"] +- gdb_test -prompt $outer_prompt_re "print *type->main_type" $answer ++ if { ! $in_outer_gdb } { ++ return 0 ++ } ++ ++ set cmd "print *type->main_type" ++ set cmd_supported 1 ++ foreach sub_expr { type type->main_type } { ++ set ok 0 ++ gdb_test_multiple "print $sub_expr" "" -prompt $outer_prompt_re { ++ -re " = \\(\[^\r\n\]+ \\*\\) $hex\r\n$outer_prompt_re" { ++ set ok 1 ++ } ++ -re "\r\n$outer_prompt_re" { ++ } ++ } ++ if { ! $ok } { ++ set cmd_supported 0 ++ break ++ } ++ } ++ ++ if { $cmd_supported } { ++ set answer [multi_line \ ++ "$decimal = " \ ++ "{name = $hex \"CC\"," \ ++ " code = TYPE_CODE_STRUCT," \ ++ " flags = \[^\r\n\]+," \ ++ " owner = $hex \\(objfile\\)," \ ++ " target_type = 0x0," \ ++ " flds_bnds\\.fields\\\[0\\\]:" \ ++ " {m_name = $hex \"m_val\"," \ ++ " m_type = $hex," \ ++ " m_loc_kind = FIELD_LOC_KIND_BITPOS," \ ++ " bitsize = 0," \ ++ " bitpos = 0}," \ ++ " cplus_stuff = $hex}"] ++ gdb_test -prompt $outer_prompt_re $cmd $answer ++ } else { ++ unsupported $cmd ++ } + + return 0 + } +-- +2.35.3 + diff --git a/gdb-testsuite-fix-gdb.python-py-breakpoint.exp-timeo.patch b/gdb-testsuite-fix-gdb.python-py-breakpoint.exp-timeo.patch new file mode 100644 index 0000000..7c4af67 --- /dev/null +++ b/gdb-testsuite-fix-gdb.python-py-breakpoint.exp-timeo.patch @@ -0,0 +1,73 @@ +From 911a6999884d94959551aa8e02858b6b8429f275 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Tue, 28 Feb 2023 15:50:23 +0100 +Subject: [PATCH 4/9] [gdb/testsuite] Fix gdb.python/py-breakpoint.exp timeouts + +On powerpc64le-linux, I run into two timeouts: +... +FAIL: gdb.python/py-breakpoint.exp: test_watchpoints: \ + Test watchpoint write (timeout) +FAIL: gdb.python/py-breakpoint.exp: test_bkpt_internal: \ + Test watchpoint write (timeout) +... + +In this case, hw watchpoints are not supported, and using sw watchpoints +is slow. + +Most of the time is spent in handling a try-catch, which triggers a malloc. I +think this bit is more relevant for the "catch throw" part of the test-case, +so fix the timeouts by setting the watchpoints after the try-catch. + +Tested on x86_64-linux and powerpc64le-linux. +--- + gdb/testsuite/gdb.python/py-breakpoint.c | 2 ++ + gdb/testsuite/gdb.python/py-breakpoint.exp | 6 ++++-- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/gdb/testsuite/gdb.python/py-breakpoint.c b/gdb/testsuite/gdb.python/py-breakpoint.c +index 0f791da9c27..1fb341660e9 100644 +--- a/gdb/testsuite/gdb.python/py-breakpoint.c ++++ b/gdb/testsuite/gdb.python/py-breakpoint.c +@@ -60,6 +60,8 @@ int main (int argc, char *argv[]) + /* Nothing. */ + } + ++ i = -1; /* Past throw-catch. */ ++ + for (i = 0; i < 10; i++) + { + result += multiply (foo); /* Break at multiply. */ +diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp +index 397e4b31309..9ba6b837a41 100644 +--- a/gdb/testsuite/gdb.python/py-breakpoint.exp ++++ b/gdb/testsuite/gdb.python/py-breakpoint.exp +@@ -37,6 +37,8 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} ${options}] + # Skip all tests if Python scripting is not enabled. + if { [skip_python_tests] } { continue } + ++set past_throw_catch_line [gdb_get_line_number "Past throw-catch."] ++ + proc_with_prefix test_bkpt_basic { } { + global srcfile testfile hex decimal + +@@ -293,7 +295,7 @@ proc_with_prefix test_watchpoints { } { + gdb_test_no_output "set can-use-hw-watchpoints 0" "" + } + +- if {![runto_main]} { ++ if {![runto $srcfile:$::past_throw_catch_line]} { + return 0 + } + +@@ -316,7 +318,7 @@ proc_with_prefix test_bkpt_internal { } { + if {$skip_hw_watchpoint_tests_p} { + gdb_test_no_output "set can-use-hw-watchpoints 0" "" + } +- if {![runto_main]} { ++ if {![runto $srcfile:$::past_throw_catch_line]} { + return 0 + } + delete_breakpoints +-- +2.35.3 + diff --git a/gdb-testsuite-fix-gdb.python-py-breakpoint.exp-with-.patch b/gdb-testsuite-fix-gdb.python-py-breakpoint.exp-with-.patch new file mode 100644 index 0000000..5dc8787 --- /dev/null +++ b/gdb-testsuite-fix-gdb.python-py-breakpoint.exp-with-.patch @@ -0,0 +1,65 @@ +From 0cb123a4157d215c80f3deb339a3ba10a188ba19 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 2 Jan 2023 11:59:17 +0100 +Subject: [PATCH 1/6] [gdb/testsuite] Fix gdb.python/py-breakpoint.exp with + libstdc++ debug info + +On x86_64-linux, I run into: +... +(gdb) python hbp1 = gdb.Breakpoint("add", type=gdb.BP_HARDWARE_BREAKPOINT)^M +Hardware assisted breakpoint 2 at 0x40072e: add. (7 locations)^M +(gdb) FAIL: gdb.python/py-breakpoint.exp: test_hardware_breakpoints: \ + Set hardware breakpoint +... +due to libstdc++ debug info: +... +$ gdb -q -batch outputs/gdb.python/py-breakpoint/py-breakpoint \ + -ex start \ + -ex "b add" \ + -ex "info break" +Temporary breakpoint 1 at 0x40076a: file py-breakpoint.c, line 50. + +Temporary breakpoint 1, main (argc=1, argv=$hex) at py-breakpoint.c:50 +50 int foo = 5; +Breakpoint 2 at 0x40072e: add. (7 locations) +Num Type Disp Enb Address What +2 breakpoint keep y +2.1 y 0x000000000040072e in add(int) at \ + py-breakpoint.c:39 +2.2 y 0x00007ffff7b131de in \ + (anonymous namespace)::fast_float::bigint::add at \ + ../../../../../libstdc++-v3/src/c++17/fast_float/fast_float.h:1815 + ... +2.7 y 0x00007ffff7b137e4 in \ + (anonymous namespace)::fast_float::bigint::add at \ + ../../../../../libstdc++-v3/src/c++17/fast_float/fast_float.h:1815 +... + +Fix this by using qualified=True. + +Tested on x86_64-linux. +PR testsuite/29910 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29910 +--- + gdb/testsuite/gdb.python/py-breakpoint.exp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp +index 9ba6b837a41..23c6637cd3a 100644 +--- a/gdb/testsuite/gdb.python/py-breakpoint.exp ++++ b/gdb/testsuite/gdb.python/py-breakpoint.exp +@@ -273,7 +273,8 @@ proc_with_prefix test_hardware_breakpoints { } { + + delete_breakpoints + +- gdb_test "python hbp1 = gdb.Breakpoint(\"add\", type=gdb.BP_HARDWARE_BREAKPOINT)" \ ++ set bp_args {"add", type=gdb.BP_HARDWARE_BREAKPOINT, qualified=True} ++ gdb_test "python hbp1 = gdb.Breakpoint($bp_args)" \ + ".*Hardware assisted breakpoint ($decimal)+ at .*$srcfile, line ($decimal)+\." \ + "Set hardware breakpoint" + gdb_test "python print (gdb.breakpoints()\[0\].type == gdb.BP_HARDWARE_BREAKPOINT)" \ + +base-commit: 1cd845ab3d405412aabf9b959aa527dd60143826 +-- +2.35.3 + diff --git a/gdb-testsuite-fix-gdb.rust-watch.exp-on-ppc64le.patch b/gdb-testsuite-fix-gdb.rust-watch.exp-on-ppc64le.patch new file mode 100644 index 0000000..823633e --- /dev/null +++ b/gdb-testsuite-fix-gdb.rust-watch.exp-on-ppc64le.patch @@ -0,0 +1,42 @@ +From 0eade9c77cd7582fd6fe23cee3ed569a9115a6ba Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Tue, 28 Feb 2023 13:32:23 +0100 +Subject: [PATCH 2/9] [gdb/testsuite] Fix gdb.rust/watch.exp on ppc64le + +On x86_64-linux, I have: +... +(gdb) watch -location y^M +Hardware watchpoint 2: -location y^M +(gdb) PASS: gdb.rust/watch.exp: watch -location y +... +but on powerpc64le-linux, I run into: +... +(gdb) watch -location y^M +Watchpoint 2: -location y^M +(gdb) FAIL: gdb.rust/watch.exp: watch -location y +... +due to the regexp matching "Hardware watchpoint" but not "Watchpoint": +... +gdb_test "watch -location y" ".*watchpoint .* -location .*" +... + +Fix this by making the regexp less restrictive. + +Tested on x86_64-linux and powerpc64le-linux. +--- + gdb/testsuite/gdb.rust/watch.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.rust/watch.exp b/gdb/testsuite/gdb.rust/watch.exp +index b709c00e394..5c4636ef7a8 100644 +--- a/gdb/testsuite/gdb.rust/watch.exp ++++ b/gdb/testsuite/gdb.rust/watch.exp +@@ -32,4 +32,4 @@ if {![runto ${srcfile}:$line]} { + } + + # Just setting a watchpoint was enough to trigger the bug. +-gdb_test "watch -location y" ".*watchpoint .* -location .*" ++gdb_test "watch -location y" ".*\[wW\]atchpoint .* -location .*" +-- +2.35.3 + diff --git a/gdb-testsuite-fix-gdb.threads-schedlock.exp-for-gcc-.patch b/gdb-testsuite-fix-gdb.threads-schedlock.exp-for-gcc-.patch new file mode 100644 index 0000000..d3f3ece --- /dev/null +++ b/gdb-testsuite-fix-gdb.threads-schedlock.exp-for-gcc-.patch @@ -0,0 +1,68 @@ +From f168a48adf97a36c88c65a075b42e6b7083063df Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 20 Feb 2023 11:16:02 +0100 +Subject: [PATCH] [gdb/testsuite] Fix gdb.threads/schedlock.exp for gcc 4.8.5 + +Since commit 9af467b8240 ("[gdb/testsuite] Fix gdb.threads/schedlock.exp on +fast cpu"), the test-case fails for gcc 4.8.5. + +The problem is that for gcc 4.8.5, the commit turned a two-line loop: +... +(gdb) next +78 while (*myp > 0) +(gdb) next +81 MAYBE_CALL_SOME_FUNCTION(); (*myp) ++; +(gdb) next +78 while (*myp > 0) +... +into a three-line loop: +... +(gdb) next +83 MAYBE_CALL_SOME_FUNCTION(); (*myp) ++; +(gdb) next +84 cnt++; +(gdb) next +85 } +(gdb) next +83 MAYBE_CALL_SOME_FUNCTION(); (*myp) ++; +(gdb) +... +and the test-case doesn't expect this. + +Fix this by reverting back to the original loop shape as much as possible by: +- removing the cnt++ line +- replacing "while (1)" with "while (one)", where one is a volatile variable + set to 1. + +Tested on x86_64-linux, using compilers: +- gcc 4.8.5, 7.5.0, 12.2.1 +- clang 4.0.1, 13.0.1 +--- + gdb/testsuite/gdb.threads/schedlock.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/gdb/testsuite/gdb.threads/schedlock.c b/gdb/testsuite/gdb.threads/schedlock.c +index 9859885b1a3..af3ca3e4c87 100644 +--- a/gdb/testsuite/gdb.threads/schedlock.c ++++ b/gdb/testsuite/gdb.threads/schedlock.c +@@ -75,13 +75,12 @@ volatile int call_function = 0; + void *thread_function(void *arg) { + int my_number = (long) arg; + unsigned long long int *myp = (unsigned long long int *) &args[my_number]; +- volatile unsigned int cnt = 0; ++ volatile unsigned int one = 1; + +- while (1) ++ while (one) + { + /* schedlock.exp: main loop. */ + MAYBE_CALL_SOME_FUNCTION(); (*myp) ++; +- cnt++; + } + + pthread_exit(NULL); + +base-commit: 4d69e6ec1a8ddd008f34af363dab73c014823074 +-- +2.35.3 + diff --git a/gdb-testsuite-fix-gdb.threads-schedlock.exp-on-fast-.patch b/gdb-testsuite-fix-gdb.threads-schedlock.exp-on-fast-.patch new file mode 100644 index 0000000..9801383 --- /dev/null +++ b/gdb-testsuite-fix-gdb.threads-schedlock.exp-on-fast-.patch @@ -0,0 +1,97 @@ +From c25a24cc237721c51034f4425183f73e97cdccc1 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 6 Feb 2023 12:52:50 +0100 +Subject: [PATCH 06/11] [gdb/testsuite] Fix gdb.threads/schedlock.exp on fast + cpu + +Occasionally, I run into: +... +(gdb) PASS: gdb.threads/schedlock.exp: schedlock=on: cmd=continue: \ + set scheduler-locking on +continue^M +Continuing.^M +PASS: gdb.threads/schedlock.exp: schedlock=on: cmd=continue: \ + continue (with lock) +[Thread 0x7ffff746e700 (LWP 1339) exited]^M +No unwaited-for children left.^M +(gdb) Quit^M +(gdb) FAIL: gdb.threads/schedlock.exp: schedlock=on: cmd=continue: \ + stop all threads (with lock) (timeout) +... + +What happens is that this loop which is supposed to run "just short of forever": +... + /* Don't run forever. Run just short of it :) */ + while (*myp > 0) + { + /* schedlock.exp: main loop. */ + MAYBE_CALL_SOME_FUNCTION(); (*myp) ++; + } +... +finishes after 0x7fffffff iterations (when a signed wrap occurs), which on my +system takes only about 1.5 seconds. + +Fix this by: +- changing the pointed-at type of myp from signed to unsigned, which makes the + wrap defined behaviour (and which also make the loop run twice as long, + which is already enough to make it impossible for me to reproduce the FAIL. + But let's try to solve this more structurally). +- changing the pointed-at type of myp from int to long long, making the wrap + unlikely. +- making sure the loop runs forever, by setting the loop condition to 1. +- making sure the loop still contains different lines (as far as debug info is + concerned) by incrementing a volatile counter in the loop. +- making sure the program doesn't run forever in case of trouble, by adding an + "alarm (30)". + +Tested on x86_64-linux. + +PR testsuite/30074 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30074 +--- + gdb/testsuite/gdb.threads/schedlock.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/gdb/testsuite/gdb.threads/schedlock.c b/gdb/testsuite/gdb.threads/schedlock.c +index 7672140fdc8..9859885b1a3 100644 +--- a/gdb/testsuite/gdb.threads/schedlock.c ++++ b/gdb/testsuite/gdb.threads/schedlock.c +@@ -24,7 +24,7 @@ void *thread_function(void *arg); /* Pointer to function executed by each thread + + #define NUM 1 + +-unsigned int args[NUM+1]; ++unsigned long long int args[NUM+1]; + + int main() { + int res; +@@ -32,6 +32,8 @@ int main() { + void *thread_result; + long i; + ++ alarm (30); ++ + for (i = 1; i <= NUM; i++) + { + args[i] = 1; +@@ -72,13 +74,14 @@ volatile int call_function = 0; + + void *thread_function(void *arg) { + int my_number = (long) arg; +- int *myp = (int *) &args[my_number]; ++ unsigned long long int *myp = (unsigned long long int *) &args[my_number]; ++ volatile unsigned int cnt = 0; + +- /* Don't run forever. Run just short of it :) */ +- while (*myp > 0) ++ while (1) + { + /* schedlock.exp: main loop. */ + MAYBE_CALL_SOME_FUNCTION(); (*myp) ++; ++ cnt++; + } + + pthread_exit(NULL); +-- +2.35.3 + diff --git a/gdb-testsuite-fix-regexps-in-gdb.base-step-over-sysc.patch b/gdb-testsuite-fix-regexps-in-gdb.base-step-over-sysc.patch new file mode 100644 index 0000000..e3eef88 --- /dev/null +++ b/gdb-testsuite-fix-regexps-in-gdb.base-step-over-sysc.patch @@ -0,0 +1,85 @@ +From e492116f04d3b4d704c4f6f3259143d7fb16a03e Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Wed, 26 Jul 2023 11:53:31 +0200 +Subject: [PATCH 03/12] [gdb/testsuite] Fix regexps in + gdb.base/step-over-syscall.exp + +When running test-case gdb.base/step-over-syscall.exp without glibc debuginfo +installed, I get: +... +(gdb) continue^M +Continuing.^M +^M +Breakpoint 2, 0x00007ffff7d4405e in vfork () from /lib64/libc.so.6^M +(gdb) PASS: gdb.base/step-over-syscall.exp: vfork: displaced=off: \ + continue to vfork (1st time) +... +but with glibc debuginfo installed I get instead: +... +(gdb) continue^M +Continuing.^M +^M +Breakpoint 2, 0x00007ffff7d4405e in __libc_vfork () at \ + ../sysdeps/unix/sysv/linux/x86_64/vfork.S:44^M +44 ENTRY (__vfork)^M +(gdb) FAIL: gdb.base/step-over-syscall.exp: vfork: displaced=off: \ + continue to vfork (1st time) +... + +The FAIL is due to a mismatch with regexp: +... + "Breakpoint \[0-9\]+, (.* in |__libc_|)$syscall \\(\\).*" +... +because it cannot match both ".* in " and the __libc_ prefix. + +Fix this by using instead the regexp: +... + "Breakpoint \[0-9\]+, (.* in )?(__libc_)?$syscall \\(\\).*" +... + +Tested on x86_64-linux. +--- + gdb/testsuite/gdb.base/step-over-syscall.exp | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/step-over-syscall.exp b/gdb/testsuite/gdb.base/step-over-syscall.exp +index 424eee142fd..87ff2606d30 100644 +--- a/gdb/testsuite/gdb.base/step-over-syscall.exp ++++ b/gdb/testsuite/gdb.base/step-over-syscall.exp +@@ -127,13 +127,13 @@ proc setup { syscall } { + + gdb_test "break \*$syscall" "Breakpoint \[0-9\]* at .*" + +- gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, (.* in |__libc_|)$syscall \\(\\).*" \ ++ gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, (.* in )?(__libc_)?$syscall \\(\\).*" \ + "continue to $syscall (1st time)" + # Hit the breakpoint on $syscall for the first time. In this time, + # we will let PLT resolution done, and the number single steps we will + # do later will be reduced. + +- gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, (.* in |__libc_|)$syscall \\(\\).*" \ ++ gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, (.* in )?(__libc_)?$syscall \\(\\).*" \ + "continue to $syscall (2nd time)" + # Hit the breakpoint on $syscall for the second time. In this time, + # the address of syscall insn and next insn of syscall are recorded. +@@ -265,7 +265,7 @@ proc step_over_syscall { syscall } { + return -1 + } + +- gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, (.* in |__libc_|)$syscall \\(\\).*" \ ++ gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, (.* in )?(__libc_)?$syscall \\(\\).*" \ + "continue to $syscall (3rd time)" + + # Hit the breakpoint on $syscall for the third time. In this time, we'll set +@@ -333,7 +333,7 @@ proc break_cond_on_syscall { syscall follow_fork detach_on_fork } { + return -1 + } + +- gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, (.* in |__libc_|)$syscall \\(\\).*" \ ++ gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, (.* in )?(__libc_)?$syscall \\(\\).*" \ + "continue to $syscall" + # Delete breakpoint syscall insns to avoid interference with other syscalls. + delete_breakpoints +-- +2.35.3 + diff --git a/gdb-testsuite-handle-missing-gdc-in-gdb.dlang-dlang-.patch b/gdb-testsuite-handle-missing-gdc-in-gdb.dlang-dlang-.patch new file mode 100644 index 0000000..75cb6e4 --- /dev/null +++ b/gdb-testsuite-handle-missing-gdc-in-gdb.dlang-dlang-.patch @@ -0,0 +1,77 @@ +From f53b5ad4cd27738387f22e067881a15a2327ba5b Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 27 Mar 2023 11:35:26 +0200 +Subject: [PATCH 3/6] [gdb/testsuite] Handle missing gdc in + gdb.dlang/dlang-start.exp + +On openSUSE Leap 15.4, I get: +... +Running gdb.dlang/dlang-start.exp ... +gdb compile failed, default_target_compile: Can't find gdc. +UNTESTED: gdb.dlang/dlang-start.exp: failed to prepare +... + +Fix this by: +- introducing a new proc can_compile, and +- requiring "can_compile d" in the test-case, +such that I have instead: +... +Running gdb.dlang/dlang-start.exp ... +UNSUPPORTED: gdb.dlang/dlang-start.exp: require failed: can_compile d +... + +Tested on x86_64-linux, on openSUSE Leap 15.4 and Fedora 37. +--- + gdb/testsuite/gdb.dlang/dlang-start.exp | 1 + + gdb/testsuite/lib/gdb.exp | 16 ++++++++++++++++ + 2 files changed, 17 insertions(+) + +diff --git a/gdb/testsuite/gdb.dlang/dlang-start.exp b/gdb/testsuite/gdb.dlang/dlang-start.exp +index 3e5b6050c07..413e8514968 100644 +--- a/gdb/testsuite/gdb.dlang/dlang-start.exp ++++ b/gdb/testsuite/gdb.dlang/dlang-start.exp +@@ -18,6 +18,7 @@ + load_lib d-support.exp + + if { [skip_d_tests] } { continue } ++if { ![can_compile d] } { continue } + + # This testcase verifies the behavior of the `start' command, which + # does not work when we use the gdb stub... +diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp +index 095d8930edb..b6e30204371 100644 +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -2471,6 +2471,18 @@ proc skip_d_tests {} { + return 0 + } + ++# Return a 1 if we can compile source files in LANG. ++ ++proc can_compile { lang } { ++ ++ if { $lang == "d" } { ++ set src { void main() {} } ++ return [gdb_can_simple_compile can_compile_$lang $src executable {d}] ++ } ++ ++ error "can_compile doesn't support lang: $lang" ++} ++ + # Return 1 to skip Rust tests, 0 to try them. + proc skip_rust_tests {} { + if { ![isnative] } { +@@ -4632,6 +4644,10 @@ proc gdb_simple_compile {name code {type object} {compile_flags {}} {object obj} + set ext "go" + break + } ++ if { "$flag" eq "d" } { ++ set ext "d" ++ break ++ } + } + set src [standard_temp_file $name-[pid].$ext] + set obj [standard_temp_file $name-[pid].$postfix] +-- +2.35.3 + diff --git a/gdb-testsuite-handle-output-after-prompt-in-gdb.thre.patch b/gdb-testsuite-handle-output-after-prompt-in-gdb.thre.patch new file mode 100644 index 0000000..b24d011 --- /dev/null +++ b/gdb-testsuite-handle-output-after-prompt-in-gdb.thre.patch @@ -0,0 +1,53 @@ +From a39101060cdf2ee239833106fb3bdf9585f858aa Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Wed, 7 Jun 2023 11:36:19 +0200 +Subject: [PATCH] [gdb/testsuite] Handle output after prompt in + gdb.threads/step-N-all-progress.exp + +Using "taskset -c 0" I run into this timeout: +... +(gdb) PASS: gdb.threads/step-N-all-progress.exp: non-stop=on: \ + target-non-stop=on: continue to breakpoint: break here +next 3^M +[New Thread 0x7ffff7dbd6c0 (LWP 10202)]^M +50 return 0;^M +(gdb) [Thread 0x7ffff7dbd6c0 (LWP 10202) exited]^M +FAIL: gdb.threads/step-N-all-progress.exp: non-stop=on: target-non-stop=on: \ + next 3 (timeout) +... + +The problem is that this test: +... + gdb_test "next 3" "return 0;" +... +expects no output after the prompt. + +Fix this by using -no-prompt-anchor. + +Tested on x86_64-linux. +--- + gdb/testsuite/gdb.threads/step-N-all-progress.exp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/testsuite/gdb.threads/step-N-all-progress.exp b/gdb/testsuite/gdb.threads/step-N-all-progress.exp +index 98cc8423f34..485028d34e7 100644 +--- a/gdb/testsuite/gdb.threads/step-N-all-progress.exp ++++ b/gdb/testsuite/gdb.threads/step-N-all-progress.exp +@@ -44,7 +44,7 @@ proc test {non-stop target-non-stop} { + + gdb_continue_to_breakpoint "break here" + +- gdb_test "next 3" "return 0;" ++ gdb_test -no-prompt-anchor "next 3" "return 0;" + } + + foreach_with_prefix non-stop {off on} { + +base-commit: 7f7fcd7031430953f41b284069d1ed0cf3c8734a +prerequisite-patch-id: b0bf6c343c4113f430e2dce98279078433692131 +prerequisite-patch-id: 20ed3972a694ff7b7eebd0626be31f8694c62afe +prerequisite-patch-id: 2d7b3990c49a8ddc0e4ebc5c328b8cfcd841ec93 +prerequisite-patch-id: 201c63297f725b3796a241d804df62e02b4a8abc +-- +2.35.3 + 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..199e611 --- /dev/null +++ b/gdb-testsuite-prevent-compilation-fails-with-unix-fpie-pie.patch @@ -0,0 +1,131 @@ +From ea9f87de71b8d5cd0f9d62ebca57cef7ee879324 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Fri, 21 Apr 2023 18:01:00 +0200 +Subject: [PATCH 5/5] [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 2be69479d70..85ef279bfe9 100644 +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -4966,6 +4966,17 @@ proc gdb_compile {source dest type options} { + set options [lreplace $options $macros $macros $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"] +@@ -8875,6 +8886,48 @@ gdb_caching_proc linker_supports_image_base_flag { + } + + ++# 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 { +-- +2.35.3 + diff --git a/gdb-testsuite-relax-breakpoint-count-check-in-gdb.py.patch b/gdb-testsuite-relax-breakpoint-count-check-in-gdb.py.patch new file mode 100644 index 0000000..0734e14 --- /dev/null +++ b/gdb-testsuite-relax-breakpoint-count-check-in-gdb.py.patch @@ -0,0 +1,73 @@ +From 943623fbdfbc3c047af66866fad4fc5ee4fc1e3b Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 12 Jun 2023 13:00:09 +0200 +Subject: [PATCH] [gdb/testsuite] Relax breakpoint count check in + gdb.python/py-rbreak.exp + +With a gdb 13.2 based package on SLE-15 aarch64, I run into: +... +(gdb) PASS: gdb.python/py-rbreak.exp: nosharedlibrary +py sl = gdb.rbreak("^[^_]",minsyms=False)^M +Breakpoint 2 at 0x4004ac: file ../sysdeps/aarch64/crti.S, line 63.^M + ... +(gdb) py print(len(sl))^M +12^M +(gdb) FAIL: gdb.python/py-rbreak.exp: check number of returned breakpoints is 11 +... + +The FAIL is due to: +- the glibc object crti.o containing debug information for function + call_weak_fn, and +- the test-case not expecting this. + +The debug information is there due to compiling glibc using a binutils which +contains commit 591cc9fbbfd ("gas/Dwarf: record functions"). + +I've run into a similar issue before, see commit 3fbbcf473a5 ("[gdb/testsuite] +Fix regexp in py-rbreak.exp"). + +The fix I applied there was to use a regexp "^[^_]" to filter out +__libc_csu_fini and __libc_csu_init, but that doesn't work for call_weak_fn. + +Fix this by: +- reverting the regexp to "", and +- rewriting the check to require at least 11 functions, rather than a precise + match. + +Tested on x86_64-linux. + +PR testsuite/30538 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30538 +--- + gdb/testsuite/gdb.python/py-rbreak.exp | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/gdb/testsuite/gdb.python/py-rbreak.exp b/gdb/testsuite/gdb.python/py-rbreak.exp +index 2d39141285f..a4aa953d094 100644 +--- a/gdb/testsuite/gdb.python/py-rbreak.exp ++++ b/gdb/testsuite/gdb.python/py-rbreak.exp +@@ -32,10 +32,16 @@ if {![runto_main]} { + } + + gdb_test_no_output "nosharedlibrary" +-gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"^\[^_\]\",minsyms=False)" \ ++gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"\",minsyms=False)" \ + "get all function breakpoints" 0 +-gdb_test "py print(len(sl))" "11" \ +- "check number of returned breakpoints is 11" ++set min_breakpoints 11 ++gdb_test_multiple "py print(len(sl))" \ ++ "check number of returned breakpoints is at least $min_breakpoints" { ++ -re -wrap "($decimal)" { ++ set n $expect_out(1,string) ++ gdb_assert { $n >= $min_breakpoints } $gdb_test_name ++ } ++ } + gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"main\.\*\",minsyms=False)" \ + "get main function breakpoint" 0 + gdb_test "py print(len(sl))" "1" \ + +base-commit: 85025e0631ed4b0e8c3aa85d7561a715f142bdc6 +-- +2.35.3 + diff --git a/gdb-testsuite-require-syscall-time-in-gdb.reverse-ti.patch b/gdb-testsuite-require-syscall-time-in-gdb.reverse-ti.patch new file mode 100644 index 0000000..efaddd8 --- /dev/null +++ b/gdb-testsuite-require-syscall-time-in-gdb.reverse-ti.patch @@ -0,0 +1,70 @@ +From e4db94ab97c500e9090feb6da8a1e7974c5c0d9a Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Tue, 21 Feb 2023 14:10:12 +0100 +Subject: [PATCH 2/6] [gdb/testsuite] Require syscall time in + gdb.reverse/time-reverse.exp + +On aarch64-linux, I run into: +... +Running gdb.reverse/time-reverse.exp ... +gdb compile failed, gdb.reverse/time-reverse.c: In function 'main': +gdb.reverse/time-reverse.c:39:12: error: 'SYS_time' undeclared \ + (first use in this function); did you mean 'SYS_times'? + syscall (SYS_time, &time_global); + ^~~~~~~~ + SYS_times +gdb.reverse/time-reverse.c:39:12: note: each undeclared identifier is \ + reported only once for each function it appears in +UNTESTED: gdb.reverse/time-reverse.exp: failed to prepare +... + +Fix this by adding a new proc have_syscall, and requiring syscall time, such +that we have instead: +... +UNSUPPORTED: gdb.reverse/time-reverse.exp: require failed: \ + expr [have_syscall time] +... + +Tested on x86_64-linux and aarch64-linux. +--- + gdb/testsuite/gdb.reverse/time-reverse.exp | 2 ++ + gdb/testsuite/lib/gdb.exp | 11 +++++++++++ + 2 files changed, 13 insertions(+) + +diff --git a/gdb/testsuite/gdb.reverse/time-reverse.exp b/gdb/testsuite/gdb.reverse/time-reverse.exp +index 73648af992b..d382d1c2337 100644 +--- a/gdb/testsuite/gdb.reverse/time-reverse.exp ++++ b/gdb/testsuite/gdb.reverse/time-reverse.exp +@@ -25,6 +25,8 @@ if ![supports_reverse] { + + standard_testfile + ++if { ![have_syscall time] } { return } ++ + if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { + return -1 + } +diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp +index 85ef279bfe9..095d8930edb 100644 +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -9410,5 +9410,16 @@ gdb_caching_proc linux_kernel_version { + return [list $v1 $v2 $v3] + } + ++# Return 1 if syscall NAME is supported. ++ ++proc have_syscall { name } { ++ set src \ ++ [list \ ++ "#include " \ ++ "int var = SYS_$name;"] ++ set src [join $src "\n"] ++ return [gdb_can_simple_compile have_syscall_$name $src object] ++} ++ + # Always load compatibility stuff. + load_lib future.exp +-- +2.35.3 + diff --git a/gdb-testsuite-simplify-gdb.arch-amd64-disp-step-avx..patch b/gdb-testsuite-simplify-gdb.arch-amd64-disp-step-avx..patch new file mode 100644 index 0000000..0c21724 --- /dev/null +++ b/gdb-testsuite-simplify-gdb.arch-amd64-disp-step-avx..patch @@ -0,0 +1,146 @@ +From b40f43e9fd3e523c0c4b50b0dcd8ca743cb6b9a7 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Fri, 17 Feb 2023 15:33:18 +0100 +Subject: [PATCH] [gdb/testsuite] Simplify gdb.arch/amd64-disp-step-avx.exp + +On SLE-11, with glibc 2.11.3, I run into: +... +(gdb) PASS: gdb.arch/amd64-disp-step-avx.exp: vex3: \ + var128 has expected value after +continue^M +Continuing.^M +^M +Program received signal SIGSEGV, Segmentation fault.^M +0x0000000000400283 in _exit (status=0) at \ + ../sysdeps/unix/sysv/linux/_exit.c:33^M +33 ../sysdeps/unix/sysv/linux/_exit.c: No such file or directory.^M +(gdb) FAIL: gdb.arch/amd64-disp-step-avx.exp: \ + continue until exit at amd64-disp-step-avx +... + +This is not related to gdb, we get the same result by just running the exec. + +The problem is that the test-case: +- calls glibc's _exit, and +- uses -nostartfiles -static, putting the burden for any necessary + initialization for calling glibc's _exit on the test-case itself. + +So, when we get to the second insn in _exit: +... +000000000040acb0 <_exit>: + 40acb0: 48 63 d7 movslq %edi,%rdx + 40acb3: 64 4c 8b 14 25 00 00 mov %fs:0x0,%r10 +... +no glibc-related initialization is done, and we run into the segfault. + +Adding this (borrowed from __libc_start_main) in _start in the .S file is +sufficient to fix it: +... + .rept 200 + nop ++ call __pthread_initialize_minimal + .endr +... +But that already doesn't compile with say glibc 2.31, and regardless I think +this sort of fix is too fragile. + +We could of course fix this by simply not running to exit. But ideally we'd +have an exec that doesn't segfault when you just run it. + +Alternatively, we could hand-code an _exit syscall and bypass glibc +all together. But I'd rather fix this in a way that simplifies the test-case. + +Taking a step back, the -nostartfiles -static was added to address that the +xmm registers were not zero at main (which AFAICT is a valid thing to happen). + +[ The change itself silently broke the test-case, needing further fixing by +commit 40310f30a51 ("gdb: make gdb.arch/amd64-disp-step-avx.exp actually test +displaced stepping"). ] + +Instead, simplify things by reverting to the original situation: +- no -nostartfiles -static compilation flags, +- no _start in the .S file, +- use exit instead of _exit in the .S file, +and fix the original problem by setting the xmm registers to zero rather than +checking that they're zero. + +Now that we're no longer forcing -static, add nopie to the flags to prevent +compilation failure with target board unix/-fPIE/-pie. + +Tested on x86_64-linux. + +PR testsuite/30132 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30132 +--- + gdb/testsuite/gdb.arch/amd64-disp-step-avx.S | 12 ++---------- + gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp | 14 ++++---------- + 2 files changed, 6 insertions(+), 20 deletions(-) + +diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.S b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.S +index 924deef224f..b39ee9f6567 100644 +--- a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.S ++++ b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.S +@@ -19,15 +19,7 @@ + instructions. */ + + .text +- +- .global _start,main +-_start: +- # The area at _start is used as the displaced stepping buffer. Put +- # more than enough nop instructions so that the instructions under test +- # below don't conflict with it. +- .rept 200 +- nop +- .endr ++ .global main + main: + nop + +@@ -66,7 +58,7 @@ ro_var: + + done: + mov $0,%rdi +- call _exit ++ call exit + hlt + + /* RIP-relative data for VEX3 test above. */ +diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp +index a64c85bc0e9..e6bdc3c242f 100644 +--- a/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp ++++ b/gdb/testsuite/gdb.arch/amd64-disp-step-avx.exp +@@ -30,9 +30,7 @@ if { ![have_avx] } { + + standard_testfile .S + +-set options [list debug \ +- additional_flags=-static \ +- additional_flags=-nostartfiles] ++set options [list debug nopie] + if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $options] } { + return -1 + } +@@ -111,14 +109,10 @@ proc disp_step_func { func } { + + # Test a VEX2-encoded RIP-relative instruction. + with_test_prefix "vex2" { +- # This test writes to the 'xmm0' register. As the test is +- # statically linked, we know that the XMM registers should all +- # have the default value of 0 at this point in time. We're about +- # to run an AVX instruction that will modify $xmm0, but lets first +- # confirm that all XMM registers are 0. ++ # Initialize all XMM registers to 0. + for {set i 0 } { $i < 16 } { incr i } { +- gdb_test "p /x \$xmm${i}.uint128" " = 0x0" \ +- "xmm${i} has expected value before" ++ gdb_test_no_output "set \$xmm${i}.uint128 = 0" \ ++ "xmm${i} set to zero" + } + + disp_step_func "test_rip_vex2" + +base-commit: 8f25c476588b41f18ef7b026c81a6b415a809930 +-- +2.35.3 + diff --git a/gdb-testsuite-simplify-gdb.base-unwind-on-each-insn..patch b/gdb-testsuite-simplify-gdb.base-unwind-on-each-insn..patch new file mode 100644 index 0000000..6bd6cd9 --- /dev/null +++ b/gdb-testsuite-simplify-gdb.base-unwind-on-each-insn..patch @@ -0,0 +1,118 @@ +From 525bc63f2afc749f967f98730623de3a6895a5e9 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 23 Jan 2023 10:32:45 +0100 +Subject: [PATCH 2/4] [gdb/testsuite] Simplify gdb.base/unwind-on-each-insn.exp + +In test-case gdb.base/unwind-on-each-insn.exp, we try to determine the last +disassembled insn in function foo. + +This in it self is fragile, as demonstrated by commit 91836f41e20 ("Powerpc +fix for gdb.base/unwind-on-each-insn.exp"). + +The use of the last disassembled insn in the test-case is to stop stepping in +foo once reaching it. + +However, the intent is to stop stepping just before returning to main. + +There is no guarantee that the last disassembled insn: +- is actually executed +- is executed just before returning to main +- is executed only once. + +Fix this by simplying the test-case to continue stepping till stepping out of +foo. + +Tested on x86_64-linux. +--- + .../gdb.base/unwind-on-each-insn.exp | 62 ++++--------------- + 1 file changed, 11 insertions(+), 51 deletions(-) + +diff --git a/gdb/testsuite/gdb.base/unwind-on-each-insn.exp b/gdb/testsuite/gdb.base/unwind-on-each-insn.exp +index c8748d5ae14..5e822effaf1 100644 +--- a/gdb/testsuite/gdb.base/unwind-on-each-insn.exp ++++ b/gdb/testsuite/gdb.base/unwind-on-each-insn.exp +@@ -73,51 +73,6 @@ set main_fid [get_fid] + gdb_breakpoint "*foo" + gdb_continue_to_breakpoint "enter foo" + +-# Figure out the range of addresses covered by this function. +-set last_addr_in_foo "" +- +-# The disassembly of foo on PowerPC looks like: +-# Dump of assembler code for function foo: +-# => 0x00000000100006dc <+0>: std r31,-8(r1) +-# 0x00000000100006e0 <+4>: stdu r1,-48(r1) +-# 0x00000000100006e4 <+8>: mr r31,r1 +-# 0x00000000100006e8 <+12>: nop +-# 0x00000000100006ec <+16>: addi r1,r31,48 +-# 0x00000000100006f0 <+20>: ld r31,-8(r1) +-# 0x00000000100006f4 <+24>: blr +-# 0x00000000100006f8 <+28>: .long 0x0 +-# 0x00000000100006fc <+32>: .long 0x0 +-# 0x0000000010000700 <+36>: .long 0x1000180 +-# End of assembler dump. +-# +-# The last instruction in function foo is blr. Need to ignore the .long +-# entries following the blr instruction. +- +-gdb_test_multiple "disassemble foo" "" { +- -re "^disassemble foo\r\n" { +- exp_continue +- } +- +- -re "^Dump of assembler code for function foo:\r\n" { +- exp_continue +- } +- +- -re "^...($hex) \[<>+0-9:\s\t\]*\.long\[\s\t\]*\[^\r\n\]*\r\n" { +- exp_continue +- } +- +- -re "^...($hex) \[^\r\n\]+\r\n" { +- set last_addr_in_foo $expect_out(1,string) +- exp_continue +- } +- +- -wrap -re "^End of assembler dump\\." { +- gdb_assert { ![string equal $last_addr_in_foo ""] } \ +- "found some addresses in foo" +- pass $gdb_test_name +- } +-} +- + # Record the current stack-pointer, and the frame base address. + lassign [get_sp_and_fba "in foo"] foo_sp foo_fba + set foo_fid [get_fid] +@@ -158,11 +113,6 @@ for { set i_count 1 } { true } { incr i_count } { + # Move back to the inner most frame. + gdb_test "frame 0" ".*" + +- set pc [get_hexadecimal_valueof "\$pc" "*UNKNOWN*"] +- if { $pc == $last_addr_in_foo } { +- break +- } +- + if { $i_count > 100 } { + # We expect a handful of instructions, if we reach 100, + # something is going wrong. Avoid an infinite loop. +@@ -170,6 +120,16 @@ for { set i_count 1 } { true } { incr i_count } { + break + } + +- gdb_test "stepi" ".*" ++ set in_foo 0 ++ gdb_test_multiple "stepi" "" { ++ -re -wrap "$hex in foo \\(\\)" { ++ set in_foo 1 ++ } ++ -re -wrap "" {} ++ } ++ ++ if { ! $in_foo } { ++ break ++ } + } + } +-- +2.35.3 + 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..22b3547 --- /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-tui-allow-command-window-of-1-or-2-lines.patch b/gdb-tui-allow-command-window-of-1-or-2-lines.patch new file mode 100644 index 0000000..bcf7faa --- /dev/null +++ b/gdb-tui-allow-command-window-of-1-or-2-lines.patch @@ -0,0 +1,80 @@ +From 02616ce7c5571e5b2680cad52f8c58b27f77b2a5 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Thu, 9 Nov 2023 09:04:39 +0100 +Subject: [PATCH 4/6] [gdb/tui] Allow command window of 1 or 2 lines + +When starting TUI in a terminal with 2 lines (likewise with 1 line): +... +$ echo $LINES +2 +$ gdb -q -tui +... +we run into this assert in tui_apply_current_layout: +... + /* This should always be made visible by a layout. */ + gdb_assert (TUI_CMD_WIN != nullptr); +... + +The problem is that for the command window: +- the minimum height is 3 (the default), but +- the maximum height is only 2 because there are only 2 lines. + +This discrepancy eventually leads to a call to newwin in make_window with: +... +(gdb) p height +$1 = 3 +(gdb) p width +$2 = 66 +(gdb) p y +$3 = -1 +(gdb) p x +$4 = 0 +(gdb) +... +which results in a nullptr, which eventually triggers the assert. + +The easiest way to fix this is to change the minimum height of the command +window to 1. However, that would also change behaviour for the case that the +screen size is 3 lines or more. For instance, in gdb.tui/winheight.exp the +number of lines in the terminal is 24, and the test-case checks that the user +cannot increase the source window height to the point that the command window +height would be less than 3. + +Fix this by calculating the minimum height of the command window as follows: +- the default (3) if max_height () allows it, and +- max_height () otherwise. + +Tested on x86_64-linux. + +PR tui/31044 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31044 +--- + gdb/tui/tui-command.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/gdb/tui/tui-command.h b/gdb/tui/tui-command.h +index f6842880bb2..e8c96ecee30 100644 +--- a/gdb/tui/tui-command.h ++++ b/gdb/tui/tui-command.h +@@ -57,6 +57,18 @@ struct tui_cmd_window : public tui_win_info + /* The command window can't be made invisible. */ + } + ++ /* Compute the minimum height of this window. */ ++ virtual int min_height () const override ++ { ++ int preferred_min = tui_win_info::min_height (); ++ int max = max_height (); ++ /* If there is enough space to accommodate the preferred minimum height, ++ use it. Otherwise, use as much as possible. */ ++ return (preferred_min <= max ++ ? preferred_min ++ : max); ++ } ++ + int start_line = 0; + + protected: +-- +2.35.3 + diff --git a/gdb-tui-enable-work-around-libncurses-segfault.patch b/gdb-tui-enable-work-around-libncurses-segfault.patch new file mode 100644 index 0000000..4466fe2 --- /dev/null +++ b/gdb-tui-enable-work-around-libncurses-segfault.patch @@ -0,0 +1,47 @@ +diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c +index 828e42bccf7..551a72e3992 100644 +--- a/gdb/tui/tui.c ++++ b/gdb/tui/tui.c +@@ -57,7 +57,7 @@ + + /* Tells whether the TUI is active or not. */ + bool tui_active = false; +-static bool tui_finish_init = true; ++static int tui_init = -1; + + enum tui_key_mode tui_current_key_mode = TUI_COMMAND_MODE; + +@@ -363,7 +363,13 @@ tui_enable (void) + /* To avoid to initialize curses when gdb starts, there is a deferred + curses initialization. This initialization is made only once + and the first time the curses mode is entered. */ +- if (tui_finish_init) ++ if (tui_init == 0) ++ { ++ /* Initalization failed before, just throw a generic error, don't try ++ again. Workaround for segfault in libncurses5 bsc#1179210. */ ++ error (_("Cannot enable the TUI")); ++ } ++ else if (tui_init == -1) + { + WINDOW *w; + SCREEN *s; +@@ -383,6 +389,8 @@ tui_enable (void) + if (!gdb_stderr->isatty ()) + error (_("Cannot enable the TUI when output is not a terminal")); + ++ tui_init = 0; ++ + s = newterm (NULL, stdout, stdin); + #ifdef __MINGW32__ + /* The MinGW port of ncurses requires $TERM to be unset in order +@@ -435,7 +443,8 @@ tui_enable (void) + tui_set_win_focus_to (TUI_SRC_WIN); + keypad (TUI_CMD_WIN->handle.get (), TRUE); + wrefresh (TUI_CMD_WIN->handle.get ()); +- tui_finish_init = false; ++ ++ tui_init = 1; + } + else + { diff --git a/gdb-tui-fix-resizing-of-terminal-to-1-or-2-lines.patch b/gdb-tui-fix-resizing-of-terminal-to-1-or-2-lines.patch new file mode 100644 index 0000000..fbfcb8a --- /dev/null +++ b/gdb-tui-fix-resizing-of-terminal-to-1-or-2-lines.patch @@ -0,0 +1,147 @@ +From c55a452eaf9390d5659d3205f762aa2cb84511e1 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Thu, 9 Nov 2023 09:05:01 +0100 +Subject: [PATCH 6/6] [gdb/tui] Fix resizing of terminal to 1 or 2 lines + +When starting TUI in a terminal with 3 lines: +... +$ echo $LINES +3 +$ gdb -q -tui +... +and resizing the terminal to 2 lines we run into a segfault. + +The problem is that for the source window: +- the minimum height is 3 (the default), but +- the maximum height is only 2 because there are only 2 lines. + +This discrepancy eventually leads to a call to newwin in make_window with: +... +(gdb) p height +$1 = 3 +(gdb) p width +$2 = 56 +(gdb) p y +$3 = -1 +(gdb) p x +$4 = 0 +... +which results in a nullptr. + +This violates the assumption here in tui_apply_current_layout: +.... + /* Get the new list of currently visible windows. */ + std::vector new_tui_windows; + applied_layout->get_windows (&new_tui_windows); +... +that get_windows only returns visible windows, which leads to tui_windows +holding a dangling pointer, which results in the segfault. + +Fix this by: +- making sure get_windows only returns visible windows, and +- detecting the situation and dropping windows from the layout if + there's no room for them. + +Tested on x86_64-linux. + +PR tui/31044 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31044 +--- + gdb/testsuite/gdb.tui/resize.exp | 9 +++++++++ + gdb/tui/tui-layout.c | 22 ++++++++++++++++++++-- + gdb/tui/tui-layout.h | 6 +++++- + 3 files changed, 34 insertions(+), 3 deletions(-) + +diff --git a/gdb/testsuite/gdb.tui/resize.exp b/gdb/testsuite/gdb.tui/resize.exp +index 60d5116886b..e15f8a2f507 100644 +--- a/gdb/testsuite/gdb.tui/resize.exp ++++ b/gdb/testsuite/gdb.tui/resize.exp +@@ -39,3 +39,12 @@ Term::check_contents "source at startup" "\\|.*21 *return 0" + + Term::resize 40 90 + Term::check_box "source box after resize" 0 0 90 26 ++ ++# Check that resizing to less than 3 lines doesn't cause problems. ++foreach lines { 2 1 } { ++ with_test_prefix lines=$lines { ++ Term::resize $lines 90 0 ++ Term::wait_for "" ++ Term::check_region_contents "has prompt" 0 0 90 $lines "$gdb_prompt" ++ } ++} +diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c +index 27abee02087..362c1447910 100644 +--- a/gdb/tui/tui-layout.c ++++ b/gdb/tui/tui-layout.c +@@ -442,6 +442,13 @@ tui_layout_window::apply (int x_, int y_, int width_, int height_, + width = width_; + height = height_; + gdb_assert (m_window != nullptr); ++ if (width == 0 || height == 0) ++ { ++ /* The window was dropped, so it's going to be deleted, reset the ++ soon to be dangling pointer. */ ++ m_window = nullptr; ++ return; ++ } + m_window->resize (height, width, x, y); + } + +@@ -823,6 +830,7 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_, + int available_size = m_vertical ? height : width; + int last_index = -1; + int total_weight = 0; ++ int prev = -1; + for (int i = 0; i < m_splits.size (); ++i) + { + bool cmd_win_already_exists = TUI_CMD_WIN != nullptr; +@@ -854,6 +862,14 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_, + info[i].max_size = info[i].min_size; + } + ++ if (info[i].min_size > info[i].max_size) ++ { ++ /* There is not enough room for this window, drop it. */ ++ info[i].min_size = 0; ++ info[i].max_size = 0; ++ continue; ++ } ++ + if (info[i].min_size == info[i].max_size) + available_size -= info[i].min_size; + else +@@ -864,10 +880,12 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_, + + /* Two adjacent boxed windows will share a border, making a bit + more size available. */ +- if (i > 0 +- && m_splits[i - 1].layout->last_edge_has_border_p () ++ if (prev != -1 ++ && m_splits[prev].layout->last_edge_has_border_p () + && m_splits[i].layout->first_edge_has_border_p ()) + info[i].share_box = true; ++ ++ prev = i; + } + + /* If last_index is set then we have a window that is not of a fixed +diff --git a/gdb/tui/tui-layout.h b/gdb/tui/tui-layout.h +index 206f1117445..ec013a3f051 100644 +--- a/gdb/tui/tui-layout.h ++++ b/gdb/tui/tui-layout.h +@@ -185,7 +185,11 @@ class tui_layout_window : public tui_layout_base + /* See tui_layout_base::get_windows. */ + void get_windows (std::vector *windows) override + { +- windows->push_back (m_window); ++ if (m_window != nullptr && m_window->is_visible ()) ++ { ++ /* Only get visible windows. */ ++ windows->push_back (m_window); ++ } + } + + protected: +-- +2.35.3 + diff --git a/gdb-tui-fix-segfault-in-tui_find_disassembly_address.patch b/gdb-tui-fix-segfault-in-tui_find_disassembly_address.patch new file mode 100644 index 0000000..48d1404 --- /dev/null +++ b/gdb-tui-fix-segfault-in-tui_find_disassembly_address.patch @@ -0,0 +1,148 @@ +From 0f8f51e98c7f643b8ce32bc6f6d621ce902d7a66 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Thu, 28 Sep 2023 20:17:33 +0200 +Subject: [PATCH 2/6] [gdb/tui] Fix segfault in tui_find_disassembly_address + +PR29040 describes a FAIL for test-case gdb.threads/next-fork-other-thread.exp +and target board unix/-m32. + +The FAIL happens due to the test executable running into an assert, which is +caused by a forked child segfaulting, like so: +... + Program terminated with signal SIGSEGV, Segmentation fault. + #0 0x00000000 in ?? () +... + +I tried to reproduce the segfault with exec next-fork-other-thread-fork, using +TUI layout asm. + +I set a breakpoint at fork and ran to the breakpoint, and somewhere during the +following session I ran into a gdb segfault here in +tui_find_disassembly_address: +... + /* Disassemble forward. */ + next_addr = tui_disassemble (gdbarch, asm_lines, new_low, max_lines); + last_addr = asm_lines.back ().addr; +... +due to asm_lines being empty after the call to tui_disassemble, while +asm_lines.back () assumes that it's not empty. + +I have not been able to reproduce that segfault in that original setting, I'm +not sure of the exact scenario (though looking back it probably involved +"set detach-on-fork off"). + +What likely happened is that I managed to reproduce PR29040, and TUI (attempted +to) display the disassembly for address 0, which led to the gdb segfault. + +When gdb_print_insn encounters an insn it cannot print because it can't read +the memory, it throws a MEMORY_ERROR that is caught by tui_disassemble. + +The specific bit that causes the gdb segfault is that if gdb_print_insn throws +a MEMORY_ERROR for the first insn in tui_disassemble, it returns an empty +asm_lines. + +FWIW, I did manage to reproduce the gdb segfault as follows: +... +$ gdb -q \ + -iex "set pagination off" \ + /usr/bin/rustc \ + -ex "set breakpoint pending on" \ + -ex "b dl_main" \ + -ex run \ + -ex "up 4" \ + -ex "layout asm" \ + -ex "print \$pc" + ... + + ... +$1 = (void (*)()) 0x1 +(gdb) +... +Now press , and the segfault triggers. + +Fix the segfault by handling asm_lines.empty () results of tui_disassemble in +tui_find_disassembly_address. + +I've written a unit test that exercises this scenario. + +Tested on x86_64-linux. + +Reviewed-by: Kevin Buettner + +PR tui/30823 +Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30823 +--- + gdb/tui/tui-disasm.c | 39 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 39 insertions(+) + +diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c +index f0b55769d71..03c78aa1291 100644 +--- a/gdb/tui/tui-disasm.c ++++ b/gdb/tui/tui-disasm.c +@@ -41,6 +41,8 @@ + #include "objfiles.h" + #include "cli/cli-style.h" + #include "tui/tui-location.h" ++#include "gdbsupport/selftest.h" ++#include "inferior.h" + + #include "gdb_curses.h" + +@@ -203,6 +205,8 @@ tui_find_disassembly_address (struct gdbarch *gdbarch, CORE_ADDR pc, int from) + instruction fails to disassemble we will take the address of the + previous instruction that did disassemble as the result. */ + tui_disassemble (gdbarch, asm_lines, pc, max_lines + 1); ++ if (asm_lines.empty ()) ++ return pc; + new_low = asm_lines.back ().addr; + } + else +@@ -244,6 +248,8 @@ tui_find_disassembly_address (struct gdbarch *gdbarch, CORE_ADDR pc, int from) + + /* Disassemble forward. */ + next_addr = tui_disassemble (gdbarch, asm_lines, new_low, max_lines); ++ if (asm_lines.empty ()) ++ break; + last_addr = asm_lines.back ().addr; + + /* If disassembling from the current value of NEW_LOW reached PC +@@ -522,3 +528,36 @@ tui_disasm_window::display_start_addr (struct gdbarch **gdbarch_p, + *gdbarch_p = m_gdbarch; + *addr_p = m_start_line_or_addr.u.addr; + } ++ ++#if GDB_SELF_TEST ++namespace selftests { ++namespace tui { ++namespace disasm { ++ ++static void ++run_tests () ++{ ++ if (current_inferior () != nullptr) ++ { ++ struct gdbarch *gdbarch = current_inferior ()->gdbarch; ++ ++ /* Check that tui_find_disassembly_address robustly handles the case of ++ being passed a PC for which gdb_print_insn throws a MEMORY_ERROR. */ ++ SELF_CHECK (tui_find_disassembly_address (gdbarch, 0, 1) == 0); ++ SELF_CHECK (tui_find_disassembly_address (gdbarch, 0, -1) == 0); ++ } ++} ++ ++} /* namespace disasm */ ++} /* namespace tui */ ++} /* namespace selftests */ ++#endif /* GDB_SELF_TEST */ ++ ++void _initialize_tui_disasm (); ++void ++_initialize_tui_disasm () ++{ ++#if GDB_SELF_TEST ++ selftests::register_test ("tui-disasm", selftests::tui::disasm::run_tests); ++#endif ++} +-- +2.35.3 + diff --git a/gdb-tui-fix-wmaybe-uninitialized-in-tui_find_disasse.patch b/gdb-tui-fix-wmaybe-uninitialized-in-tui_find_disasse.patch new file mode 100644 index 0000000..49f22e7 --- /dev/null +++ b/gdb-tui-fix-wmaybe-uninitialized-in-tui_find_disasse.patch @@ -0,0 +1,57 @@ +From 0f2bdd8648e47e10334f8cc8e47b277d4064d0a2 Mon Sep 17 00:00:00 2001 +From: Tom de Vries +Date: Mon, 13 Nov 2023 09:31:20 +0100 +Subject: [PATCH 3/6] [gdb/tui] Fix Wmaybe-uninitialized in + tui_find_disassembly_address +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When building gdb with -O2, we run into: +... +gdb/tui/tui-disasm.c: In function ‘CORE_ADDR tui_find_disassembly_address \ + (gdbarch*, CORE_ADDR, int)’: +gdb/tui/tui-disasm.c:293:7: warning: ‘last_addr’ may be used uninitialized \ + in this function [-Wmaybe-uninitialized] + if (last_addr < pc) + ^~ +... + +The warning triggers since commit 72535eb14bd ("[gdb/tui] Fix segfault in +tui_find_disassembly_address"). + +Fix the warning by ensuring that last_addr is initialized at the point of +use: +... ++ last_addr = asm_lines.back ().addr; + if (last_addr < pc) +... + +Tested on x86_64-linux. +--- + gdb/tui/tui-disasm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c +index 03c78aa1291..bbbc92c8183 100644 +--- a/gdb/tui/tui-disasm.c ++++ b/gdb/tui/tui-disasm.c +@@ -281,7 +281,6 @@ tui_find_disassembly_address (struct gdbarch *gdbarch, CORE_ADDR pc, int from) + /* Take the best possible match we have. */ + new_low = *possible_new_low; + next_addr = tui_disassemble (gdbarch, asm_lines, new_low, max_lines); +- last_addr = asm_lines.back ().addr; + gdb_assert (asm_lines.size () >= max_lines); + } + +@@ -290,6 +289,7 @@ tui_find_disassembly_address (struct gdbarch *gdbarch, CORE_ADDR pc, int from) + We keep the disassembled instructions in the 'lines' window + and shift it downward (increasing its addresses). */ + int pos = max_lines - 1; ++ last_addr = asm_lines.back ().addr; + if (last_addr < pc) + do + { +-- +2.35.3 + diff --git a/gdb.changes b/gdb.changes new file mode 100644 index 0000000..3556091 --- /dev/null +++ b/gdb.changes @@ -0,0 +1,5435 @@ +------------------------------------------------------------------- +Wed Dec 13 14:58:14 UTC 2023 - Tom de Vries + +- Patches added (backport from gdb-patches, swo#30728): + * gdb-symtab-refactor-condition-in-scan_attributes.patch + * gdb-symtab-factor-out-m_die_range_map-usage.patch + * gdb-symtab-handle-nullptr-parent-in-parent_map-set_p.patch + * gdb-symtab-factor-out-m_deferred_entries-usage.patch + * gdb-symtab-resolve-deferred-entries-inter-shard-case.patch + * gdb-symtab-keep-track-of-processed-dies-in-shard.patch + * gdb-symtab-resolve-deferred-entries-intra-shard-case.patch + * gdb-symtab-don-t-defer-backward-refs-inter-cu-intra-.patch + * gdb-symtab-recurse-into-c-dw_tag_subprogram-dies-for.patch + * gdb-symtab-keep-track-of-all-parents-for-cooked-inde.patch + * gdb-symtab-fix-dw_tag_inlined_subroutine-entries-in-.patch + +------------------------------------------------------------------- +Mon Nov 13 14:08:08 UTC 2023 - Tom de Vries + +- Maintenance script qa.sh: + * Update PR31004 kfail. +- Patches added (backport from gdb-patches): + * gdb-fix-segfault-in-for_each_block-part-1.patch + +------------------------------------------------------------------- +Tue Oct 31 11:59:43 UTC 2023 - Tom de Vries + +- Maintenance script qa.sh: + * Update PR28561 kfail. + * Remove PR31015 kfail. + * Remove PR30547 kfail. +- Patches added (backport from master): + * gdb-symtab-add-producer_is_gas.patch + * gdb-symtab-work-around-gas-pr28629.patch + * gdb-tdep-fix-nr-array-elements-in-ppc64_aggregate_ca.patch + * gdb-testsuite-fix-gdb.python-py-breakpoint.exp-with-.patch + * gdb-tui-fix-segfault-in-tui_find_disassembly_address.patch + * gdb-tui-fix-wmaybe-uninitialized-in-tui_find_disasse.patch + * gdb-testsuite-add-wait_for_msg-arg-to-term-resize-fi.patch +- Patches added (backport from gdb-patches): + * gdb-fix-segfault-in-for_each_block-part-2.patch + * gdb-tui-allow-command-window-of-1-or-2-lines.patch + * gdb-tui-fix-resizing-of-terminal-to-1-or-2-lines.patch + +------------------------------------------------------------------- +Tue Oct 31 09:02:42 UTC 2023 - Tom de Vries + +- Maintenance script qa.sh: + * Remove PR28467, PR29418, PR29420, PR29814 and PR29408 kfail. + * Remove gdb.tui/tui-layout-asm-short-prog.exp kfail. + * Remove commit f68eca29d3b, 29004660c94, 301fe55e9c4, + 4d88ae0c7b5, e7d69e72bfd, 8b272d7671f, 85819864f7c, 167f3beb655 + and a0eda3df5b7 kfails. + * Add PR31015 kfail. + * Remove PR29793 kfail. + * Remove gdb.arch/powerpc-bcl-prologue.exp kfail. + * Remove PR29813 and PR29816 kfail. + +------------------------------------------------------------------- +Sun Oct 29 18:57:21 UTC 2023 - Tom de Vries + +- Maintenance script qa.sh: + * Update PR28561 kfail. + * Update PR29781 kfail. +- Maintenance script qa-local.sh: + * Add "Verify quilt setup" step. +- Patches added (backport from master): + * gdb-symtab-handle-self-reference-die.patch + * gdb-symtab-handle-self-reference-in-inherit_abstract.patch + * gdb-symtab-add-optimized-out-static-var-to-cooked-in.patch + +------------------------------------------------------------------- +Thu Oct 26 12:51:55 UTC 2023 - Tom de Vries + +- Maintenance script qa.sh: + * Add comment to kfail for PR30528. + * Add UNRESOLVED kfail for gdb.base/gcore-excessive-memory.exp. + * Add UNRESOLVED kfail for PR31001. + * Remove PR27238 kfail. + * Add powerpc64le hw watchpoint kfails. + * Add PR31004 kfail. + * Add PR30531 kfail. +- Patches added (backport from master): + * xcoffread.c-fix-werror-dangling-pointer-issue-with-m.patch + * avoid-manual-memory-management-in-go-lang.c.patch + * gdb-go-handle-v3-go_0-mangled-prefix.patch + +------------------------------------------------------------------- +Thu Oct 26 09:24:04 UTC 2023 - Tom de Vries + +- Patches added (backport from master): + * gdb-symtab-don-t-deduplicate-variables-in-gdb-index.patch +- Patches dropped (requires unsupported command): + * gdb-testsuite-add-wait-for-index-cache-in-gdb.dwarf2.patch +- Maintenance script qa.sh: + * Added PR30528 kfail. + +------------------------------------------------------------------- +Tue Oct 24 13:39:35 UTC 2023 - Tom de Vries + +- Patches added (manual import from fedora rawhide @ 52a4dab): + * gdb-rhbz1773651-gdb-index-internal-error.patch +- Patches added (backport from master): + * gdb-support-rseq-auxvs.patch + * gdb-symtab-fix-line-number-of-static-const-class-mem.patch + * gdb-symtab-fix-too-many-symbols-in-gdbpy_lookup_stat.patch + * gdb-symtab-handle-pu-in-iterate_over_some_symtabs.patch + * gdb-symtab-work-around-pr-gas-29517.patch + * gdb-testsuite-add-kfail-for-pr-ada-30908.patch + * gdb-testsuite-add-xfail-for-gdb-29965-in-gdb.threads.patch + * gdb-testsuite-fix-gdb.ada-mi_task_arg.exp-with-newer.patch + * gdb-testsuite-fix-gdb.arch-i386-signal.exp-on-x86_64.patch + * gdb-testsuite-fix-gdb.cp-m-static.exp-regression-on-.patch + * gdb-testsuite-fix-gdb.dwarf2-nullptr_t.exp-with-cc-w.patch + * gdb-testsuite-fix-regexps-in-gdb.base-step-over-sysc.patch + * gdb-symtab-find-main-language-without-symtab-expansi.patch + * gdb-testsuite-add-wait-for-index-cache-in-gdb.dwarf2.patch +- Patches moved (from "Backport from gdb-patches" to + "Backports from master, available in next release"): + * gdb-cli-handle-pending-c-after-rl_callback_read_char.patch + * gdb-testsuite-add-have_host_locale.patch +- Maintenance script qa.sh: + * Remove PR28463, PR28108, PR29247 and PR29160 kfails. + * Remove PR30540, PR30908, PR29965 kfails. + * Remove gdb.ada/mi_task_arg.exp kfail. +- Limit "Suggests: %{python}-Pygments" to SLE-15 and later. + +------------------------------------------------------------------- +Sat Oct 21 08:05:18 UTC 2023 - Tom de Vries + +- Mention import-fedora.sh to fix warning. +- Maintenance script qa.sh: + * Update kfail for PR28561. + +------------------------------------------------------------------- +Fri Oct 20 10:43:32 UTC 2023 - Tom de Vries + +- Maintenance script import-fedora.sh: + * New script. Move skipped patches list from gdb.spec to script. +- Update to fedora 38 @ 82cc8e0. +- Patch renamed: + * pass-const-frame_info_ptr-reference-for-skip_-langua.patch -> + gdb-rhbz2192105-ftbs-dangling-pointer +- Patches added: + * gdb-bz2237392-dwarf-obstack-allocation.patch + * gdb-bz2237515-debuginfod-double-free.patch + * gdb-rhbz2160211-excessive-core-file-warnings.patch + * gdb-rhbz2196395-debuginfod-legacy-openssl-crash.patch + * gdb-rhbz2233961-CVE-2022-4806.patch + * gdb-rhbz2233965-memory-leak.patch +- Maintenance script qa-local.sh: + * Add openSUSE_Leap_15.5 and openSUSE_Factory_LegacyX86. + * Add "List configs" item. + * Skip i586 for SLE-11. +- Maintenance script qa.sh: + * Make sure exit status is 0 + +------------------------------------------------------------------- +Wed Sep 27 09:22:47 UTC 2023 - Tom de Vries + +- Add "Suggests: %{python}-Pygments". +- Maintenance script qa.sh: + * Note investigation of some ada test-cases. + * Update PR30547 kfail. + * Add PR28561 kfail. + * Update PKRU-related kfail. + * Use openSUSE_Factory_LegacyX86.i586 instead of + openSUSE_Factory.i586. + * Remove PR27813 kfail and corresponding todo. + +------------------------------------------------------------------- +Sun Aug 20 00:41:09 UTC 2023 - Luciano Santos + +- Drop libdebuginfod1 BuildRequires/Recommends. The former isn't + needed because there's a build requirement on libdebuginfod-devel + already, which will pull the shared library. And the latter, + because it's bogus since RPM auto generated dependency will take + care of that requirement. + +------------------------------------------------------------------- +Wed Jun 14 06:23:42 UTC 2023 - Tom de Vries + +- Patches added (master backports): + * pass-const-frame_info_ptr-reference-for-skip_-langua.patch +- Maintenance script qa.sh: + * Add PR30543 kfail. + * Remove PR29793 kfail. + +------------------------------------------------------------------- +Mon Jun 12 08:36:48 UTC 2023 - Tom de Vries + +- Patches added (master backports): + * fix-pr30369-regression-on-aarch64-arm-pr30506.patch + * gdb-tdep-aarch64-fix-frame-address-of-last-insn.patch + * gdb-testsuite-fix-breakpoint-regexp-in-gdb.ada-out_o.patch + * gdb-testsuite-relax-breakpoint-count-check-in-gdb.py.patch + * gdb-testsuite-fix-buffer-overflow-in-gdb.base-signed.patch + * gdb-testsuite-require-syscall-time-in-gdb.reverse-ti.patch + * gdb-testsuite-handle-missing-gdc-in-gdb.dlang-dlang-.patch + * gdb-testsuite-add-basic-lmap-for-tcl-8.6.patch + * gdb-testsuite-fix-gdb.rust-watch.exp-on-ppc64le.patch + * gdb-testsuite-fix-gdb.python-py-breakpoint.exp-timeo.patch + * powerpc-fix-for-gdb.reverse-finish-precsave.exp-and-.patch + * powerpc-regression-fix-for-reverse-finish-command.patch + * gdb-testsuite-don-t-use-string-cat-in-gdb.dwarf2-dw2.patch + * move-step_until-procedure.patch +- Patches added (gdb-patches backport): + * gdb-testsuite-add-have_host_locale.patch +- Patches added (fedora patch fixups): + * fixup-gdb-6.3-gstack-20050411.patch + * fixup-gdb-6.3-attach-see-vdso-test.patch + * fixup-gdb-lineno-makeup-test.patch + * fixup-gdb-rhbz1261564-aarch64-hw-watchpoint-test.pat.patch +- Patches dropped: + * gdb-ppc-power7-test.patch + * gdb-rhbz1156192-recursive-dlopen-test.patch + * gdb-6.3-bz140532-ppc-unwinding-test.patch +- Maintenance script qa.sh: + * Add PR30540, PR30537, PR30021 and PR30542 KFAILs. + * Add gdb.base/gcore-excessive-memory.exp internal error. + * Update gdb.base/inline-frame-cycle-unwind.exp KFAIL comment. + +------------------------------------------------------------------- +Fri Jun 9 06:26:02 UTC 2023 - Tom de Vries + +- Patches added (master backports): + * aarch64-avoid-initializers-for-vlas.patch + +------------------------------------------------------------------- +Tue Jun 6 06:00:11 UTC 2023 - Tom de Vries + +- Rebase to 13.2 release (fedora 38 @ fc4e284) + * Replace gdb-12.1.tar.bz2 with gdb-13.2.tar.bz2. +- Patches dropped: + * add-elfcompress_zstd.patch + * binutils-gdb-support-zstd-compressed-debug-section.patch + * fix-comparison-of-unsigned-long-int-to-int-in-record_linux_system_call.patch + * fix-core-file-detach-crash-corefiles-29275.patch + * fix-for-gdb.base-solib-search.exp-test.patch + * fix-gdb-build-elf-support-check-lzstd.patch + * fixup-gdb-rhbz1325795-framefilters-test.patch + * gdb-6.3-focus-cmd-prev-test.patch + * gdb-6.3-inheritancetest-20050726.patch + * gdb-6.3-test-dtorfix-20050121.patch + * gdb-6.3-test-movedir-20050125.patch + * gdb-6.3-threaded-watchpoints2-20050225.patch + * gdb-6.6-buildid-locate-rpm-scl.patch + * gdb-6.6-bz230000-power6-disassembly-test.patch + * gdb-add-gdb-syscalls-makefile.patch + * gdb-add-support-for-readline-8.2.patch + * gdb-bz601887-dwarf4-rh-test.patch + * gdb-disable-commit-resumed-in-target_kill.patch + * gdb-fix-assert-in-handle_jit_event.patch + * gdb-fix-assert-when-quitting-gdb-while-a-thread-is-stepping.patch + * gdb-fix-for-gdb.base-eof-exit.exp-test-failures.patch + * gdb-fix-selftest-fails-with-gdb-build-with-O2-flto.patch + * gdb-fortran-frame-string.patch + * gdb-handle-pending-c-after-rl_callback_read_char.patch + * gdb-improved-eof-handling-when-using-readline-7.patch + * gdb-physname-pr11734-test.patch + * gdb-physname-pr12273-test.patch + * gdb-record-handle-statx-system-call.patch + * gdb-rhbz1325795-framefilters-test.patch + * gdb-rhbz1398387-tab-crash-test.patch + * gdb-runtest-pie-override.patch + * gdb-symtab-fix-handling-of-dw_tag_unspecified_type.patch + * gdb-tdep-fix-powerpc-ieee-128-bit-format-arg-passing.patch + * gdb-tdep-handle-pipe2-syscall-for-amd64.patch + * gdb-tdep-support-catch-syscall-pipe2-for-i386.patch + * gdb-tdep-update-syscalls-ppc64-ppc-linux.xml.patch + * gdb-test-expr-cumulative-archer.patch + * gdb-testsuite-add-kfail-in-gdb.threads-fork-plus-threads.exp.patch + * gdb-testsuite-add-new-gdb_attach-to-check-attach-command.patch + * gdb-testsuite-address-test-failures-in-gdb.mi-mi-multi-commands.exp.patch + * gdb-testsuite-detect-change-instead-of-init-in-gdb.mi-mi-var-block.exp.patch + * gdb-testsuite-enable-some-test-cases-for-x86_64-m32.patch + * gdb-testsuite-fix-fail-in-gdb.threads-fork-and-threads.exp.patch + * gdb-testsuite-fix-gdb.ada-literals.exp-with-aarch64.patch + * gdb-testsuite-fix-gdb.base-break-idempotent.exp-on-ppc.patch + * gdb-testsuite-fix-gdb.base-catch-syscall.exp-with-with-expat-no.patch + * gdb-testsuite-fix-gdb.base-catch-syscall.exp-without-enable-targets.patch + * gdb-testsuite-fix-gdb.base-infoline-reloc-main-from-.patch + * gdb-testsuite-fix-gdb.base-nested-subp-2-3-.exp-with.patch + * gdb-testsuite-fix-gdb.dwarf2-dw2-dir-file-name.exp-w.patch + * gdb-testsuite-fix-gdb.dwarf2-dw2-out-of-range-end-of-seq.exp-on-aarch64.patch + * gdb-testsuite-fix-gdb.dwarf2-dw2-unspecified-type-foo.c-with-m32.patch + * gdb-testsuite-fix-gdb.mi-mi-sym-info.exp-on-opensuse-tumbleweed.patch + * gdb-testsuite-fix-gdb.opt-clobbered-registers-o2.exp-with-gcc-12.patch + * gdb-testsuite-fix-gdb.reverse-i387-env-reverse.exp-for-pie.patch + * gdb-testsuite-fix-gdb.reverse-test_ioctl_tcsetsw.exp-with-libc-debuginfo.patch + * gdb-testsuite-fix-gdb.threads-killed-outside.exp-on-aarch64.patch + * gdb-testsuite-fix-have_mpx-test.patch + * gdb-testsuite-fix-occasional-failure-in-gdb.mi-mi-multi-commands.exp.patch + * gdb-testsuite-fix-test-failure-when-building-against-readline-v7.patch + * gdb-testsuite-handle-init-errors-in-gdb.mi-user-selected-context-sync.exp.patch + * gdb-testsuite-handle-missing-.note.gnu-stack.patch + * gdb-testsuite-handle-older-python-in-gdb.python-py-send-packet.py.patch + * gdb-testsuite-handle-pipe2-syscall-in-gdb.base-catch-syscall.exp.patch + * gdb-testsuite-handle-quotes-in-gdb_py_module_available.patch + * gdb-testsuite-handle-unordered-dict-in-gdb.python-py-mi-cmd.exp.patch + * gdb-testsuite-refactor-gdb.threads-detach-step-over.exp.patch + * gdb-testsuite-remove-attach-test-from-can_spawn_for_attach.patch + * gdb-testsuite-remove-global-declarations-in-gdb.threads-detach-step-over.exp.patch + * gdb-testsuite-remove-target-limits-in-gdb.base-catch-syscall.exp.patch + * gdb-testsuite-skip-gdb.fortran-namelist.exp-for-gfortran-4.8.patch + * gdb-testsuite-support-recording-of-getrandom.patch + * gdb-testsuite-workaround-unnecessary-.s-file-with-gfortran-4.8.patch + * gdb-update-syscalls-amd64-i386-linux.xml.patch + * gdbserver-switch-to-right-process-in-find_one_thread.patch + * make-gdb.ada-float-bits.exp-more-generic.patch + * powerpc-add-support-for-ieee-128-bit-format.patch + * powerpc-correct-the-gdb-ioctl-values-for-tcgets-tcsets-tcsetsw-and-tcsetsf.patch + * powerpc-fix-for-gdb.base-eh_return.exp.patch + * powerpc-fix-gdb.base-watchpoint.exp-on-power-9.patch + * powerpc-update-expected-floating-point-output-for-gdb.arch-altivec-regs.exp-and-gdb.arch-vsx-regs.exp.patch +- Patches added: + * fixup-gdb-bz634108-solib_address.patch + * gdb-binutils29988-read_indexed_address.patch + * gdb-cli-handle-pending-c-after-rl_callback_read_char.patch + * gdb-rhbz2177655-aarch64-pauth-valid-regcache.patch + * gdb-rhbz2183595-rustc-inside_main.patch + * gdb-testsuite-fix-gdb.gdb-python-helper.exp-with-o2-.patch + * gdb-testsuite-handle-output-after-prompt-in-gdb.thre.patch + * gdb-testsuite-simplify-gdb.base-unwind-on-each-insn..patch + * remove-some-unnecessary-includes-from-exp.y.patch + * gdb-testsuite-fix-gdb.rust-main-crash.exp.patch +- Patches modified: + * gdb-6.3-bz140532-ppc-unwinding-test.patch + * gdb-6.3-gstack-20050411.patch + * gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch + * gdb-6.6-buildid-locate-rpm-suse.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.7-testsuite-stable-results.patch + * gdb-ccache-workaround.patch + * gdb-core-open-vdso-warning.patch + * gdb-fedora-libncursesw.patch + * gdb-gcore-bash.patch + * gdb-linux_perf-bundle.patch + * gdb-testsuite-ada-pie.patch + * gdb-testsuite-add-xfail-in-gdb.arch-i386-pkru.exp.patch + * gdb-testsuite-factor-out-proc-linux_kernel_version.patch + * gdb-testsuite-prevent-compilation-fails-with-unix-fpie-pie.patch +- Maintenance script qa.sh: + * Add -i586 and -x86_64. + * Add KFAILs for PR29040, PR30521, PR30180, PR30518, PR30519. + * Update some KFAIL patterns. + * Add some factory KFAILs. + * Add gdb.base/longjmp-until-in-main.exp in PR26967 KFAILs. +- Maintenance script qa-local.sh: + * Factor out version variable, update to 13.2. + * Try to give reason for build failure. + * Use -$arch as argument to qa.sh. + +------------------------------------------------------------------- + +Mon May 22 21:01:44 UTC 2023 - Dirk Müller + +- disable werror as a workaround for deprecation warnings with + python 3.11 (bsc#1211052) + +------------------------------------------------------------------- + +Fri Apr 7 07:48:58 UTC 2023 - Tom de Vries + +- Revert to singlespec multibuild. + +------------------------------------------------------------------- +Tue Apr 4 13:27:03 UTC 2023 - Tom de Vries + +- Add multispec _multibuild. + +------------------------------------------------------------------- +Tue Apr 4 11:29:35 UTC 2023 - Tom de Vries + +- Don't use multibuild. + +------------------------------------------------------------------- +Tue Apr 4 08:47:10 UTC 2023 - Tom de Vries + +- Fix license, again (bsc#1210081). + +------------------------------------------------------------------- +Fri Mar 3 12:41:21 UTC 2023 - Tom de Vries + +- Maintenance script qa.sh: + * Expand kfail pattern for PR29897. + * Add PR29965 kfail. + +------------------------------------------------------------------- +Thu Mar 2 08:28:32 UTC 2023 - Tom de Vries + +- Re-enable testing all test-cases, undoing accidental change in + previous commit. +- Add --with=for_chroot. + +------------------------------------------------------------------- +Thu Feb 16 10:57:10 UTC 2023 - Tom de Vries + +- Patches dropped (bsc#1207712): + * gdb-container-rh-pkg.patch +- Patches added (bsc#1207712): + * gdb-testsuite-add-gdb.suse-debranding.exp.patch +- Patches added (test-case fix): + * gdb-testsuite-fix-gdb.dwarf2-dw2-dir-file-name.exp-w.patch +- Patches added (fedora patch fixup): + * fixup-gdb-test-dw2-aranges.patch +- Patches added (master backports): + * gdb-testsuite-add-xfail-in-gdb.arch-i386-pkru.exp.patch + * gdb-testsuite-add-xfail-in-gdb.python-py-record-btra.patch + * gdb-testsuite-factor-out-proc-linux_kernel_version.patch + * gdb-testsuite-fix-gdb.base-infoline-reloc-main-from-.patch + * gdb-testsuite-fix-gdb.base-nested-subp-2-3-.exp-with.patch + * gdb-testsuite-fix-gdb.threads-schedlock.exp-on-fast-.patch + * gdb-testsuite-handle-missing-.note.gnu-stack.patch + * gdb-testsuite-simplify-gdb.arch-amd64-disp-step-avx..patch + * gdb-testsuite-fix-gdb.threads-schedlock.exp-for-gcc-.patch + * gdb-testsuite-add-xfail-case-in-gdb.python-py-record.patch + * add-elfcompress_zstd.patch + * binutils-gdb-support-zstd-compressed-debug-section.patch + * fix-gdb-build-elf-support-check-lzstd.patch +- Patches removed (dropped by fedora): + * gdb-test-ivy-bridge.patch +- Disable "BuildRequires: %{gcc}-fortran" for SLE-11. +- Maintenance script qa-local.sh: + * Add SLE-11 to configs. + * Build with --no-verify. +- Maintenance script qa.sh: + * Add -sle11. + +------------------------------------------------------------------- +Tue Dec 13 10:39:19 UTC 2022 - Tom de Vries + +- Maintenance script qa.sh: + * Re-enable PR26284 kfails. + * Remove mention of PR28275. + * Add PR29897 kfail. +- Mention CVE-2018-7208 and CVE-2017-16829. + +------------------------------------------------------------------- +Tue Dec 13 09:52:56 UTC 2022 - Tom de Vries + +- Mention SLE-21561, bnc#1081527, and bnc#1068950. + +------------------------------------------------------------------- +Thu Dec 1 15:20:21 UTC 2022 - Tom de Vries + +- Patches added (gdb 12 release branch backports): + * gdb-disable-commit-resumed-in-target_kill.patch + * gdb-fix-assert-when-quitting-gdb-while-a-thread-is-stepping.patch + * gdb-testsuite-add-new-gdb_attach-to-check-attach-command.patch + * gdb-testsuite-refactor-gdb.threads-detach-step-over.exp.patch + * gdb-testsuite-remove-global-declarations-in-gdb.threads-detach-step-over.exp.patch + * gdbserver-switch-to-right-process-in-find_one_thread.patch +- Patches removed: + * gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch +- Maintenance script qa.sh: + * Disable PR26284 kfails. + * Add PR29841 kfails. + * Add kfail_powerpc64le_sle12, kfail_s390 and kfail_s390x. + * Add -s390 and -s390x. + * Add gdb.base/gdb-rhbz1156192-recursive-dlopen.exp kfail. + * Add PR26967 kfails. + * Move PR27027 kfails from kfail_factory to kfail. + * Add -ppc64le alias for -powerpc64le. + * Add gdb.threads/interrupt-while-step-over.exp kfail. + * Add gdb.tui/tui-layout-asm-short-prog.exp kfail. + * Add unix/-fPIE/-fpie overrides -static kfails. + * Add gdb.guile/scm-disasm.exp kfail. + * Add gdb.base/gnu_vector.exp to existing kfail. + * Add gdb.guile/scm-symtab.exp kfail. + * Add gdb.base/write_mem.exp kfail. + +------------------------------------------------------------------- +Tue Nov 22 15:03:04 UTC 2022 - Tom de Vries + +- Maintenance script qa.sh: + - Add openSUSE Leap 15.4 ppc64le to known clean configs. + +------------------------------------------------------------------- +Wed Nov 16 13:49:01 UTC 2022 - Tom de Vries + +- Maintenance script qa.sh: + - Update PR26363 internal error pattern. + - Add PR29790 kfail. + - Add -powerpc64le option. + - Generalize PR26915 kfail patterns. + - Move PR28478 patterns from kfail_factory to kfail. + - Add PR29781 and PR27813 kfails. + - Add SLE-15 ppc64le to known clean configs. + +------------------------------------------------------------------- +Tue Nov 15 08:14:11 UTC 2022 - Tom de Vries + +- Maintenance script qa-remote.sh: + * Use qa.sh alongside qa-remote.sh. +- Maintenance script qa.sh: + * Add PR29783 internal error. +- Patch removed (intended effect not observed): + * gdb-fix-watchpoints-triggered.patch + +------------------------------------------------------------------- +Fri Nov 11 12:06:44 UTC 2022 - Tom de Vries + +- Maintenance script qa.sh: + * Handle librpm == "" and nolibrpm == "". +- Maintenance script qa-remote.sh: + * Make "Get remote testsuite results" even more verbose. + * Make hardcoded pattern gdb-testresults-12.1-*.*.rpm more + generic. + * Add missing setting of rpm variable in "Getting rpms" case. +- Patches added (backport from trunk): + * gdb-testsuite-fix-gdb.base-break-idempotent.exp-on-ppc.patch + * powerpc-fix-gdb.base-watchpoint.exp-on-power-9.patch + +------------------------------------------------------------------- +Fri Oct 21 08:03:27 UTC 2022 - Tom de Vries + +- Maintenance script qa-remote.sh: + * Make "Get remote testsuite results" more verbose. + +------------------------------------------------------------------- +Wed Oct 19 16:35:34 UTC 2022 - Tom de Vries + +- Patches added (swo#29277): + * gdb-fix-assert-in-handle_jit_event.patch +- Maintenance script qa.sh: + * Add PR29706 and PR28617 kfails. + +------------------------------------------------------------------- +Thu Sep 29 08:25:06 UTC 2022 - Fabian Vogt + +- Add patch to fix build with readline 8.2: + * gdb-add-support-for-readline-8.2.patch + +------------------------------------------------------------------- +Wed Sep 28 11:50:45 UTC 2022 - Tom de Vries + +- Patches added: + * gdb-testsuite-fix-gdb.mi-mi-sym-info.exp-on-opensuse-tumbleweed.patch +- Maintenance script qa.sh: + * Add PR26873 kfails. + +------------------------------------------------------------------- +Fri Sep 23 09:46:57 UTC 2022 - Tom de Vries + +- Maintenance script qa-remote.sh: + * Make rpm matching yet more precise. +- Update patch: + * gdb-tdep-fix-powerpc-ieee-128-bit-format-arg-passing.patch +- Add patches: + * gdb-handle-pending-c-after-rl_callback_read_char.patch + * gdb-testsuite-fix-have_mpx-test.patch + * gdb-symtab-fix-handling-of-dw_tag_unspecified_type.patch + * gdb-testsuite-fix-gdb.dwarf2-dw2-unspecified-type-foo.c-with-m32.patch + +------------------------------------------------------------------- +Thu Sep 22 13:38:31 UTC 2022 - Dirk Müller + +- use python3-xml if python is python3 + +------------------------------------------------------------------- +Fri Sep 2 09:13:08 UTC 2022 - Tom de Vries + +- Maintenance script qa.sh: + * Generalize PR29405 kfails. +- Maintenance script qa-remote.sh: + * Make rpm matching more precise. +- Patches added: + * gdb-tdep-fix-powerpc-ieee-128-bit-format-arg-passing.patch + +------------------------------------------------------------------- +Mon Aug 22 02:58:00 UTC 2022 - Martin Liška + +- Enable debuginfod for all archs as we index all TW RPM files. +- Recommend libdebuginfod1 when one installs gdb so that + it can utilize debuginfod server by default. + +------------------------------------------------------------------- +Tue Aug 2 12:01:23 UTC 2022 - Tom de Vries + +- Fix build with gcc 13 by using -Wno-error=enum-int-mismatch. + +------------------------------------------------------------------- +Sat Jul 30 07:24:23 UTC 2022 - Tom de Vries + +- Maintenance script qa.sh: + * Add SLE-12/x86_64 to "known clean configs". + * Add fail for PR29405. + * Add fail for PR26915. + +------------------------------------------------------------------- +Fri Jul 29 06:53:15 UTC 2022 - Tom de Vries + +- Patches added: + * gdb-testsuite-fix-gdb.threads-killed-outside.exp-on-aarch64.patch +- Maintenance script qa.sh: + * Remove PR29247 internal-error. + * Add SLE-15/aarch64 to "known clean configs". + +------------------------------------------------------------------- +Thu Jul 28 05:48:21 UTC 2022 - Tom de Vries + +- Patches added: + * gdb-fix-watchpoints-triggered.patch +- Maintenance script qa.sh: + * Add kfails for PR25038, PR29253, and PR29423. + * Remove gdb.mi/mi-var-invalidate-shlib.exp kfails. +- Mention qa-local.sh, qa-remote.sh and README.qa as sources. + +------------------------------------------------------------------- +Wed Jul 27 06:26:34 UTC 2022 - Tom de Vries + +- Maintenance script qa-local.sh: + * Use have_combo consistently. +- Maintenance script qa.sh: + * Add kfail_aarch64. + * Add PR29419/PR29409 kfails. + * Update PR29247 kfails. +- Patches added: + * make-gdb.ada-float-bits.exp-more-generic.patch + * gdb-testsuite-fix-gdb.ada-literals.exp-with-aarch64.patch + +------------------------------------------------------------------- +Tue Jul 26 06:56:40 UTC 2022 - Tom de Vries + +- Actually apply fixup-gdb-test-bt-cfi-without-die.patch and + fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch. + +------------------------------------------------------------------- +Mon Jul 25 20:28:02 UTC 2022 - Tom de Vries + +- Also remove gdb-6.5-readline-long-line-crash-test.patch from + patches list in gdb.spec. + +------------------------------------------------------------------- +Mon Jul 25 08:11:07 UTC 2022 - Tom de Vries + +- Patches added: + * powerpc-add-support-for-ieee-128-bit-format.patch + * powerpc-correct-the-gdb-ioctl-values-for-tcgets-tcsets-tcsetsw-and-tcsetsf.patch + * gdb-testsuite-remove-target-limits-in-gdb.base-catch-syscall.exp.patch + * powerpc-fix-for-gdb.base-eh_return.exp.patch + * fix-comparison-of-unsigned-long-int-to-int-in-record_linux_system_call.patch + * gdb-testsuite-fix-gdb.reverse-test_ioctl_tcsetsw.exp-with-libc-debuginfo.patch + * fixup-gdb-test-bt-cfi-without-die.patch + * fix-core-file-detach-crash-corefiles-29275.patch + * gdb-testsuite-fix-gdb.dwarf2-dw2-out-of-range-end-of-seq.exp-on-aarch64.patch + * gdb-testsuite-fix-gdb.base-catch-syscall.exp-without-enable-targets.patch + * gdb-testsuite-fix-gdb.base-catch-syscall.exp-with-with-expat-no.patch + * fix-for-gdb.base-solib-search.exp-test.patch +- Patch removed: + * gdb-6.7-ppc-clobbered-registers-O2-test.patch + * gdb-6.5-readline-long-line-crash-test.patch +- Patches updated: + * gdb-tdep-update-syscalls-ppc64-ppc-linux.xml.patch + * gdb-testsuite-handle-pipe2-syscall-in-gdb.base-catch-syscall.exp.patch + +------------------------------------------------------------------- +Wed Jun 22 14:31:30 UTC 2022 - Tom de Vries + +- Maintenance script qa.sh: + * Add PR28504 KFAILs. + * Make .sum file matching less complex. + * Add fedora test-case kfail. +- Maintenance script qa-local.sh: + * Fix incorrect path name. +- Update comments in gdb.spec. +- Patches added: + * powerpc-update-expected-floating-point-output-for-gdb.arch-altivec-regs.exp-and-gdb.arch-vsx-regs.exp.patch + +------------------------------------------------------------------- +Wed Jun 22 12:41:23 UTC 2022 - Tom de Vries + +- Patches updated: + * gdb-testsuite-support-recording-of-getrandom.patch + (add aarch64 part) +- Maintenance script qa.sh: + * Add i586 to known clean configs. + +------------------------------------------------------------------- +Tue Jun 21 21:22:58 UTC 2022 - Tom de Vries + +- Patches added: + * gdb-testsuite-enable-some-test-cases-for-x86_64-m32.patch + * gdb-testsuite-fix-gdb.reverse-i387-env-reverse.exp-for-pie.patch + * gdb-testsuite-support-recording-of-getrandom.patch +- Patches updated: + * gdb-record-handle-statx-system-call.patch +- Maintenance script qa.sh: + * Allow only two summary files, for i586. + * Add i586 KFAILs. +- Maintenance script qa-local.sh: + * Add i586. + +------------------------------------------------------------------- +Thu Jun 16 13:23:31 UTC 2022 - Tom de Vries + +- Maintenance script qa-local.sh: + * Fix rpm pathname. +- Maintenance script qa-remote.sh: + * Skip stale config openSUSE_Leap_15.2. +- Maintenance script qa.sh: + * Drop known clean config: Leap 15.2 x86_64. + +------------------------------------------------------------------- +Mon Jun 13 09:37:45 UTC 2022 - Tom de Vries + +- Maintenance script qa-local.sh: + * Add cleanup step. + * Add "build all configs without testsuite" step. + * For "build all configs with testsuite" step, redirect output + to log and produce PASS/FAIL line, and make sure buildroot is + removed also in case of missing rpm. + * Use "--clean --trust-all-projects" for osc build commands. +* Drop openSUSE_Leap_15.2. +- Maintenance script qa.sh: + * Rename argument 6 to -local. + * Add PR29247 KFAILs. + * Update internal-error regexps. +- New maintenance script qa-remote.sh. +- Add "build all configs without testsuite" step in README.qa. +- Patches added (backport from trunk): + * gdb-testsuite-remove-attach-test-from-can_spawn_for_attach.patch +- README.qa: + * Add remote qa entry. + * Update local qa entry: + * Add notes entry. + * Other updates to match changes in qa-local.sh. + +------------------------------------------------------------------- +Mon Jun 13 03:16:35 UTC 2022 - Tom de Vries + +- Fix installed but unpackaged /usr/share/info/ctf-spec.info.gz. + +------------------------------------------------------------------- +Sat Jun 11 22:51:37 UTC 2022 - Tom de Vries + +- Rebase to 12.1 release (as in fedora 36 @ 89947a7): + * DBX mode is deprecated, and will be removed in GDB 13. + + * GDB 12 is the last release of GDB that will support building against + Python 2. From GDB 13, it will only be possible to build GDB itself + with Python 3 support. + + * Improved C++ template support: + GDB now treats functions/types involving C++ templates like it does function + overloads. Users may omit parameter lists to set breakpoints on families of + template functions, including types/functions composed of multiple template types: + (gdb) break template_func(template_1, int) + The above will set breakpoints at every function `template_func' where + the first function parameter is any template type named `template_1' and + the second function parameter is `int'. + TAB completion also gains similar improvements. + + * New commands: + + maint set backtrace-on-fatal-signal on|off + maint show backtrace-on-fatal-signal + This setting is 'on' by default. When 'on' GDB will print a limited + backtrace to stderr in the situation where GDB terminates with a + fatal signal. This only supported on some platforms where the + backtrace and backtrace_symbols_fd functions are available. + + set source open on|off + show source open + This setting, which is on by default, controls whether GDB will try + to open source code files. Switching this off will stop GDB trying + to open and read source code files, which can be useful if the files + are located over a slow network connection. + + set varsize-limit + show varsize-limit + These are now deprecated aliases for "set max-value-size" and + "show max-value-size". + + task apply [all | TASK-IDS...] [FLAG]... COMMAND + Like "thread apply", but applies COMMAND to Ada tasks. + + watch [...] task ID + Watchpoints can now be restricted to a specific Ada task. + + maint set internal-error backtrace on|off + maint show internal-error backtrace + maint set internal-warning backtrace on|off + maint show internal-warning backtrace + GDB can now print a backtrace of itself when it encounters either an + internal-error, or an internal-warning. This is on by default for + internal-error and off by default for internal-warning. + + set logging on|off + Deprecated and replaced by "set logging enabled on|off". + + set logging enabled on|off + show logging enabled + These commands set or show whether logging is enabled or disabled. + + exit + You can now exit GDB by using the new command "exit", in addition to + the existing "quit" command. + + set debug threads on|off + show debug threads + Print additional debug messages about thread creation and deletion. + + set debug linux-nat on|off + show debug linux-nat + These new commands replaced the old 'set debug lin-lwp' and 'show + debug lin-lwp' respectively. Turning this setting on prints debug + messages relating to GDB's handling of native Linux inferiors. + + maint flush source-cache + Flush the contents of the source code cache. + + maint set gnu-source-highlight enabled on|off + maint show gnu-source-highlight enabled + Whether GDB should use the GNU Source Highlight library for adding + styling to source code. When off, the library will not be used, even + when available. When GNU Source Highlight isn't used, or can't add + styling to a particular source file, then the Python Pygments + library will be used instead. + + set suppress-cli-notifications (on|off) + show suppress-cli-notifications + This controls whether printing the notifications is suppressed for CLI. + CLI notifications occur when you change the selected context + (i.e., the current inferior, thread and/or the frame), or when + the program being debugged stops (e.g., because of hitting a + breakpoint, completing source-stepping, an interrupt, etc.). + + set style disassembler enabled on|off + show style disassembler enabled + If GDB is compiled with Python support, and the Python Pygments + package is available, then, when this setting is on, disassembler + output will have styling applied. + + set ada source-charset + show ada source-charset + Set the character set encoding that is assumed for Ada symbols. Valid + values for this follow the values that can be passed to the GNAT + compiler via the '-gnati' option. The default is ISO-8859-1. + + * Changed commands: + + print + Printing of floating-point values with base-modifying formats like + /x has been changed to display the underlying bytes of the value in + the desired base. This was GDB's documented behavior, but was never + implemented correctly. + + maint packet + This command can now print a reply, if the reply includes + non-printable characters. Any non-printable characters are printed + as escaped hex, e.g. \x?? where '??' is replaces with the value of + the non-printable character. + + clone-inferior + The clone-inferior command now ensures that the TTY, CMD and ARGS + settings are copied from the original inferior to the new one. + All modifications to the environment variables done using the 'set + environment' or 'unset environment' commands are also copied to the new + inferior. + + set debug lin-lwp on|off + show debug lin-lwp + These commands have been removed from GDB. The new command 'set + debug linux-nat' and 'show debug linux-nat' should be used + instead. + + info win + This command now includes information about the width of the tui + windows in its output. + + * GDB's Ada parser now supports an extension for specifying the exact + byte contents of a floating-point literal. This can be useful for + setting floating-point registers to a precise value without loss of + precision. The syntax is an extension of the based literal syntax. + Use, e.g., "16lf#0123abcd#" -- the number of "l"s controls the width + of the floating-point type, and the "f" is the marker for floating + point. + + * MI changes: + + ** The '-add-inferior' with no option flags now inherits the + connection of the current inferior, this restores the behaviour of + GDB as it was prior to GDB 10. + + ** The '-add-inferior' command now accepts a '--no-connection' + option, which causes the new inferior to start without a + connection. + + * Python API: + + ** New function gdb.add_history(), which takes a gdb.Value object + and adds the value it represents to GDB's history list. An + integer, the index of the new item in the history list, is + returned. + + ** New function gdb.history_count(), which returns the number of + values in GDB's value history. + + ** New gdb.events.gdb_exiting event. This event is called with a + gdb.GdbExitingEvent object which has the read-only attribute + 'exit_code', which contains the value of the GDB exit code. This + event is triggered once GDB decides it is going to exit, but + before GDB starts to clean up its internal state. + + ** New function gdb.architecture_names(), which returns a list + containing all of the possible Architecture.name() values. Each + entry is a string. + + ** New function gdb.Architecture.integer_type(), which returns an + integer type given a size and a signed-ness. + + ** New gdb.TargetConnection object type that represents a connection + (as displayed by the 'info connections' command). A sub-class, + gdb.RemoteTargetConnection, is used to represent 'remote' and + 'extended-remote' connections. + + ** The gdb.Inferior type now has a 'connection' property which is an + instance of gdb.TargetConnection, the connection used by this + inferior. This can be None if the inferior has no connection. + + ** New 'gdb.events.connection_removed' event registry, which emits a + 'gdb.ConnectionEvent' when a connection is removed from GDB. + This event has a 'connection' property, a gdb.TargetConnection + object for the connection being removed. + + ** New gdb.connections() function that returns a list of all + currently active connections. + + ** New gdb.RemoteTargetConnection.send_packet(PACKET) method. This + is equivalent to the existing 'maint packet' CLI command; it + allows a user specified packet to be sent to the remote target. + + ** New function gdb.host_charset(), returns a string, which is the + name of the current host charset. + + ** New gdb.set_parameter(NAME, VALUE). This sets the gdb parameter + NAME to VALUE. + + ** New gdb.with_parameter(NAME, VALUE). This returns a context + manager that temporarily sets the gdb parameter NAME to VALUE, + then resets it when the context is exited. + + ** The gdb.Value.format_string method now takes a 'styling' + argument, which is a boolean. When true, the returned string can + include escape sequences to apply styling. The styling will only + be present if styling is otherwise turned on in GDB (see 'help + set styling'). When false, which is the default if the argument + is not given, then no styling is applied to the returned string. + + ** New read-only attribute gdb.InferiorThread.details, which is + either a string, containing additional, target specific thread + state information, or None, if there is no such additional + information. + + ** New read-only attribute gdb.Type.is_scalar, which is True for + scalar types, and False for all other types. + + ** New read-only attribute gdb.Type.is_signed. This attribute + should only be read when Type.is_scalar is True, and will be True + for signed types, and False for all other types. Attempting to + read this attribute for non-scalar types will raise a ValueError. + + ** It is now possible to add GDB/MI commands implemented in Python. + +- Update libipt to v2.0.5. +- Patches added: + * gdb-6.3-rh-testversion-20041202.patch + * gdb-6.5-BEA-testsuite.patch + * gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch + * gdb-6.7-charsign-test.patch + * gdb-6.8-bz466901-backtrace-full-prelinked.patch + * gdb-fix-for-gdb.base-eof-exit.exp-test-failures.patch + * gdb-improved-eof-handling-when-using-readline-7.patch + * gdb-libexec-add-index.patch + * gdb-tdep-detect-get_pc_thunk-call-in-i386-prologue.patch + * gdb-testsuite-address-test-failures-in-gdb.mi-mi-multi-commands.exp.patch + * gdb-testsuite-detect-change-instead-of-init-in-gdb.mi-mi-var-block.exp.patch + * gdb-testsuite-fix-gdb.opt-clobbered-registers-o2.exp-with-gcc-12.patch + * gdb-testsuite-fix-occasional-failure-in-gdb.mi-mi-multi-commands.exp.patch + * gdb-testsuite-fix-test-failure-when-building-against-readline-v7.patch + * gdb-testsuite-handle-older-python-in-gdb.python-py-send-packet.py.patch + * gdb-testsuite-handle-quotes-in-gdb_py_module_available.patch + * gdb-testsuite-handle-unordered-dict-in-gdb.python-py-mi-cmd.exp.patch + * gdb-testsuite-skip-gdb.fortran-namelist.exp-for-gfortran-4.8.patch + * gdb-testsuite-workaround-unnecessary-.s-file-with-gfortran-4.8.patch +- Patches dropped: + * aarch64-make-gdbserver-register-set-selection-dynamic.patch + * fix-build-with-current-gcc-el_explicit-location-always-non-null.patch + * fix-gdb.base-sigstep.exp-test-for-ppc.patch + * fix-gdb.multi-multi-term-settings.exp-race.patch + * fixup-2-gdb-6.6-buildid-locate.patch + * fixup-gdb-6.6-buildid-locate.patch + * gdb-6.3-inferior-notification-20050721.patch + * gdb-ada-fix-assert-in-ada_is_unconstrained_packed_array_type.patch + * gdb-build-add-cxx_dialect-to-cxx.patch + * gdb-build-make-c-exp.y-work-with-bison-3.8.patch + * gdb-doc-fix-print-inferior-events-default.patch + * gdb-exp-improve-error-reading-variable-message.patch + * gdb-fortran-handle-dw-at-string-length-with-loclistptr.patch + * gdb-r_version-check.patch + * gdb-rhbz1976887-field-location-kind.patch + * gdb-rhbz2012976-paper-over-fortran-lex-problems.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-fix-segfault-in-search_one_symtab.patch + * gdb-symtab-remove-compunit_call_site_htab.patch + * gdb-symtab-use-unrelocated-addresses-in-call_site.patch + * gdb-tdep-fix-avx512-m32-support-in-gdbserver.patch + * gdb-tdep-rs6000-don-t-skip-system-call-in-skip_prologue.patch + * gdb-test-for-rhbz1976887.patch + * gdb-testsuite-add-gdb.arch-ppc64-break-on-_exit.exp.patch + * gdb-testsuite-add-gdb.opt-break-on-_exit.exp.patch + * gdb-testsuite-add-gdb.testsuite-dump-system-info.exp.patch + * gdb-testsuite-add-missing-wait-in-gdb.base-signals-state-child.exp.patch + * gdb-testsuite-add-nopie-in-two-test-cases.patch + * gdb-testsuite-detect-no-mpx-support.patch + * gdb-testsuite-disable-inferior-output-in-gdb.base-foll-vfork.exp.patch + * gdb-testsuite-don-t-error-when-trying-to-unset-last_spawn_tty_name.patch + * gdb-testsuite-factor-out-dump_info-in-gdb.testsuite-dump-system-info.exp.patch + * gdb-testsuite-fix-assembly-comments-in-gdb.dwarf2-clang-debug-names.exp.tcl.patch + * gdb-testsuite-fix-data-alignment-in-gdb.arch-i386-avx-sse-.exp.patch + * gdb-testsuite-fix-fail-in-gdb.base-annota1.exp.patch + * gdb-testsuite-fix-fail-in-gdb.tui-basic.exp.patch + * gdb-testsuite-fix-fail-in-gdb.tui-corefile-run.exp.patch + * gdb-testsuite-fix-gdb.ada-big_packed_array.exp-xfail-for-m32.patch + * gdb-testsuite-fix-gdb.arch-i386-pkru.exp-on-linux.patch + * gdb-testsuite-fix-gdb.base-annota1.exp-with-pie.patch + * gdb-testsuite-fix-gdb.base-dcache-flush.exp.patch + * gdb-testsuite-fix-gdb.gdb-selftest.exp.patch + * gdb-testsuite-fix-gdb.guile-scm-type.exp-with-gcc-4.8.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-fix-gdb.threads-linux-dp.exp.patch + * gdb-testsuite-fix-gdb.threads-thread-specific-bp.exp.patch + * gdb-testsuite-fix-port-detection-in-gdb.debuginfod-fetch_src_and_symbols.exp.patch + * gdb-testsuite-fix-regexp-in-gdb.base-foll-vfork.exp.patch + * gdb-testsuite-fix-stepi-test-cases-with-unix-m32-fpie-pie.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-testsuite-handle-sigill-in-two-gdb.arch-powerpc-test-cases.patch + * gdb-testsuite-handle-supports_memtag-in-gdb.base-gdb-caching-proc.exp.patch + * gdb-testsuite-make-gdb.base-annota1.exp-more-robust.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-update-test-gdb.base-step-over-syscall.exp.patch + * gdb-testsuite-use-compiler-generated-instead-of-gas-generated-stabs.patch + * gdb-tui-fix-breakpoint-display-functionality.patch + * ibm-z-add-another-arch14-instruction.patch + * ibm-z-remove-lpswey-parameter.patch +- Patched updated: + * gdb-6.3-gstack-20050411.patch + * gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch + * gdb-6.6-buildid-locate-rpm-librpm-workaround.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-cli-add-ignore-errors-command.patch + * gdb-container-rh-pkg.patch + * gdb-core-open-vdso-warning.patch + * gdb-fedora-libncursesw.patch + * gdb-gcore-bash.patch + * gdb-linux_perf-bundle.patch + * gdb-testsuite-handle-init-errors-in-gdb.mi-user-selected-context-sync.exp.patch +- Add BuildRequires python-xml. +- Maintenance script qa.sh: + * Add -sle-12 and -factory options. + * Handle *.-fPIE.-pie.sum files. + * Add KFAILs for PRs 26292, 29238, 25059, 29240, 29241, 29244, + 29245, 29160, 29196. + * Move PR27539 KFAILs from kfail_factory to kfail. +- New maintenance script qa-local.sh. +- New file README.qa. + +------------------------------------------------------------------- +Mon May 9 12:05:38 UTC 2022 - Tom de Vries + +- Patches added (trunk backport): + * gdb-testsuite-detect-no-mpx-support.patch + * gdb-testsuite-handle-init-errors-in-gdb.mi-user-selected-context-sync.exp.patch + * gdb-add-gdb-syscalls-makefile.patch +- Patches added (ml backport): + * gdb-update-syscalls-amd64-i386-linux.xml.patch + * gdb-record-handle-statx-system-call.patch +- Patches added (to be upstreamed): + * gdb-tdep-update-syscalls-ppc64-ppc-linux.xml.patch +- Maintenance script qa.sh: + * Add another KFAIL for PR27027. + * Remove PR28461 KFAIL. + +------------------------------------------------------------------- +Wed May 4 13:49:10 UTC 2022 - Tom de Vries + +- patches added (trunk backport): + * gdb-testsuite-make-gdb.base-annota1.exp-more-robust.patch + * gdb-testsuite-fix-gdb.base-annota1.exp-with-pie.patch +- patches added (gdb-patches ml backport): + * gdb-tdep-handle-pipe2-syscall-for-amd64.patch + * gdb-testsuite-handle-pipe2-syscall-in-gdb.base-catch-syscall.exp.patch + * gdb-tdep-support-catch-syscall-pipe2-for-i386.patch +- Maintenance script qa.sh: + * Add Leap 15.4 x86_64 to know good configs. + +------------------------------------------------------------------- +Fri Apr 29 13:27:04 UTC 2022 - Martin Liška + +- Remove dependency on binutils-gold as the package will be removed + in the future. Gold linker is unmaintained by the upstream project. + +------------------------------------------------------------------- +Thu Apr 14 09:24:07 UTC 2022 - Tom de Vries + +- Fix unresolved BuildRequires fpc for Leap 15.4/i586. + +------------------------------------------------------------------- +Fri Feb 25 14:53:56 UTC 2022 - Tom de Vries + +- Patch added (backport from master): + * fix-build-with-current-gcc-el_explicit-location-always-non-null.patch + +------------------------------------------------------------------- +Fri Feb 11 15:15:58 UTC 2022 - Tom de Vries + +- Maintenance script qa.sh: + * Add KFAILs for PR28667. + +------------------------------------------------------------------- +Mon Feb 7 15:15:58 UTC 2022 - Tom de Vries + +- Patches added (jsc#SLE-22287): + * ibm-z-add-another-arch14-instruction.patch + * ibm-z-remove-lpswey-parameter.patch +- Fedora fixup patch added: + * fixup-gdb-6.5-bz243845-stale-testing-zombie-test.patch + +------------------------------------------------------------------- +Thu Feb 3 12:22:35 UTC 2022 - Andreas Schwab + +- gdb-r_version-check.patch: gdb: Don't assume r_ldsomap when r_version > + 1 on Linux + +------------------------------------------------------------------- +Mon Dec 6 17:19:44 UTC 2021 - Tom de Vries + +- Patches added (swo#28323): + gdb-ada-fix-assert-in-ada_is_unconstrained_packed_array_type.patch + +------------------------------------------------------------------- +Tue Nov 30 10:45:32 UTC 2021 - Tom de Vries + +- Patches added (swo#27028, swo#27257): + * gdb-testsuite-fix-gdb.arch-i386-pkru.exp-on-linux.patch + * gdb-tdep-fix-avx512-m32-support-in-gdbserver.patch + +------------------------------------------------------------------- +Fri Nov 26 14:04:38 UTC 2021 - Tom de Vries + +- Patch added (swo#28539, bsc#1192285): + * gdb-symtab-fix-segfault-in-search_one_symtab.patch + +------------------------------------------------------------------- +Mon Nov 22 19:40:55 UTC 2021 - Tom de Vries + +- Patches removed: + * gdb-testsuite-debug-gdb.arch-i386-sse.exp.patch + +------------------------------------------------------------------- +Mon Nov 22 17:47:57 UTC 2021 - Tom de Vries + +- Maintenance script qa.sh: + - Drop openSUSE Leap 15.1. + - Add KFAILs for PR28617. + +------------------------------------------------------------------- +Mon Nov 22 09:25:32 UTC 2021 - Tom de Vries + +- Fix SLE-12 x86_64 unresolvable by removing BuildRequire gcc-java. + +------------------------------------------------------------------- +Mon Nov 22 09:00:45 UTC 2021 - Tom de Vries + +- Fix openSUSE_Factory_ARM armv7l unresolvable by not doing + BuildRequire babeltrace-devel. + +------------------------------------------------------------------- + +Mon Nov 22 08:24:21 UTC 2021 - Tom de Vries + +- Fix SLE-12 x86_64 unresolvable by not doing BuildRequire + babeltrace-devel. + +------------------------------------------------------------------- +Fri Nov 19 15:31:46 UTC 2021 - Tom de Vries + +- Patches added (backport from master): + * gdb-testsuite-add-missing-wait-in-gdb.base-signals-state-child.exp.patch +- Add BuildRequire libsource-highlight. + +------------------------------------------------------------------- +Thu Nov 18 14:01:30 UTC 2021 - Tom de Vries + +- Maintenance script qa.sh: + - Add KFAIL. +- Patches updated (increase sleep time): + * gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch +- Patches added (debug hard to reproduce failure): + * gdb-testsuite-debug-gdb.arch-i386-sse.exp.patch + +------------------------------------------------------------------- +Thu Nov 18 11:45:00 UTC 2021 - Tom de Vries + +- Maintenance script qa.sh: + - Add internal-error KFAILs. + - Rewrite gdb.suse check to distinguish between: + "zypper hint printed (librpm)" and + "zypper hint printed (no librpm)". + +------------------------------------------------------------------- +Tue Nov 16 15:50:08 UTC 2021 - Tom de Vries + +- Patch updated (zypper hint doesn't use librpm on SLE-11): + * gdb-testsuite-add-gdb.suse-zypper-hint.exp.patch + +------------------------------------------------------------------- +Thu Nov 11 10:36:08 UTC 2021 - Tom de Vries + +- Patches added (backports from trunk): + * gdb-testsuite-add-gdb.opt-break-on-_exit.exp.patch + * gdb-tdep-rs6000-don-t-skip-system-call-in-skip_prologue.patch + * gdb-testsuite-fix-stepi-test-cases-with-unix-m32-fpie-pie.patch + * gdb-testsuite-fix-assembly-comments-in-gdb.dwarf2-clang-debug-names.exp.tcl.patch + * gdb-doc-fix-print-inferior-events-default.patch + * gdb-testsuite-fix-gdb.guile-scm-type.exp-with-gcc-4.8.patch + * gdb-testsuite-add-gdb.arch-ppc64-break-on-_exit.exp.patch + * gdb-testsuite-don-t-error-when-trying-to-unset-last_spawn_tty_name.patch + * gdb-exp-improve-error-reading-variable-message.patch + * fix-gdb.base-sigstep.exp-test-for-ppc.patch + * gdb-testsuite-fix-regexp-in-gdb.base-foll-vfork.exp.patch +- Patches added (backports from ml): + * gdb-testsuite-disable-inferior-output-in-gdb.base-foll-vfork.exp.patch +- Maintenance script qa.sh: + - Add -m32/-pie to known clean configs. + - Add kfail for PR28467. + +------------------------------------------------------------------- +Tue Nov 9 15:54:58 UTC 2021 - Tom de Vries + +- Fix empty patch: + * gdb-testsuite-fix-fail-in-gdb.tui-basic.exp.patch + +------------------------------------------------------------------- +Tue Nov 9 08:05:16 UTC 2021 - Tom de Vries + +- Limit SLE extra targets to SLE targets. +- Add avr-elf and pru-elf to openSUSE extra targets. + +------------------------------------------------------------------- +Mon Nov 8 14:53:20 UTC 2021 - Tom de Vries + +- Maintenance script qa.sh: + * Add note. + * Add KFAIL, improve KFAIL patterns. +- Patch updated: + * gdb-testsuite-fix-data-alignment-in-gdb.arch-i386-avx-sse-.exp.patch + * gdb-testsuite-fix-race-in-gdb.threads-detach-step-over.exp.patch + +------------------------------------------------------------------- +Sat Nov 6 09:25:28 UTC 2021 - Tom de Vries + +- Replace patch (patch from mailing list, fix SLE-11 apply failure): + * gdb-tdep-aarch64-make-gdbserver-register-set-selection-dynamic.patch + with (now backported from release branch): + * aarch64-make-gdbserver-register-set-selection-dynamic.patch +- Patches added: + * gdb-testsuite-fix-data-alignment-in-gdb.arch-i386-avx-sse-.exp.patch + * gdb-testsuite-fix-fail-in-gdb.tui-basic.exp.patch +- Patches dropped: + * gdb-testsuite-add-checks-to-gdb.arch-i386-sse.exp.patch +- Replace patch: + * gdb-testsuite-Fix-gdb.threads-thread-specific-bp.exp.patch + with (updated version, and patchname now generated by + import-patches.sh): + * gdb-testsuite-fix-gdb.threads-thread-specific-bp.exp.patch +- Maintenance script import-patches.sh: + * Improve argument checking. + * Add usage. + * Use filterdiff to filter out ChangeLog entries. +- Maintenance script qa.sh: + * Fix usage. + * Document todo. + +------------------------------------------------------------------- +Fri Nov 5 23:04:35 UTC 2021 - Tom de Vries + +- Re-enable big endian powerpc, but keep testing disabled. +- Add KFAIL for PR28553. + +------------------------------------------------------------------- +Fri Nov 5 19:15:43 UTC 2021 - Tom de Vries + +- Patch added (move zypper hint test to testsuite): + * gdb-testsuite-add-gdb.suse-zypper-hint.exp.patch + +------------------------------------------------------------------- +Fri Nov 5 15:21:03 UTC 2021 - Tom de Vries + +- Maintenance script qa.sh: + * Add PR28551 KFAIL. + * Add missing quotes for some KFAILs. + * Remove PR28355 KFAIL. + +------------------------------------------------------------------- +Tue Nov 2 13:03:51 UTC 2021 - Tom de Vries + +- Patches added (add back ignore-errors command, dropped in + 11.1 update): + * gdb-cli-add-ignore-errors-command.patch + +------------------------------------------------------------------- +Mon Nov 1 10:04:24 UTC 2021 - Tom de Vries + +- Patches added [swo#28355]: + * gdb-tdep-aarch64-make-gdbserver-register-set-selection-dynamic.patch + +------------------------------------------------------------------- +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 + +- 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): + * Implements SLE-21561. + * 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 + +- amd64-linux-siginfo-include-order.patch: Adjust include order to avoid + gnulib error + +------------------------------------------------------------------- +Wed Jun 23 11:52:54 UTC 2021 - Andreas Schwab + +- gdb-support-dw-lle-start-end.patch: Support DW_LLE_start_end + (bsc#1187044) + +------------------------------------------------------------------- +Thu Jun 17 11:19:14 UTC 2021 - Tom de Vries + +- Fix Leap 15.3 s390x gdb:testsuite build, by not requiring 32-bit + packages for openSUSE s390x. + +------------------------------------------------------------------- +Thu Jun 17 10:18:44 UTC 2021 - Tom de Vries + +- Fix Leap 15.3 s390x gdb:testsuite build, by not requiring + glibc-devel-static-32bit. + +------------------------------------------------------------------- +Thu Jun 17 09:36:06 UTC 2021 - Tom de Vries + +- Fix Leap 15.3 i586 gdb:testsuite build, by not requiring fpc. + +------------------------------------------------------------------- +Wed Jun 16 10:47:16 UTC 2021 - Tom de Vries + +- Backport updated fix from upstream [bsc#1185638, swo#26327]: + * gdb-symtab-fix-infinite-recursion-in-dwarf2_cu-get_builder-again.patch + +------------------------------------------------------------------- +Fri May 21 13:31:07 UTC 2021 - Tom de Vries + +- Backport fix for assert [bsc#1186040, swo#27889]: + * gdb-breakpoint-fix-assert-in-jit_event_handler.patch + +------------------------------------------------------------------- +Wed May 12 14:12:41 UTC 2021 - Tom de Vries + +- Remove fix due to regressions [bsc#1185638, swo#26327]: + * gdb-symtab-fix-infinite-recursion-in-dwarf2_cu-get_builder.patch + +------------------------------------------------------------------- +Fri May 7 10:43:38 UTC 2021 - Tom de Vries +- Replace tentative fix with upstreamed fix [swo#27681]: + Remove: + * gdb-build-workaround-pcre2_posix-linking-problem.patch + Add: + * gdb-build-hardcode-with-included-regex.patch +- Backport fix from upstream [bsc#1185638, swo#26327]: + * gdb-symtab-fix-infinite-recursion-in-dwarf2_cu-get_builder.patch +- Backport fix from upstream [rh#1931344]: + * gdb-save-restore-file-offset-while-reading-notes-in-core-file.patch + +------------------------------------------------------------------- +Sun May 2 18:24:36 UTC 2021 - Tom de Vries + +- Backport fix for tui assert [swo#27680]: + * gdb-tui-fix-len_without_escapes-in-tui-disasm.c.patch + +------------------------------------------------------------------- +Wed Apr 7 03:51:41 UTC 2021 - Tom de Vries + +- Backport fixes that ignore DEBUGINFOD_URLS during testing: + * gdb-testsuite-ignore-debuginfod_urls.patch + * gdb-testsuite-fix-unset-of-debuginfod_urls-in-default_gdb_init.patch + +------------------------------------------------------------------- +Tue Apr 6 15:15:10 UTC 2021 - Tom de Vries + +- Fix various testsuite fails on Factory using backports: + * gdb-testsuite-fix-gdb.arch-amd64-stap-three-arg-disp.s.patch + * gdb-testsuite-fix-xfail-handling-in-gdb.threads-gcore-thread.exp.patch + * gdb-threads-fix-lin_thread_get_thread_signals-for-glibc-2.28.patch +- Fix libthread_db problem on Factory [swo#27526, boo#1184214]: + * gdb-try-to-load-libthread_db-only-after-reading-all-shared-libraries-when-attaching.patch +- Workaround libncurses pulling in libpcre2_posix: + * gdb-build-workaround-pcre2_posix-linking-problem.patch + +------------------------------------------------------------------- +Thu Feb 11 16:13:14 UTC 2021 - Tom de Vries + +- Replace tentative fix with upstreamed fix [swo#26881]: + Remove: + * gdb-fix-assert-in-process-event-stop-test.patch + Add: + * gdb-fix-internal-error-in-process_event_stop_test.patch + * gdb-breakpoints-handle-glibc-with-debuginfo-in-create_exception_master_breakpoint.patch + +------------------------------------------------------------------- +Thu Feb 11 15:07:12 UTC 2021 - Tom de Vries + +- Fix license [bsc#1180786]. + +------------------------------------------------------------------- +Wed Dec 9 07:56:36 UTC 2020 - Tom de Vries + +- Backport from master [jsc#13656]: + * gdb-powerpc-remove-512-bytes-region-limit-if-2nd-dawr-is-avaliable.patch +- Require 8GB diskspace for x86_64. + +------------------------------------------------------------------- +Mon Nov 30 15:43:58 UTC 2020 - Tom de Vries + +- Patches to be upstreamed: + * gdb-fix-use-of-invalid-pointer-in-remote-async-inferior-event-handler.patch + +------------------------------------------------------------------- +Mon Nov 30 14:46:49 UTC 2020 - Tom de Vries + +- Mention fedora patch fixups added: + * fixup-3-gdb-archer-vla-tests.patch +- Mention patch to be upstreamed added: + * gdb-fix-selftest-fails-with-gdb-build-with-O2-flto.patch + +------------------------------------------------------------------- +Fri Nov 27 13:54:42 UTC 2020 - Tom de Vries + +- Fedora patch fixups update: + * fixup-2-gdb-rhbz1156192-recursive-dlopen-test.patch +- Fedora patch fixups added: + * fixup-gdb-test-ivy-bridge.patch +- Add xz to BuildRequires for testsuite flavour. +- Add note on mpfr-devel for SLE-11. + +------------------------------------------------------------------- +Thu Nov 26 08:05:44 UTC 2020 - Tom de Vries + +- Backport from master: + * gdb-testsuite-fix-failure-in-gdb-base-step-over-no-symbols-exp.patch +- Patch to be upstreamed: + * gdb-testsuite-fix-control-flow-in-gdb-reverse-insn-reverse-exp.patch + +------------------------------------------------------------------- +Thu Nov 26 00:35:52 UTC 2020 - Tom de Vries + +- Patch updated: + * gdb-testsuite-gdb-tui-new-layout-exp-partly-require-tcl86.patch + +------------------------------------------------------------------- +Wed Nov 25 23:45:19 UTC 2020 - Tom de Vries + +- Patch updated: + * gdb-testsuite-gdb-tui-new-layout-exp-partly-require-tcl86.patch + +------------------------------------------------------------------- +Tue Nov 24 13:10:46 UTC 2020 - Tom de Vries + +- Patch to be upstreamed: + * gdb-testsuite-gdb-base-morestack-exp-no-clang.patch + * gdb-testsuite-handle-sigill-in-gdb-reverse-insn-reverse-exp.patch + * gdb-testsuite-fix-gdb-reverse-insn-reverse-x86-c-for-m32.patch + * gdb-testsuite-gdb-tui-new-layout-exp-partly-require-tcl86.patch + * gdb-tui-enable-work-around-libncurses-segfault.patch +- Backport from master dropped: + * gdb-testsuite-fix-unbalanced-braces-in-gdb-tui-new-layout-exp.patch + +------------------------------------------------------------------- +Wed Nov 18 09:59:52 UTC 2020 - Tom de Vries - 10.1 + +- Fedora patch fixups updated: + * fixup-2-gdb-archer-vla-tests.patch +- Fedora patch fixups added: + * fixup-2-gdb-rhbz1156192-recursive-dlopen-test.patch +- Testsuite patch: + * gdb-testsuite-disable-selftests-for-factory.patch +- Backport from master: + * gdb-symtab-read-cu-base-address-for-enqueued-cu.patch + * gdb-symtab-use-early-continue-in-find_pc_sect_compunit.patch + * gdb-fix-section-matching-in-find_pc_sect_compunit.patch + * gdb-symtab-fix-language-of-frame-without-debug-info.patch +- Patch to be upstreamed: + * gdb-symtab-set-default-dwarf-max-cache-age-1000.patch + +------------------------------------------------------------------- +Thu Nov 12 22:30:53 UTC 2020 - Tom de Vries + +- BuildRequire curl for debuginfod test-case. +- Patch to be upstreamed: + * gdb-don-t-return-non-existing-path-in-debuginfod-source-query.patch + * gdb-fix-assert-in-process-event-stop-test.patch + * gdb-fix-filename-in-not-in-executable-format-error.patch + * gdb-handle-no-upper-bound-in-value-subscript.patch + * gdb-fortran-handle-dw-at-string-length-with-loclistptr.patch +- Testsuite patch: + * gdb-testsuite-fix-gdb-server-ext-run-exp-for-obs.patch +- Fedora patch fixups added: + * fixup-gdb-rhbz1156192-recursive-dlopen-test.patch +- Fedora patch fixups updated: + * fixup-gdb-btrobust.patch + * fixup-2-gdb-archer-vla-tests.patch + +------------------------------------------------------------------- +Thu Nov 12 17:04:42 UTC 2020 - Tom de Vries + +- Add missing patch command for: + * gdb-fortran-fix-print-dynamic-array.patch + +------------------------------------------------------------------- +Thu Nov 12 16:31:58 UTC 2020 - Tom de Vries + +- Fix patch application on SLE-11: + * gdb-testsuite-detect-gdb-prompt-after-monitor-exit.patch + +------------------------------------------------------------------- +Thu Nov 12 07:44:58 UTC 2020 - Tom de Vries + +- Disable xz-devel and binutils-gold for SLE-10. +- More enabling of gdbserver for riscv64. +- Backport from master: + * gdb-testsuite-fix-unbalanced-braces-in-gdb-tui-new-layout-exp.patch + * gdb-testsuite-catch-condition-evaluation-errors-in-gdb-assert.patch + * gdb-testsuite-detect-gdb-prompt-after-monitor-exit.patch + * gdb-testsuite-fix-gdb-dlang-watch-loc-exp-on-ppc64.patch +- Patch to be upstreamed: + * gdb-fortran-fix-print-dynamic-array.patch + +------------------------------------------------------------------- +Wed Nov 11 22:13:49 UTC 2020 - Tom de Vries + +- Enable gdbserver for riscv64. +- Restrict BuildRequires libdebuginfod to Factory and supporting + archs. + +------------------------------------------------------------------- +Tue Nov 10 15:12:24 UTC 2020 - Tom de Vries + +- Rebase to 10.1 release (as in fedora 33 @ 6c8ccd6). + * Debuginfod support. + * Multi-target debugging support. + * Multithreaded symbol loading enabled by default. + * New command set exec-file-mismatch. + * New command tui new-layout. + * Alias command can now specify default args for an alias. +- Update libipt to v2.0.2. +- Fedora-specific patches dropped: + * gdb-6.8-bz466901-backtrace-full-prelinked.patch +- Broken/obsolete fedora patches dropped: + * gdb-bz533176-fortran-omp-step.patch + * gdb-6.5-BEA-testsuite.patch + * gdb-6.7-charsign-test.patch +- Obsoleted fedora patches dropped: + * 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-rhbz1818011-bfd-gcc10-error.patch +- Fedora patches updated: + * gdb-6.3-gstack-20050411.patch + * gdb-6.3-test-self-20050110.patch + * gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch + * gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch + * gdb-6.6-buildid-locate-core-as-arg.patch + * gdb-6.6-buildid-locate-rpm-librpm-workaround.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.7-testsuite-stable-results.patch + * gdb-6.8-quit-never-aborts.patch + * gdb-archer-pie-addons-keep-disabled.patch + * gdb-archer-pie-addons.patch + * gdb-archer-vla-tests.patch + * gdb-attach-fail-reasons-5of5.patch + * gdb-bz1219747-attach-kills.patch + * gdb-bz533176-fortran-omp-step.patch + * gdb-container-rh-pkg.patch + * gdb-fedora-libncursesw.patch + * gdb-gnat-dwarf-crash-3of3.patch + * gdb-jit-reader-multilib.patch + * gdb-linux_perf-bundle.patch + * gdb-moribund-utrace-workaround.patch + * gdb-runtest-pie-override.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 +- Fedora patches added: + * gdb-config.patch +- Obsoleted patched dropped: + * gdb-testsuite-avoid-pagination-in-attach-32.exp.patch + * gdb-fix-toplevel-types-with-fdebug-types-section.patch + * gdb-fix-range-loop-index-in-find_method.patch + * gdb-fix-python3.9-related-runtime-problems.patch + * gdb-fix-unused-function-error.patch + * gdb-fix-the-thread-pool.c-compilation.patch + * gdb-aarch64-fix-erroneous-use-of-spu-architecture-bfd.patch + * gdb-fix-debug-agent-odr-bool-int.patch + * gdbserver-fix-build-with-make-3.81.patch + * gdb-threads-fix-hang-in-stop_all_threads-after-killing-inferior.patch +- Fedora patch fixups added: + * fixup-gdb-6.3-test-pie-20050107.patch + * fixup-gdb-6.5-sharedlibrary-path.patch + * fixup-gdb-6.6-buildid-locate.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-vla-intel-fortran-vla-strings.patch + * fixup-gdb-vla-intel-tests.patch + * fixup-gdb-6.3-threaded-watchpoints2-20050225.patch +- Patches renamed: + * gdb-testsuite-fix-perror-in-gdb.opt-fortran-string.exp.patch + to fixup-2-gdb-archer-vla-tests.patch +- Patches updated: + * gdb-testsuite-ada-pie.patch +- Backport from master: + * gdb-testsuite-prevent-pagination-in-gdb-internalflags.patch + +------------------------------------------------------------------- +Mon Sep 7 09:04:30 UTC 2020 - Andreas Schwab + +- Enable CTF support also for riscv64 + +------------------------------------------------------------------- +Tue Aug 11 09:56:29 UTC 2020 - Tom de Vries + +- Restore License/Group. + +------------------------------------------------------------------- +Fri Aug 7 08:10:52 UTC 2020 - Tom de Vries + +- Don't BuildRequire systemtap-sdt-devel for SLE-11. + +------------------------------------------------------------------- +Fri Aug 7 07:39:23 UTC 2020 - Tom de Vries + +- Add testsuite BuildRequire systemtap-sdt-devel. + +------------------------------------------------------------------- +Tue Aug 4 10:57:48 UTC 2020 - Tom de Vries + +- Add BuildRequire babeltrace-devel. On Factory this adds bdeps + babeltrace-devel, libuuid-devel, babeltrace, libglib-2_0-0, and + libgmodule-2_0-0. + +------------------------------------------------------------------- +Wed Jul 29 15:44:22 UTC 2020 - Tom de Vries + +- Fix internal error on aarch64 [swo#26316]. + gdb-aarch64-fix-erroneous-use-of-spu-architecture-bfd.patch + +------------------------------------------------------------------- +Tue Jul 28 11:29:35 UTC 2020 - Tom de Vries + +- Change into multibuild package and add flavour gdb-testsuite. + +------------------------------------------------------------------- +Fri Jul 24 12:39:06 UTC 2020 - Tom de Vries + +- Fix s390 -> s390x typo. + +------------------------------------------------------------------- +Fri Jul 24 12:34:41 UTC 2020 - Tom de Vries + +- Don't BuildRequire binutils-gold for SLE-12/s390. + +------------------------------------------------------------------- +Fri Jul 24 10:23:12 UTC 2020 - Tom de Vries + +- BuildRequire binutils-gold for testsuite + +------------------------------------------------------------------- +Thu Jul 23 15:34:40 UTC 2020 - Tom de Vries + +- Rebase to 9.2 release. + +------------------------------------------------------------------- +Tue Jul 14 14:33:12 UTC 2020 - Tom de Vries + +- Fix SLE-11 build. Gdb 9.1 requires make 3.82, but SLE-11 has + make 3.81: + * gdbserver-fix-build-with-make-3.81.patch + +------------------------------------------------------------------- +Tue Jul 14 08:31:27 UTC 2020 - Tom de Vries + +- Fix patch context: + * gdb-fix-the-thread-pool.c-compilation.patch + +------------------------------------------------------------------- +Mon Jul 13 22:13:07 UTC 2020 - Tom de Vries + +- Fix build error due to missing DIAGNOSTIC_IGNORE_UNUSED_FUNCTION. + * gdb-fix-the-thread-pool.c-compilation.patch + +------------------------------------------------------------------- +Mon Jul 13 15:36:16 UTC 2020 - Tom de Vries + +- Drop ChangeLog part of patch: + * gdb-fix-unused-function-error.patch + +------------------------------------------------------------------- +Mon Jul 13 15:24:53 UTC 2020 - Tom de Vries + +- Fix Werror=unused-function with gcc 4.8 (for Leap 42.3). + * gdb-fix-unused-function-error.patch + +------------------------------------------------------------------- +Mon Jul 13 13:56:50 UTC 2020 - Tom de Vries + +- Require %{suse_version} >= 1500 for --with-system-readline. + +------------------------------------------------------------------- +Mon Jul 13 12:21:04 UTC 2020 - Tom de Vries + +- Rebase to 9.1 release (as in fedora 32 @ 1735910). + * Breakpoints on nested functions and subroutines in Fortran. + * Multithreaded symbol loading, disabled by default. Enable + using 'maint set worker-threads unlimited'. + * Multi-target debugging support. + * New command pipe. + * New command set logging debugredirect [on|off]. + * New fortran commands info modules, info module functions, + info module variables. +- Fedora-specific patches dropped: + * gdb-libexec-add-index.patch + * gdb-6.3-rh-testversion-20041202.patch + * gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch +- Obsoleted fedora patches dropped: + * gdb-6.5-bz216711-clone-is-outermost.patch + * gdb-6.6-scheduler_locking-step-is-default.patch + * gdb-6.8-bz436037-reg-no-longer-active.patch + * gdb-bz541866-rwatch-before-run.patch + * gdb-bz568248-oom-is-error.patch + * gdb-follow-child-stale-parent.patch + * gdb-readline62-ask-more-rh.patch + * gdb-rhbz1371380-gcore-elf-headers.patch + * gdb-rhbz1553086-binutils-warning-loadable-section-outside-elf.patch + * gdb-rhbz1704406-disable-style-log-output-1of3.patch + * gdb-rhbz1704406-disable-style-log-output-2of3.patch + * gdb-rhbz1704406-disable-style-log-output-3of3.patch + * gdb-rhbz1708192-parse_macro_definition-crash.patch + * gdb-rhbz1723564-gdb-crash-PYTHONMALLOC-debug.patch + * gdb-rhbz795424-bitpos-20of25.patch + * gdb-rhbz795424-bitpos-21of25.patch + * gdb-rhbz795424-bitpos-22of25.patch + * gdb-rhbz795424-bitpos-23of25.patch + * gdb-rhbz795424-bitpos-25of25-test.patch + * gdb-rhbz795424-bitpos-25of25.patch + * gdb-rhbz795424-bitpos-arrayview.patch + * gdb-rhbz795424-bitpos-lazyvalue.patch + * gdb-testsuite-readline63-sigint.patch +- Fedora patches added: + * gdb-rhbz1818011-bfd-gcc10-error.patch +- Obsoleted patched dropped: + * gdb-fix-s390-build.diff + * gdb-fix-riscv-tdep.patch + * gdb-testsuite-add-missing-initial-prompt-read-in-multidictionary.exp.patch + * gdb-testsuite-pie-no-pie.patch + * gdb-testsuite-read1-fixes.patch + * gdb-testsuite-i386-pkru-exp.patch + * gdb-s390-handle-arch13.diff + * gdb-fix-heap-use-after-free-in-typename-concat.patch + * gdb-dwarf-reader-reject-sections-with-invalid-sizes.patch + * gdb-0001-remove-alloca-0-calls.patch + * gdb-arch13-1.diff + * gdb-arch13-2.diff + * gdb-arch13-3.diff + * bfd-change-num_group-to-unsigned-int.patch + * gdb-fix-incorrect-use-of-is-operator-for-comparison-in-python-lib-gdb-command-prompt.py.patch + * gdb-symtab-prefer-var-def-over-decl.patch + * gdb-only-force-interp_console-ui_out-for-breakpoint-commands-in-mi-mode.patch + * gdb-testsuite-8.3-kfail-xfail-unsupported.patch +- Backport from master: + * gdb-fix-debug-agent-odr-bool-int.patch + * gdb-fix-python3.9-related-runtime-problems.patch + +------------------------------------------------------------------- +Wed May 6 03:46:31 UTC 2020 - Tom de Vries + +- Fix .debug_types problems [swo#24480, swo#25889, bsc#1168394]. + - gdb-fix-range-loop-index-in-find_method.patch + - gdb-fix-toplevel-types-with-fdebug-types-section.patch + +------------------------------------------------------------------- +Mon Apr 20 14:29:12 UTC 2020 - Tom de Vries + +- Fix python 3.8 warning [bsc#1169495]. + * gdb-fix-incorrect-use-of-is-operator-for-comparison-in-python-lib-gdb-command-prompt.py.patch + +------------------------------------------------------------------- +Tue Apr 14 07:40:12 UTC 2020 - Tom de Vries + +- Fix build with gcc 10 [bsc#1169368, swo#25717]. + * bfd-change-num_group-to-unsigned-int.patch + +------------------------------------------------------------------- +Tue Feb 4 19:56:55 UTC 2020 - Tom de Vries + +- Fix hang after SIGKILL [swo#25478]. + * gdb-threads-fix-hang-in-stop_all_threads-after-killing-inferior.patch + +------------------------------------------------------------------- +Fri Jan 17 15:43:46 UTC 2020 - matz@suse.com + +- Add support for official name of s390 arch13: z15. + Add descriptions for arch13 instructions. Adds + gdb-arch13-1.diff, gdb-arch13-2.diff and gdb-arch13-3.diff. + [jsc#SLE-7903] + +------------------------------------------------------------------- +Fri Dec 6 14:20:21 UTC 2019 - Tom de Vries + +- Fix build with gcc 10 [bsc#1158539, swo#24653]. + * gdb-0001-remove-alloca-0-calls.patch + +------------------------------------------------------------------- +Mon Nov 11 08:57:18 UTC 2019 - Ludwig Nussel + +- make fpc optional (boo#1156284) as fpc requires itself for + bootstrapping. + +------------------------------------------------------------------- +Wed Nov 6 21:18:46 UTC 2019 - Tom de Vries + +- Fix for bsc#1146475 [bsc#1146475, swo#24971 ] + * gdb-symtab-prefer-var-def-over-decl.patch +- Fix for bsc#1146167 [bsc#1146167, swo#24956] + * gdb-only-force-interp_console-ui_out-for-breakpoint-commands-in-mi-mode.patch + +------------------------------------------------------------------- +Tue Oct 29 09:32:42 UTC 2019 - Tom de Vries + +- Backport 2nd part of fix for swo#23657. + [bsc#1142772, swo#23657, CVE-2019-1010180] + * gdb-dwarf-reader-reject-sections-with-invalid-sizes.patch + +------------------------------------------------------------------- +Mon Oct 14 17:52:55 UTC 2019 - matz@suse.com + +- Add gdb-s390-handle-arch13.diff to handle most new s390 arch13 + instructions. [fate#327369, jsc#ECO-368] + +------------------------------------------------------------------- +Mon Sep 30 10:34:54 UTC 2019 - Tom de Vries + +- Add gdb-testsuite-8.3-kfail-xfail-unsupported.patch + +------------------------------------------------------------------- +Thu Sep 26 16:51:17 UTC 2019 - Tom de Vries + +- Drop ChangeLog part of patch: + * gdb-rhbz1708192-parse_macro_definition-crash.patch + * gdb-rhbz1704406-disable-style-log-output-1of3.patch + * gdb-rhbz1704406-disable-style-log-output-2of3.patch + * gdb-rhbz1704406-disable-style-log-output-3of3.patch + * gdb-rhbz1723564-gdb-crash-PYTHONMALLOC-debug.patch + * gdb-rhbz1553086-binutils-warning-loadable-section-outside-elf.patch +- Update to gdb-8.3.1. + * Drop "Testsuite: Ensure pie is disabled on some tests" part of + gdb-testsuite-pie-no-pie.patch + * Drop patches included upstream: + - gdb-7.10-swo18929.patch + - gdb-handle-vfork-in-thread-with-follow-fork-mode-child.patch + - gdb-x86_64-i386-syscall-restart-master.patch + - gdb-suppress-sigttou-when-handling-errors.patch + - gdb-fix-breakpoints-on-file-reloads-for-pie-binaries.patch + - gdb-symtab-fix-symbol-loading-performance-regression.patch +- Fix macro in comment warning + +------------------------------------------------------------------- +Wed Sep 25 14:41:32 UTC 2019 - Tom de Vries + +- Upgrade libipt from v2.0 to v2.0.1. + * Use -DBUILD_SHARED_LIBS=OFF to build libipt.a, and drop part + of v1.5-libipt-static.patch that consequentially has become + unnecessary. + +------------------------------------------------------------------- +Tue Sep 24 08:31:04 UTC 2019 - Tom de Vries + +- Sync with f30, merging 1e222a3..8bf40c6. + * gdb-rhbz1708192-parse_macro_definition-crash.patch + * gdb-rhbz1704406-disable-style-log-output-1of3.patch + * gdb-rhbz1704406-disable-style-log-output-2of3.patch + * gdb-rhbz1704406-disable-style-log-output-3of3.patch + * gdb-rhbz1723564-gdb-crash-PYTHONMALLOC-debug.patch + * gdb-rhbz1553086-binutils-warning-loadable-section-outside-elf.patch + +------------------------------------------------------------------- +Sun Sep 22 05:54:09 UTC 2019 - Tom de Vries + +- Use ldd /usr/bin/rpm instead of ls /usr/%{_lib}/ to find librpm + +------------------------------------------------------------------- +Sat Sep 14 05:45:30 UTC 2019 - Michel Normand + +- Add _constraints for PowerPC need more than 3.5GB disk space + to avoid build failure + +------------------------------------------------------------------- +Tue Sep 10 15:45:17 UTC 2019 - matz@suse.com + +- Disable use of valgrind on old s390 (31bit) distros. + +------------------------------------------------------------------- +Fri Aug 23 16:00:18 UTC 2019 - Tom de Vries + +- Enable librpm for version > librpm.so.3 [bsc#1145692]: + * Allow any librpm.so.x + * Fix unused variables in HAVE_LIBRPM code in + gdb-6.6-buildid-locate-rpm-suse.patch + * Add %build test to check for "zypper install " + message +- Implements jsc#ECO-368, the 2019 toolchain module update + +------------------------------------------------------------------- +Tue Aug 6 21:36:49 UTC 2019 - Tom de Vries + +- Master backport: + * gdb-fix-breakpoints-on-file-reloads-for-pie-binaries.patch +- Master backports testsuite: + * gdb-testsuite-i386-pkru-exp.patch + * gdb-testsuite-read1-fixes.patch + * gdb-testsuite-pie-no-pie.patch + * gdb-testsuite-add-missing-initial-prompt-read-in-multidictionary.exp.patch +- Work around bsc#1115034: + * gdb-testsuite-ada-pie.patch +- Fixes for fedora patches: + * gdb-testsuite-fix-perror-in-gdb.opt-fortran-string.exp.patch + * gdb-testsuite-avoid-pagination-in-attach-32.exp.patch + +------------------------------------------------------------------- +Thu Jul 25 21:46:56 UTC 2019 - Stefan Brüns + +- Remove some conditionals for SLE-10 (build is disabled/unresolvable). +- BuildRequire makeinfo instead of full texinfo (requiring texlive) + where available (SLE >= 12). + +------------------------------------------------------------------- +Mon Jul 22 16:58:16 UTC 2019 - Tom de Vries + +- Add Wno-error=odr to work around swo#24835 +- Add BuildRequires xz-devel + +------------------------------------------------------------------- +Wed Jul 3 11:38:05 UTC 2019 - Tom de Vries + +- Add BuildRequires valgrind for make check + +------------------------------------------------------------------- +Wed Jul 3 11:02:06 UTC 2019 - Tom de Vries + +- Move BuildRequires gcc-go and fpc to %{with testsuite} portion + +------------------------------------------------------------------- +Wed Jul 3 10:53:05 UTC 2019 - Tom de Vries + +- Copy %ada_arch from gcc9 and use it to fix 'unresolvable: nothing + provides gcc-ada' for openSUSE_Leap_42.3_Ports/SLE-12 ppc64le. + +------------------------------------------------------------------- +Wed Jul 3 08:37:30 UTC 2019 - Tom de Vries + +- Drop ppc64le for fpc + +------------------------------------------------------------------- +Wed Jul 3 08:27:11 UTC 2019 - Tom de Vries + +- Add missing %endif + +------------------------------------------------------------------- +Wed Jul 3 08:15:33 UTC 2019 - Tom de Vries + +- Add BuildRequire fpc for make check + +------------------------------------------------------------------- +Wed Jul 3 06:47:49 UTC 2019 - Tom de Vries + +- Add comment explaining why guile support has been disabled for + newer distro versions. + +------------------------------------------------------------------- +Tue Jul 2 17:46:53 UTC 2019 - Tom de Vries + +- Add BuildRequire gcc-go to get gccgo command for make check + +------------------------------------------------------------------- +Tue Jul 2 13:48:51 UTC 2019 - Tom de Vries + +- Copy gdbinit from fedora master @ 25caf28. Add + gdbinit.without-python, and use it for --without=python. + +------------------------------------------------------------------- +Mon Jul 1 06:28:27 UTC 2019 - Tom de Vries + +- Remove unused code: gdbtui support + +------------------------------------------------------------------- +Mon Jun 24 07:00:28 UTC 2019 - Tom de Vries + +- Add comments to "patches to upstream" specifying when they can be + dropped. + +------------------------------------------------------------------- +Thu Jun 20 15:19:35 UTC 2019 - Tom de Vries + +- Remove -Wno-implicit-fallthrough, -Wno-error=cast-function-type + and -Wno-error=stringop-truncation + +------------------------------------------------------------------- +Wed Jun 19 06:54:23 UTC 2019 - Tom de Vries + +- Remove gdb-fix-buf-overflow.diff, which is a workaround for + swo#24698, which has been fixed since gdb 7.12. + +------------------------------------------------------------------- +Fri Jun 14 11:39:56 UTC 2019 - Tom de Vries + +- Fix rpmlint macro-in-comment errors + +------------------------------------------------------------------- +Fri Jun 14 11:27:41 UTC 2019 - Tom de Vries + +- Fix rpmlint error "deprecated-grep ['egrep']" . + +------------------------------------------------------------------- +Fri Jun 14 11:22:54 UTC 2019 - Tom de Vries + +- gdb-gcore-bash.patch: Fix rpmlint error env-script-interpreter by + replacing "/usr/bin/env bash" with "/bin/bash" in gcore. + +------------------------------------------------------------------- +Thu Jun 13 17:51:04 UTC 2019 - Tom de Vries + +- Rewrite gdbserver.1 workaround for riscv64 to avoid + %define _unpackaged_files_terminate_build 0 + +------------------------------------------------------------------- +Wed Jun 5 09:53:09 UTC 2019 - Andreas Schwab + +- gdb-suppress-sigttou-when-handling-errors.patch: Suppress SIGTTOU when + handling errors +- Enable ada tests on ppc64le and riscv64 +- Enable multitarget build on riscv64 +- Add ia64 and riscv64 to target_list +- Enable -Werror on riscv64 and aarch64 +- Don't remove %{buildroot} + +------------------------------------------------------------------- +Wed May 22 16:01:13 UTC 2019 - Tom de Vries + +- Remove gdb-gcc9-fix-build-with-latest-GCC-9.0-tree.patch and + gdb-gcc9-warning-on-elf32-arm.c-elf32_arm_final_link.patch, which are + already present in 8.3. + +------------------------------------------------------------------- +Wed May 22 08:44:01 UTC 2019 - Martin Liška + +- Add gdb-gcc9-fix-build-with-latest-GCC-9.0-tree.patch and + gdb-gcc9-warning-on-elf32-arm.c-elf32_arm_final_link.patch + in order to fix build with GCC9. + +------------------------------------------------------------------- +Tue May 21 13:32:17 UTC 2019 - Tom de Vries + +- Replace fedora patch gdb-x86_64-i386-syscall-restart.patch with + master backport gdb-x86_64-i386-syscall-restart-master.patch + +------------------------------------------------------------------- +Fri May 17 16:04:43 UTC 2019 - Tom de Vries + +- Work around riscv64 build error: gdbserver.1 is installed, but not + packaged + +------------------------------------------------------------------- +Thu May 16 15:12:24 UTC 2019 - Tom de Vries + +- Don't expect gdbserver for riscv64 + +------------------------------------------------------------------- +Thu May 16 13:00:08 UTC 2019 - Tom de Vries + +- Add gdb-fix-riscv-tdep.patch to fix RISC-V build breaker + +------------------------------------------------------------------- +Thu May 16 10:42:34 UTC 2019 - Tom de Vries + +- Rebase to 8.3 release (as in fedora 30 @ 1e222a3). + * DWARF index cache: GDB can now automatically save indices of DWARF + symbols on disk to speed up further loading of the same binaries. + * Ada task switching is now supported on aarch64-elf targets when + debugging a program using the Ravenscar Profile. + * Terminal styling is now available for the CLI and the TUI. + * Removed support for old demangling styles arm, edg, gnu, hp and + lucid. + * Support for new native configuration RISC-V GNU/Linux (riscv*-*-linux*). +- Obsoleted fedora patches dropped: + * gdb-6.3-ppc64syscall-20040622.patch + * gdb-6.3-ppc64displaysymbol-20041124.patch + * gdb-6.3-readnever-20050907.patch + * gdb-6.5-bz203661-emit-relocs.patch + * gdb-6.8-sparc64-silence-memcpy-check.patch + * gdb-6.8-watchpoint-conditionals-test.patch + * gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch + * gdb-python-gil.patch + * gdb-rhbz881849-ipv6-1of3.patch + * gdb-rhbz881849-ipv6-2of3.patch + * gdb-rhbz881849-ipv6-3of3.patch + * gdb-rhbz1187581-power8-regs-1of7.patch + * gdb-rhbz1187581-power8-regs-2of7.patch + * gdb-rhbz1187581-power8-regs-3of7.patch + * gdb-rhbz1187581-power8-regs-4of7.patch + * gdb-rhbz1187581-power8-regs-5of7.patch + * gdb-rhbz1187581-power8-regs-6of7.patch + * gdb-rhbz1187581-power8-regs-7of7.patch + * gdb-rhbz1491128-batch-mode-exit-status-1of2.patch + * gdb-rhbz1491128-batch-mode-exit-status-2of2.patch + * gdb-use-pulongest-aarch64-linux-tdep.patch + * gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-1of5.patch + * gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-2of5.patch + * gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-3of5.patch + * gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-4of5.patch + * gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-5of5.patch +- Fedora patches added: + * gdb-rhbz795424-bitpos-arrayview.patch + * gdb-rhbz1371380-gcore-elf-headers.patch +- Obsoleted patched dropped: + * gdb-fix-crash-when-reading-core.patch + * power8-registers.diff + * gdb-fix-multidictionary.exp-for-gdb-8.2.patch +- Backport from master: + * gdb-handle-vfork-in-thread-with-follow-fork-mode-child.patch + [swo#gdb/24454] +- Added patches proposed for master: + * gdb-fix-heap-use-after-free-in-typename-concat.patch + [swo#24094] + * gdb-symtab-fix-symbol-loading-performance-regression.patch + [swo#24545] + +------------------------------------------------------------------- +Wed May 15 07:34:51 UTC 2019 - Tom de Vries + +- Add BuildRequires mpfr-devel + +------------------------------------------------------------------- +Thu Jan 24 10:13:33 UTC 2019 - tdevries@suse.com + +- Backport upstream fix for assertion failure + `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' + [swo#23712, rh#1560010] + patches: + gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-1of5.patch + gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-2of5.patch + gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-3of5.patch + gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-4of5.patch + gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-5of5.patch + * Add patches from fedora 29 @ 4513f72 + * Add gdb-fix-multidictionary.exp-for-gdb-8.2.patch to fix + multidictionary.exp test-case + +------------------------------------------------------------------- +Thu Dec 6 14:49:34 UTC 2018 - matz@suse.com + +- Add power8-registers.diff for implementing access to + more POWER8 registers. [fate#326120, fate#325178] + +------------------------------------------------------------------- +Mon Nov 12 13:26:01 UTC 2018 - tdevries@suse.com + +- Run tests with -fno-PIE/-no-pie and -fPIE/-pie. + +------------------------------------------------------------------- +Wed Nov 7 15:04:28 UTC 2018 - tdevries@suse.com + +- Fix crash when reading core [bsc #1109013] + * Add gdb-fix-crash-when-reading-core.patch + https://sourceware.org/ml/gdb-cvs/2018-11/msg00022.html + +------------------------------------------------------------------- +Tue Sep 11 15:01:59 UTC 2018 - matz@suse.com + +- Rebase to 8.2 release (as in fedora 29 @ c720d998): + * Contains fix for bnc#1081527, CVE-2018-7208. + * 'symbol-file' and 'add-symbol-file' accept -o to add relative + offset to all sections + * pager accepts 'c' response to disable it for rest of command + * accept _Alignof and alignof in C resp. C++ expressions + * new target riscv*-*-elf + * python API extensions: gdb.Type.align, gdb.execute deals + with multi-line gdb commands, gdb.convenience_variable and + gdb.set_convenience_variable to access convenience variables, + * aarch64: properly support hardware watchpoints on unaligned + addresses (needs kernel >= 4.10) +- Add gdb-fix-s390-build.diff for a Wformat error on s390. +- Support access to new POWER8 registers [fate#325178, fate#326120] + Add patches gdb-rhbz1187581-power8-regs-1of7.patch, + gdb-rhbz1187581-power8-regs-2of7.patch, + gdb-rhbz1187581-power8-regs-3of7.patch, + gdb-rhbz1187581-power8-regs-4of7.patch, + gdb-rhbz1187581-power8-regs-5of7.patch, + gdb-rhbz1187581-power8-regs-6of7.patch, + gdb-rhbz1187581-power8-regs-7of7.patch . +- Support ipv6 for gdbserver connections: + Add patches gdb-rhbz881849-ipv6-1of3.patch, + gdb-rhbz881849-ipv6-2of3.patch, + gdb-rhbz881849-ipv6-3of3.patch . +- Update to intel processor trace library 2.0 (from 1.6.1): + Add v2.0.tar.gz, remove v1.6.1.tar.gz + Remove obsolete v1.6.1-implicit-fallthrough.patch . +- Remove obsolete patches: + gdb-fix-python37-breakage.patch, + gdb-pahole-python2.patch . +- Added patches from Fedora: + gdb-rhbz1491128-batch-mode-exit-status-1of2.patch, + gdb-rhbz1491128-batch-mode-exit-status-2of2.patch, + gdb-rhbz1553104-s390x-arch12-test.patch, + gdb-use-pulongest-aarch64-linux-tdep.patch . +- Removed obsolete patches from Fedora: + gdb-6.6-bz235197-fork-detach-info.patch, + gdb-6.8-attach-signalled-detach-stopped.patch, + gdb-gdb-add-index-script.patch, + gdb-ppc64-stwux-tautological-compare.patch, + gdb-rhbz1540559-gdbaddindex-glibcdebug-regression.patch, + gdb-stale-frame_info.patch . +- Most other patches rebased. + +------------------------------------------------------------------- +Fri Aug 10 08:58:06 UTC 2018 - tchvatal@suse.com + +- Apply patch from fedora to build with python3.7: + * gdb-fix-python37-breakage.patch + +------------------------------------------------------------------- +Tue Mar 27 14:01:27 UTC 2018 - matz@suse.com + +- Add some -Wno-error flags for gcc-8 compatibility. + +------------------------------------------------------------------- +Fri Mar 9 16:27:10 UTC 2018 - matz@suse.com + +- Rebase to 8.1 release: + * Contains fix for bnc#1068950, CVE-2017-16829. + * ptype/o prints offsets and sizes of members (like pahole) + * tab-completion improved: quoting function names is not generally + necessary anymore, completion offers for breakpoint don't include + data symbol + * enable/disable breakpoints now accept ranges: 'disable 1.3-5' + * new commands: + - set/show cwd: working directory of debuggee + - set/show compile-gcc: program to use for 'compile' command + - starti: start program and stop at first instruction + - TUI single-key commands: 'i' for stepi and 'o' for nexti + * --readnever option disables any reading of debug info (for dumping) + * s390: guarded storage register access for z14 + * gcore option -a dumps all memory mapping + * C++ breakpoints: 'b foo' will now set a breakpoint on all functions + and methods named 'foo' no matter the scope. Use -qualified if you + don't want that + * python scripting: new events gdb.new_inferior, gdb.inferior_deleted + and gdb.new_thread; new command rbreak (breakpoint accepting regexps) + * gdbserver can be passed environment parameters to remote debuggee +- Added patches from Fedora: + gdb-ppc64-stwux-tautological-compare.patch + gdb-rhbz1540559-gdbaddindex-glibcdebug-regression.patch + gdb-vla-intel-fix-print-char-array.patch +- Removed unused gdb-libstdc++-v3-python-7.1.1-20170526.tar.bz2 +- Removed obsolete upstream patches: + gdb-s390x-1b63490.patch + gdb-s390x-289e23a.patch + gdb-s390x-8fe09d7.patch + gdb-s390x-96235dc.patch + gdb-s390x-ad33963.patch +- Removed obsolete Fedora patches: + gdb-6.3-rh-dummykfail-20041202.patch + gdb-6.6-threads-static-test.patch + gdb-add-index-chmod.patch + gdb-glibc-vdso-workaround.patch + gdb-rhbz1420304-s390x-01of35.patch + gdb-rhbz1420304-s390x-02of35.patch + gdb-rhbz1420304-s390x-03of35.patch + gdb-rhbz1420304-s390x-04of35.patch + gdb-rhbz1420304-s390x-05of35.patch + gdb-rhbz1420304-s390x-06of35.patch + gdb-rhbz1420304-s390x-07of35.patch + gdb-rhbz1420304-s390x-08of35.patch + gdb-rhbz1420304-s390x-09of35.patch + gdb-rhbz1420304-s390x-10of35.patch + gdb-rhbz1420304-s390x-11of35.patch + gdb-rhbz1420304-s390x-12of35.patch + gdb-rhbz1420304-s390x-13of35.patch + gdb-rhbz1420304-s390x-14of35.patch + gdb-rhbz1420304-s390x-15of35.patch + gdb-rhbz1420304-s390x-16of35.patch + gdb-rhbz1420304-s390x-17of35.patch + gdb-rhbz1420304-s390x-18of35.patch + gdb-rhbz1420304-s390x-19of35.patch + gdb-rhbz1420304-s390x-20of35.patch + gdb-rhbz1420304-s390x-21of35.patch + gdb-rhbz1420304-s390x-22of35.patch + gdb-rhbz1420304-s390x-23of35.patch + gdb-rhbz1420304-s390x-24of35.patch + gdb-rhbz1420304-s390x-25of35.patch + gdb-rhbz1420304-s390x-26of35.patch + gdb-rhbz1420304-s390x-27of35.patch + gdb-rhbz1420304-s390x-28of35.patch + gdb-rhbz1420304-s390x-29of35.patch + gdb-rhbz1420304-s390x-30of35.patch + gdb-rhbz1420304-s390x-31of35.patch + gdb-rhbz1420304-s390x-32of35.patch + gdb-rhbz1420304-s390x-33of35.patch + gdb-rhbz1420304-s390x-34of35.patch + gdb-rhbz1420304-s390x-35of35.patch + gdb-tls-1of2.patch + gdb-tls-2of2.patch + gdb-upstream.patch + +------------------------------------------------------------------- +Wed Nov 15 08:54:04 UTC 2017 - schwab@suse.de + +- Support --without=testsuite and disable testsuite for qemu-linux-user + builds + +------------------------------------------------------------------- +Wed Oct 25 12:14:54 UTC 2017 - jmatejek@suse.com + +- switch to Python 3 for Tumbleweed 1320 and up + +------------------------------------------------------------------- +Mon Oct 9 12:43:07 UTC 2017 - matz@suse.com + +- Remove %clean section. + +------------------------------------------------------------------- +Wed Oct 4 11:20:39 UTC 2017 - matz@suse.com + +- Link gdb against a bundled libipt (processor trace + library) on x86_64 and i686 for improved tracing support + on Intel CPUs. [bnc#985550] + Adds v1.6.1.tar.gz and patches + v1.5-libipt-static.patch and v1.6.1-implicit-fallthrough.patch. + +------------------------------------------------------------------- +Mon Oct 2 14:49:04 UTC 2017 - matz@suse.com + +- Rebase to 8.0.1 release (fixing PR21886, PR22046) +- Updated libstdc++ pretty printers to +- Replace gdb-libstdc++-v3-python-6.3.1-20170212.tar.bz2 with + gdb-libstdc++-v3-python-7.1.1-20170526.tar.bz2 . +- Add patches for s390x z14 feates [fate #321514, fate #322272] + gdb-s390x-1b63490.patch + gdb-s390x-289e23a.patch + gdb-s390x-8fe09d7.patch + gdb-s390x-96235dc.patch + gdb-s390x-ad33963.patch +- Adjust some patches: + gdb-ppc-power7-test.patch + gdb-rhbz795424-bitpos-20of25.patch + gdb-rhbz795424-bitpos-21of25.patch + gdb-vla-intel-fortran-vla-strings.patch +- Add some patches from Fedora: + gdb-rhbz1420304-s390x-01of35.patch + gdb-rhbz1420304-s390x-02of35.patch + gdb-rhbz1420304-s390x-03of35.patch + gdb-rhbz1420304-s390x-04of35.patch + gdb-rhbz1420304-s390x-05of35.patch + gdb-rhbz1420304-s390x-06of35.patch + gdb-rhbz1420304-s390x-07of35.patch + gdb-rhbz1420304-s390x-08of35.patch + gdb-rhbz1420304-s390x-09of35.patch + gdb-rhbz1420304-s390x-10of35.patch + gdb-rhbz1420304-s390x-11of35.patch + gdb-rhbz1420304-s390x-12of35.patch + gdb-rhbz1420304-s390x-13of35.patch + gdb-rhbz1420304-s390x-14of35.patch + gdb-rhbz1420304-s390x-15of35.patch + gdb-rhbz1420304-s390x-16of35.patch + gdb-rhbz1420304-s390x-17of35.patch + gdb-rhbz1420304-s390x-18of35.patch + gdb-rhbz1420304-s390x-19of35.patch + gdb-rhbz1420304-s390x-20of35.patch + gdb-rhbz1420304-s390x-21of35.patch + gdb-rhbz1420304-s390x-22of35.patch + gdb-rhbz1420304-s390x-23of35.patch + gdb-rhbz1420304-s390x-24of35.patch + gdb-rhbz1420304-s390x-25of35.patch + gdb-rhbz1420304-s390x-26of35.patch + gdb-rhbz1420304-s390x-27of35.patch + gdb-rhbz1420304-s390x-28of35.patch + gdb-rhbz1420304-s390x-29of35.patch + gdb-rhbz1420304-s390x-30of35.patch + gdb-rhbz1420304-s390x-31of35.patch + gdb-rhbz1420304-s390x-32of35.patch + gdb-rhbz1420304-s390x-33of35.patch + gdb-rhbz1420304-s390x-34of35.patch + gdb-rhbz1420304-s390x-35of35.patch + gdb-upstream.patch + +------------------------------------------------------------------- +Wed Sep 13 14:09:26 UTC 2017 - matz@suse.com + +- Disable guile extensions for new distros, the gdb support + is incompatible with guile 2.2. + +------------------------------------------------------------------- +Tue Jun 6 14:37:05 UTC 2017 - matz@suse.com + +- Rebase to gdb 8.0 release: [fate #319573] + * support for DWARF5 (except its .debug_names) + * support C++11 rvalue references + * support PKU register (memory protection keys on future Intel CPUs) + * python scripting: + - start, stop and access running btrace + - rvalue references in gdb.Type + * record/replay x86_64 rdrand and rdseed + * removed support for GCJ compiled java programs + * user commands accept more than 10 arguments + * "eval" expands user-defined command arguments + * new options: + set/show disassembler-options (on arm, ppc s390) +- Removed obsoleted patches: + gdb-release-werror.patch + +------------------------------------------------------------------- +Thu Apr 27 14:39:44 UTC 2017 - matz@suse.com + +- Rebase to gdb 7.99.90 (prerelease of gdb 8) [fate #319573] +- Updated libstdc++ pretty printers to + gdb-libstdc++-v3-python-6.3.1-20170212.tar.bz2. +- Added patches from fedora: + gdb-release-werror.patch + gdb-rhbz1398387-tab-crash-test.patch +- Removed obsoleted patches: + gdb-6.7-bz426600-DW_TAG_interface_type-test.patch + gdb-bison-old.patch + gdb-testsuite-casts.patch + gdb-testsuite-m-static.patch + gdb-upstream.patch + gdb-testsuite-morestack-gold.patch + gdb-fix-bnc-994537.diff + gdb-libiberty-demangler-fuzz.diff + +------------------------------------------------------------------- +Mon Apr 3 12:48:42 UTC 2017 - rguenther@suse.com + +- Fix rpm condition to allow build on SLE10. +- Do not require glibc-devel-static-32bit on SLE12 which is not available + there. + +------------------------------------------------------------------- +Wed Feb 15 15:55:11 UTC 2017 - matz@suse.com + +- Update to gdb 7.12.1 + * negative repeat count for x examines backwards + * fortran: support structs/arrays with dynamically types fields + * support MPX bound checking + * support for the Rust language + * 'catch syscall' now can catch groups of related syscalls + * New (sub)commands: + - skip {-file,-gfile,-function,-rfunction}: generic skip + mechanism + - maint {selftest,info line-table} + - new-ui: create new user interface for GUI clients + * (fast) tracepoints on s390x and ppc64le added to gdbserver + * New target Andes NDS32 +- Add rpmlint exception for historic libinproctrace place +- Remove obsolete patches: + gdb-aarch64-v81-hwbreakpoints.diff + gdb-bare-DW_TAG_lexical_block-1of2.patch + gdb-bare-DW_TAG_lexical_block-2of2.patch + gdb-fortran-stride-intel-1of6.patch + gdb-fortran-stride-intel-2of6.patch + gdb-fortran-stride-intel-3of6.patch + gdb-fortran-stride-intel-4of6.patch + gdb-fortran-stride-intel-5of6.patch + gdb-fortran-stride-intel-6of6-nokfail.patch + gdb-fortran-stride-intel-6of6.patch + gdb-testsuite-dw2-undefined-ret-addr.patch + gdb-vla-intel-04of23-fix.patch + gdb-vla-intel-logical-not.patch + gdb-vla-intel.patch +- Add patches from Fedora package: + gdb-6.7-testsuite-stable-results.patch + gdb-add-index-chmod.patch + gdb-bison-old.patch + gdb-container-rh-pkg.patch + gdb-libexec-add-index.patch + gdb-linux_perf-bundle.patch + gdb-physname-pr11734-test.patch + gdb-physname-pr12273-test.patch + gdb-rhbz1007614-memleak-infpy_read_memory-test.patch + gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch + gdb-rhbz1149205-catch-syscall-after-fork-test.patch + gdb-rhbz1156192-recursive-dlopen-test.patch + gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch + gdb-rhbz1350436-type-printers-error.patch + gdb-test-ivy-bridge.patch + gdb-testsuite-casts.patch + gdb-testsuite-m-static.patch + gdb-testsuite-morestack-gold.patch + gdb-tls-1of2.patch + gdb-tls-2of2.patch + gdb-upstream.patch + gdb-vla-intel-fortran-strides.patch + gdb-vla-intel-fortran-vla-strings.patch + gdb-vla-intel-tests.patch + +------------------------------------------------------------------- +Mon Jan 9 15:37:41 UTC 2017 - matz@suse.com + +- Disable 32bit testing on openSUSE s390x. + +------------------------------------------------------------------- +Fri Dec 16 09:55:50 UTC 2016 - mliska@suse.cz + +- Make dependency of gcc-java conditional. + +------------------------------------------------------------------- +Sat Dec 3 10:27:31 UTC 2016 - schwab@suse.de + +- Enable ada testing on aarch64 for tumbleweed + +------------------------------------------------------------------- +Mon Nov 21 11:17:58 UTC 2016 - schwab@suse.de + +- BuildRequire glibc-devel-static for 12.1 or later, and + glibc-devel-static-32bit if biarch + +------------------------------------------------------------------- +Thu Aug 25 14:29:44 UTC 2016 - matz@suse.com + +- Add gdb-fix-bnc-994537.diff for ppc64le, fixing + two testcases. [bnc#994537] +- Add gdb-libiberty-demangler-fuzz.diff for fixing infinite + recursion in demangler. [bnc#987637] + +------------------------------------------------------------------- +Mon Aug 8 15:34:57 UTC 2016 - matz@suse.com + +- Amend gdb-glibc-vdso-workaround.patch to ignore further + vdso filenames on ppc64 and s390x. [bnc#944105] + +------------------------------------------------------------------- +Wed Aug 3 14:38:49 UTC 2016 - matz@suse.com + +- Add gdb-aarch64-v81-hwbreakpoints.diff for detecting + debug capabilities on ARMv8.1/8.2. [bnc#990697] + +------------------------------------------------------------------- +Mon Jun 20 16:36:04 UTC 2016 - matz@suse.com + +- Rebase to gdb 7.11.1: minor bug fixes. +- Remove gdb-gcc6-Wparentheses-warning.patch (applied upstream). +- Add some patches from Fedora F24: + gdb-bare-DW_TAG_lexical_block-1of2.patch + gdb-bare-DW_TAG_lexical_block-2of2.patch + gdb-bz1219747-attach-kills.patch + gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch + gdb-rhbz1325795-framefilters-test.patch + gdb-testsuite-dw2-undefined-ret-addr.patch + +------------------------------------------------------------------- +Tue May 24 10:49:47 UTC 2016 - martin.liska@suse.com + +- Add gdb-gcc6-Wparentheses-warning.patch to fix Werrors reported by GCC6. + +------------------------------------------------------------------- +Mon Apr 25 07:23:34 UTC 2016 - rguenther@suse.com + + [diverging changelog entry from SLE tree vs devel:gcc tree: + +- Add gdb-7.9-bnc976404.patch to fix thread support on s390x. [bnc #976404] + [bnc #970589] +- Add gdb-7.9-swo18929.patch to fix crash printing values. [bnc#971556] + ] +- Removed gdb-7.9-bnc976404.patch when updating to devel:gcc tree. +- Replaced gdb-7.9-swo18929.patch with gdb-7.10-swo18929.patch as well. + +------------------------------------------------------------------- +Thu Apr 7 09:56:22 UTC 2016 - normand@linux.vnet.ibm.com + +- update gdb-orphanripper.c from last fedora changes of 2013 + http://pkgs.fedoraproject.org/cgit/rpms/gdb.git/log/gdb-orphanripper.c + may be solution to transient build hung on Rings:1 ppc64le + tracked by bug boo#974419 + +------------------------------------------------------------------- +Mon Mar 21 09:02:11 UTC 2016 - rguenther@suse.com + +- Add gdb-7.10-swo18929.patch to fix crash printing values. [bnc#971556] + [swo#18929] + +------------------------------------------------------------------- +Mon Feb 29 18:50:39 UTC 2016 - matz@suse.de + +- Rebase to gdb version 7.11 as of version in Fedora 24: + * Per-inferior thread numbers. + * Breakpoint "explicit locations" (via CLI and GDB/MI). + * New convenience variables ($_gthread, $_inferior). + * Record btrace now supports non-stop mode. + * Various improvements on AArch64 GNU/Linux: + - Multi-architecture debugging support. + - displaced stepping. + - tracepoint support added in GDBserver. + * In Ada, the overloads selection menu provides the parameter + types and return types for the matching overloaded subprograms. + * Various remote protocol improvements, including several + new packets which can be used to support features such as + follow-exec-mode, exec catchpoints, syscall catchpoints, etc. + * Some minor improvements in the Python API for extending GDB. +- Added local patch gdb-fix-buf-overflow.diff. +- Added new patches from Fedora: + gdb-fedora-libncursesw.patch + gdb-fortran-stride-intel-1of6.patch + gdb-fortran-stride-intel-2of6.patch + gdb-fortran-stride-intel-3of6.patch + gdb-fortran-stride-intel-4of6.patch + gdb-fortran-stride-intel-5of6.patch + gdb-fortran-stride-intel-6of6-nokfail.patch + gdb-fortran-stride-intel-6of6.patch + gdb-opcodes-clflushopt-test.patch + gdb-testsuite-readline63-sigint.patch +- Removed obsolete patches: + gdb-6.3-bz231832-obstack-2gb.patch + gdb-probes-based-interface-robust-1of2.patch + gdb-probes-based-interface-robust-2of2.patch + gdb-rhbz1260558-ppc64le-skip_trampoline_code.patch + gdb-rhbz1270564-invalid-dwarf-regno.patch + gdb-rhel5-compat.patch +- Really disable problematic testcases. + +------------------------------------------------------------------- +Mon Jan 18 14:49:12 UTC 2016 - matz@suse.de + +- Disable guile support for SLE10. + +------------------------------------------------------------------- +Thu Jan 14 16:46:43 UTC 2016 - matz@suse.de + +- Rebase to gdb version 7.10.1 as of version in Fedora 23: + * reverse debugging on aarch64 + * new commands or subcommands: + - info os cpu, set/show serial parity, info dll + - maint print symbol-cache/symbol-cache-statistics, + maint flush-symbol-cache + - record btrace bts, record bts + - compile print + - show/set mpx bound + - tui enable/disable + - record btrace pt, record pt + - maint info btrace, + maint btrace packet-history/clear-packet-history/clear + * s390 support for vector ABI + * "set sysroot" improvements related to remote targets + * better support for debugging containerized programs + (without "set sysroot") + * HISTSIZE environment variable is replaced by GDBHISTSIZE + * python scripting: + - it's possible to write frame unwinders + - several new methods in Objfile, Type and Value classes + - gdb can auto-load scripts contained in special sections + named '.debug_gdb_scripts'. + * extensions for the MI interface, new remote packet types +- Removed obsolete patches: + 0001-S390-Add-target-descriptions-for-vector-register-set.patch + 0001-S390-Fix-compiler-invocation-with-compile-command.patch + 0001-S390-Support-new-vector-register-sections.patch + 0002-S390-Add-vector-register-support-to-gdb.patch + 0003-S390-Add-vector-register-support-to-gdbserver.patch + 0004-S390-Vector-register-test-case.patch + 0005-S390-Name-invisible-registers-with-the-empty-string-.patch + gdb-6.5-bz190810-gdbserver-arch-advice.patch + gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch + gdb-6.8-bz457187-largefile-test.patch + gdb-enable-count-crash.patch + gdb-libstdc++-v3-python-r155978.tar.bz2 + gdb-no-dg-extract-results-py.patch + gdb-python3-py_hash_t-32bit.patch + gdb-python3-testsuite.patch + gdb-s390-reorder-arch.diff + gdb-upstream.patch +- Added new patches from Fedora: + gdb-pahole-python2.patch + gdb-probes-based-interface-robust-1of2.patch + gdb-probes-based-interface-robust-2of2.patch + gdb-rhbz1260558-ppc64le-skip_trampoline_code.patch + gdb-rhbz1270564-invalid-dwarf-regno.patch + +------------------------------------------------------------------- +Fri Aug 14 13:39:13 UTC 2015 - matz@suse.de + +- Add missing patches from binutils for z13 support. [bnc #936050] + +------------------------------------------------------------------- +Fri Jul 10 13:49:28 UTC 2015 - matz@suse.de + +- Rebase to gdb version 7.9.1: + fixes PR python/18299, python/18285. +- Add gdb-s390-reorder-arch.diff [bnc #936050] +- Added patches for fate#318039, s390 z13 support: + 0001-S390-Fix-compiler-invocation-with-compile-command.patch + 0001-S390-Support-new-vector-register-sections.patch + 0001-S390-Add-target-descriptions-for-vector-register-set.patch + 0002-S390-Add-vector-register-support-to-gdb.patch + 0003-S390-Add-vector-register-support-to-gdbserver.patch + 0004-S390-Vector-register-test-case.patch + 0005-S390-Name-invisible-registers-with-the-empty-string-.patch +- Remove now obsolete SLE12-only patches: + gdb-7.7-bnc896586.patch, gdb-7.7-bnc895831.patch, + gdb-7.7-bnc891040-1.patch, gdb-7.7-bnc891040-2.patch, + gdb-7.7-bnc891040-3.patch, gdb-7.7-bnc891040-4.patch, + gdb-7.7-bnc891040-5.patch + +------------------------------------------------------------------- +Thu Jul 2 13:26:29 UTC 2015 - rguenther@suse.com + +- Remove auto-loading non-existent /etc/gdbinit.d/gdb-heap.py + from /etc/gdbinit + +------------------------------------------------------------------- +Mon Jun 29 07:27:44 UTC 2015 - schwab@suse.de + +- Add guile-devel to enable Scheme scripting support +- Run ada tests also on ppc64 and s390 + +------------------------------------------------------------------- +Tue Mar 3 11:42:10 UTC 2015 - schwab@suse.de + +- Build multi-target also on aarch64 + +------------------------------------------------------------------- +Fri Feb 27 11:10:19 UTC 2015 - rguenther@suse.com + +- Strip date and runtimes from gdb-testsuite contents. + +------------------------------------------------------------------- +Wed Feb 25 13:08:27 UTC 2015 - rguenther@suse.com + +- Use patchlist.pl to merge with gdb-7.9-10.fc22, a rebase to FSF GDB 7.9. + The GDB 7.8 features are: + * Python Scripting + - You can now access frame registers from Python scripts. + - New attribute 'producer' for gdb.Symtab objects. + * New Python-based convenience functions: + - $_caller_is(name [, number_of_frames]) + - $_caller_matches(regexp [, number_of_frames]) + - $_any_caller_is(name [, number_of_frames]) + - $_any_caller_matches(regexp [, number_of_frames]) + * New commands + - queue-signal signal-name-or-number + Queue a signal to be delivered to the thread when it is resumed. + * On resume, GDB now always passes the signal the program had stopped + for to the thread the signal was sent to, even if the user changed + threads before resuming. Previously GDB would often (but not + always) deliver the signal to the thread that happens to be current + at resume time. + * Conversely, the "signal" command now consistently delivers the + requested signal to the current thread. GDB now asks for + confirmation if the program had stopped for a signal and the user + switched threads meanwhile. + * "breakpoint always-inserted" modes "off" and "auto" merged. + Now, when 'breakpoint always-inserted mode' is set to "off", GDB + won't remove breakpoints from the target until all threads stop, + even in non-stop mode. The "auto" mode has been removed, and "off" + is now the default mode. + * MI changes + - The -list-thread-groups command outputs an exit-code field for + inferiors that have exited. +- removed (upstream) gdb-async-stopped-on-pid-arg-1of2.patch, + gdb-async-stopped-on-pid-arg-testsuite.patch, + gdb-python-completer-1of2.patch, gdb-python-completer-2of2.patch + and gdb-readline-6.3.5.patch +- added gdb-jit-reader-multilib.patch, gdb-no-dg-extract-results-py.patch, + gdb-python-gil.patch, gdb-python3-py_hash_t-32bit.patch, + gdb-python3-testsuite.patch and gdb-vla-intel-logical-not.patch + +------------------------------------------------------------------- +Mon Dec 15 07:33:31 UTC 2014 - cshorler@googlemail.com + +- Update for GDB 7.8.1 + * removed (already in upstream): + gdb-babeltrace-configure.patch + gdb-async-stopped-on-pid-arg-2of2.patch + * amended (partially in upstream): + gdb-archer.patch + gdb-attach-fail-reasons-5of5.patch + gdb-async-stopped-on-pid-arg-1of2.patch + gdb-async-stopped-on-pid-arg-testsuite.patch + +------------------------------------------------------------------- +Fri Oct 10 10:01:27 UTC 2014 - hrvoje.senjan@gmail.com + +- Added gdb-async-stopped-on-pid-arg-1of2.patch, + gdb-async-stopped-on-pid-arg-2of2.patch and + gdb-async-stopped-on-pid-arg-testsuite.patch to resolve + https://sourceware.org/bugzilla/show_bug.cgi?id=17347 + +------------------------------------------------------------------- +Wed Aug 13 07:54:35 UTC 2014 - rguenther@suse.com + +- Enable running the testsuite and store results in a gdb-testresults + package. +- Add gdb-rpmlintrc to filter errors about the buildroot mentioned + in testresult logs. + +------------------------------------------------------------------- +Fri Aug 8 12:22:24 UTC 2014 - rguenther@suse.com + +- Use patchlist.pl to merge with gdb-7.8-16.fc22, a rebase to FSF GDB 7.8. + The GDB 7.8 features are: + * Guile scripting support. + * Python scripting enhancements. + * New commands: + ** guile + ** guile-repl + ** info auto-load guile-scripts [REGEXP] + * New options: + ** maint ada set ignore-descriptive-types (on|off) + ** maint set target-async (on|off) + ** set|show auto-load guile-scripts (on|off) + ** set|show auto-connect-native-target + ** set|show guile print-stack (none|message|full) + ** set|show mi-async (on|off) + ** set|show print symbol-loading (off|brief|full) + ** set|show record btrace replay-memory-access (read-only|read-write) + * Remote Protocol: + ** The qXfer:btrace:read packet supports a new annex 'delta'. + * GDB/MI: + ** A new option "-gdb-set mi-async" replaces "-gdb-set target-async". + * New target configurations: + ** PowerPC64 GNU/Linux little-endian + * btrace enhancements: + ** The btrace record target now supports the 'record goto' command. + ** The btrace record target supports limited reverse execution and + replay. + * ISO C99 variable length automatic arrays support. + * It is no longer required to "set target-async on" in order to use + background execution commands (e.g., "c&", "s&", etc.). + * "catch syscall" now implemented on s390*-linux* targets. + * The "compare-sections" command now works on all targets. + * The "target native" command now connects to the native target, and + can be used to launch native programs, even if "set + auto-connect-native-target" is set to off. + * More robust backtraces. [bnc#891040] +- Obsoletes patch gdb-7.7-bnc877566.patch +- Obsoletes patch gdb-fix-s390-build.patch +- Obsoletes patch gdb-ppc64le.patch +- Drop gdb-ia64-tdep.patch, disable building the IA64 target +- Modifies gdb-6.3-test-pie-20050107.patch, + gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch, + gdb-6.6-buildid-locate-core-as-arg.patch, + gdb-6.6-buildid-locate-rpm.patch, gdb-6.6-buildid-locate.patch, + gdb-6.6-scheduler_locking-step-is-default.patch, + gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch, + gdb-6.8-attach-signalled-detach-stopped.patch, + gdb-6.8-quit-never-aborts.patch, + gdb-archer-pie-addons-keep-disabled.patch, gdb-archer-pie-addons.patch, + gdb-archer.patch, gdb-attach-fail-reasons-5of5.patch, + gdb-glibc-strstr-workaround.patch, gdb-rhbz795424-bitpos-20of25.patch, + gdb-rhbz795424-bitpos-21of25.patch, gdb-rhbz795424-bitpos-22of25.patch, + gdb-rhbz795424-bitpos-23of25.patch, gdb-rhbz795424-bitpos-25of25.patch, + gdb-upstream.patch +- Adds gdb-archer-vla-tests.patch, gdb-bz533176-fortran-omp-step.patch, + gdb-bz541866-rwatch-before-run.patch + gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch, + gdb-babeltrace-configure.patch, gdb-btrobust.patch, + gdb-dts-rhel6-python-compat.patch, gdb-fortran-frame-string.patch, + gdb-gnat-dwarf-crash-3of3.patch, gdb-python-completer-1of2.patch, + gdb-python-completer-2of2.patch, gdb-readline-6.3.5.patch, + gdb-vla-intel-04of23-fix.patch, gdb-vla-intel-stringbt-fix.patch, + gdb-vla-intel.patch +- Removes gdb-rhel5-gcc44.patch, gdb-6.6-bfd-vdso8k.patch, + gdb-testsuite-nohostid.patch, gdb-python-stacksmash.patch + +------------------------------------------------------------------- +Mon Jul 15 07:42:50 UTC 2014 - rguenther@suse.com + (was: Mon Sep 15 07:42:50 UTC 2014 - rguenther@suse.com) + +- Backport fix for gdb internal-error on register info on PPC64LE. + Addds patch gdb-7.7-bnc896586.patch. [bnc#896586] + +------------------------------------------------------------------- +Wed Jul 10 07:41:20 UTC 2014 - rguenther@suse.com + (was: Wed Sep 10 07:41:20 UTC 2014 - rguenther@suse.com) + +- Backport fix for gdbserver PPC64LE byteorder issue. [bnc#895831] + Adds patch gdb-7.7-bnc895831.patch. + +------------------------------------------------------------------- +Tue Jul 8 08:13:11 UTC 2014 - rguenther@suse.com + + (was: Tue Aug 12 08:13:11 UTC 2014 - rguenther@suse.com) + +- Backport all frame-related changes from gdb 7.8. Adds patches + gdb-7.7-bnc891040-1.patch, gdb-7.7-bnc891040-2.patch, + gdb-7.7-bnc891040-3.patch, gdb-7.7-bnc891040-4.patch, + gdb-7.7-bnc891040-5.patch [bnc#891040] + +------------------------------------------------------------------- +Thu Jun 26 14:00:26 UTC 2014 - rguenther@suse.com + +- Add baselibs.conf to sources. + +------------------------------------------------------------------- +Thu Jun 26 08:59:49 UTC 2014 - rguenther@suse.com + +- For _with_testsuite require gcc-fortran, not gcc-gfortran. + [bnc#884399] + +------------------------------------------------------------------- +Wed May 14 07:43:54 UTC 2014 - rguenther@suse.com + +- Fix debugging of threaded 31bit inferiors on s390x + (gdb-7.7-bnc877566.patch). [bnc#877566] +- Add patchlist.pl and patchname_get.sh as sources. + +------------------------------------------------------------------- +Wed Feb 12 16:24:38 UTC 2014 - matz@suse.de + +- Fix build on s390 (gdb-fix-s390-build.patch). + +------------------------------------------------------------------- +Mon Feb 10 17:19:07 UTC 2014 - matz@suse.de + +- Use patchlist.pl to merge with gdb-Fedora at + e86a0cc13a5d91ba95242690237bb77511500897. +- Don't apply patches gdb-rhel5-gcc44.patch, + gdb-6.6-buildid-locate-rpm-scl.patch, + gdb-readline62-ask-more-rh.patch, + gdb-6.8-attach-signalled-detach-stopped.patch, + gdb-6.8-quit-never-aborts.patch, + gdb-rhel5-compat.patch; retained to have same structure as fedoras + package. +- Add gdb-testsuite-nohostid.patch (from fedora). +- Remove gdb-fix-attach-signalled-detach-stopped.patch again + (as base not applied), gdb-ppc-ptrace.diff (not applied since some time). + +------------------------------------------------------------------- +Sun Feb 9 15:44:04 UTC 2014 - burnus@net-b.de + +- Merge from fedoras gdb-7.7-1.fc21, a rebase to FSF GDB 7.7. + The 7.7 features are: + * For C++, the 'typeid' operator has been added and + exception catchpoints can be filtered by type. + * Python scripting has been extended + * New commands and new command options + * New convenice variables/functions + * Some GDB/MI improvements + * Remote protocal improvments + * SystemTap SDT probes support AArch64 GNU/Linux + * Support for Fission DWP file format version 2 + * 'tsave' command supports CTF (Common Trace Format) + * New script 'gcore' +- Remove now obsolete gdb-aarch64-hw-break.patch +- Remove merged bits from gdb-ppc64le.patch +- Rediff gdb-6.6-buildid-locate-rpm-suse.patch +- Add gdb-fix-attach-signalled-detach-stopped.patch + +------------------------------------------------------------------- +Mon Dec 9 14:16:53 UTC 2013 - uweigand@de.ibm.com + +- gdb-ppc64le.patch: add support for powerpc64le-linux + +------------------------------------------------------------------- +Fri Nov 15 12:08:19 UTC 2013 - rguenther@suse.com + +- Allow librpm3 to be used + +------------------------------------------------------------------- +Thu Sep 12 16:04:25 UTC 2013 - schwab@suse.de + +- gdb-aarch64-hw-break.patch: apply last change also to gdbserver + +------------------------------------------------------------------- +Mon Aug 12 15:30:32 UTC 2013 - schwab@suse.de + +- gdb-aarch64-hw-break.patch: fix setting hardware debug registers after + fork + +------------------------------------------------------------------- +Wed Aug 7 13:27:17 UTC 2013 - matz@suse.com + +- Merge from fedoras gdb-7.6.50-20130731-cvs, of what will become 7.7 + eventually. This includes 7.6, which gave: + * new native configurations (e.g. ARM AArch64 GNU/Linux) + * new targets (e.g. ARM AArch64, Lynx 178 PowerPC, x86_64/Cygwin) + * support for the "mini debuginfo" section, .gnu_debugdata + * the C++ ABI now defaults to the GNU v3 ABI + * more Python scripting improvements + * some GDB/MI improvements + * new configure options, new commands, and options + * new remote packets + * a new "target record-btrace" has been added while the + "target record" command has been renamed to "target record-full" +- gdb-ia64-tdep.patch: build fixes +- gdb-ppc-ptrace.diff: Remove patch, not needed on new kernels + +------------------------------------------------------------------- +Tue Jul 2 12:34:27 UTC 2013 - schwab@suse.de + +- Enable multi-target support +- gdb-ia64-tdep.patch: build fixes +- Use --build when configuring +- Don't remove %buildroot in %install +- Set pkgversion and bugurl + +------------------------------------------------------------------- +Sun Mar 17 05:16:06 UTC 2013 - matz@suse.com + +- Update to 7.5.50, mostly for aarch64. + +------------------------------------------------------------------- +Mon Dec 3 14:29:15 UTC 2012 - matz@suse.com + +- Merge from gdb-7.5.1-30.fc18.src.rpm. + + 7.5.1 gives: + * An "Attempt to dereference a generic pointer" errors (-var-create). + * Backtrace problems on x32 (PR backtrace/14646). + * next/step/finish problems on x32 (PR gdb/14647). + * A "malformed linespec error: unexpected keyword, [...]" error + (PR breakpoints/14643). + * GDB crash while stepping through powerpc (32bits) code. + * A failed assertion in linux_ptrace_test_ret_to_nx. + * A "!frame_id_inlined_p (frame_id)" failed assertion. + * A "No more reverse-execution history." error during reverse + "next" execution (PR 14548). + * Incomplete command descriptions in "apropos" output. + * PR gdb/14494 (a GDB crash difficult to characterize). + + 7.5 gives: + * Go language support. + * New targets (x32 ABI, microMIPS, Renesas RL78, HP OpenVMS ia64). + * More Python scripting improvements. + * SDT (Static Defined Tracing) probes support with SystemTap probes. + * GDBserver improvements (stdio connections, target-side evaluation + of breakpoint conditions, remote protocol improvements). + * Other miscellaneous improvements (ability to stop when a shared + library is loaded/unloaded, dynamic printf, etc). + * Reverse debugging on ARM. + +------------------------------------------------------------------- +Tue Jun 19 13:58:08 UTC 2012 - rguenther@suse.com + +- Do not provide a custom (safe) auto-load dir. + +------------------------------------------------------------------- +Tue Jun 12 13:00:14 UTC 2012 - rguenther@suse.com + +- Merge from gdb-7.4.50.20120603-3.fc18.src.rpm. + + * Wed Jun 6 2012 Jan Kratochvil - 7.4.50.20120603-3.fc18 + - Disable -lmcheck in the development builds. + - Fix assertion on some files as glibc-2.15.90-8.fc18 (Doug Evans). + + * Sun Jun 3 2012 Jan Kratochvil - 7.4.50.20120603-2.fc18 + - Fix Release. + - Make yum --enablerepo compatible with at least mock-1.1.21-1.fc16 Rawhide cfg. + + * Sun Jun 3 2012 Jan Kratochvil - 7.4.50.20120602-1.fc18 + - Rebase to FSF GDB 7.4.50.20120602. + - [testsuite] BuildRequire gcc-go. + - Drop printing 2D C++ vectors as matrices which no longer worked (BZ 562763). + - Fix dejagnu-1.5-4.fc17 compatibility for Go (for BZ 635651). + - Use librpm.so.3 for rpm-4.10.0 in Fedora 18. + - Revert recent breakage of UNIX objfiles order for symbols lookup. + + * Sat Jun 2 2012 Jan Kratochvil - 7.4.50.20120120-48.fc17 + - [ppc] Fix hardware watchpoints on PowerPC (BZ 827600, Edjunior Machado). + + * Mon May 28 2012 Jan Kratochvil - 7.4.50.20120120-47.fc17 + - Workaround PR libc/14166 for inferior calls of strstr. + + * Mon May 14 2012 Jan Kratochvil - 7.4.50.20120120-46.fc17 + - [RHEL5] Workaround doc build race. + + * Mon May 14 2012 Jan Kratochvil - 7.4.50.20120120-45.fc17 + - Rename "set auto-load" patchset variable $ddir to $datadir. + + * Wed May 9 2012 Jan Kratochvil - 7.4.50.20120120-44.fc17 + - Fix in "set auto-load" patchset for SCL scripts inheritance (BZ 815910). + + * Wed Apr 25 2012 Jan Kratochvil - 7.4.50.20120120-43.fc17 + - [RHEL5] Workaround kernel for detaching SIGSTOPped processes (BZ 809382). + + * Tue Apr 24 2012 Jan Kratochvil - 7.4.50.20120120-42.fc17 + - Update "set auto-load" patchset and the --with-auto-load-safe-path setting. + - [RHEL] Disable gdb-add-index even on RHEL-6 as RHEL-6.0 had too old elfutils. + + * Wed Apr 18 2012 Jan Kratochvil - 7.4.50.20120120-41.fc17 + - [RHEL] Fix --with-auto-load-safe-path systems prior to /usr move. + + * Wed Apr 18 2012 Jan Kratochvil - 7.4.50.20120120-40.fc17 + - Security fix for loading untrusted inferiors, see "set auto-load" (BZ 756117). + + * Fri Apr 13 2012 Jan Kratochvil - 7.4.50.20120120-39.fc17 + - [RHEL7] Fix/remove readline-devel BuildRequires redundant distro suffic .fc17. + + * Wed Apr 4 2012 Jan Kratochvil - 7.4.50.20120120-38.fc17 + - Workaround crashes from stale frame_info pointer (BZ 804256). + + * Wed Apr 4 2012 Jan Kratochvil - 7.4.50.20120120-37.fc17 + - testsuite: Fix break-interp.exp expections for updated glibc (BZ 752834). + + * Wed Apr 4 2012 Jan Kratochvil - 7.4.50.20120120-36.fc17 + - [RHEL5,RHEL6] Reintroduce fix attaching to stopped processes. + + * Fri Mar 30 2012 Jan Kratochvil - 7.4.50.20120120-35.fc17 + - Fix performance regressions with .gdb_index (Tom Tromey, BZ 805274). + + * Fri Mar 30 2012 Jan Kratochvil - 7.4.50.20120120-34.fc17 + - Fixup %{_datadir}/gdb timestamps for multilib conflicts on RHELs. + + * Mon Mar 26 2012 Jan Kratochvil - 7.4.50.20120120-33.fc17 + - [vla] Fix regression on no type for subrange from IBM XLF Fortran (BZ 806920). + + * Sat Mar 17 2012 Jan Kratochvil - 7.4.50.20120120-32.fc17 + - Fix loading of core files without build-ids but with build-ids in executables. + + * Fri Mar 9 2012 Jan Kratochvil - 7.4.50.20120120-31.fc17 + - Fix an implied regression by the inferior calls fix below (BZ 799531). + + * Fri Mar 9 2012 Jan Kratochvil - 7.4.50.20120120-30.fc17 + - Fix SELinux deny_ptrace .spec build rules (BZ 786878). + + * Tue Mar 6 2012 Jan Kratochvil - 7.4.50.20120120-29.fc17 + - Fix inferior calls, particularly uncaught thrown exceptions (BZ 799531). + - Fix DWARF DIEs CU vs. section relative offsets (Joel Brobecker, me). + + * Tue Mar 6 2012 Jan Kratochvil - 7.4.50.20120120-28.fc17 + - Print reasons for failed attach/spawn incl. SELinux deny_ptrace (BZ 786878). + + * Sun Mar 4 2012 Jan Kratochvil - 7.4.50.20120120-27.fc17 + - [rhel5] Fix up the previous commit (BZ 799318). + + * Sun Mar 4 2012 Jan Kratochvil - 7.4.50.20120120-26.fc17 + - [rhel5] Fix up the previous commit (BZ 799318). + + * Sun Mar 4 2012 Jan Kratochvil - 7.4.50.20120120-25.fc17 + - [rhel5] Workaround rpmbuild to make the doc subpkg noarch again (BZ 799318). + + * Fri Mar 2 2012 Jan Kratochvil - 7.4.50.20120120-24.fc17 + - [vla] Fix crash for dynamic.exp with gcc-gfortran-4.1.2-51.el5.x86_64. + - Reintroduce RHEL-5 glibc workaround for bt-clone-stop.exp. + - testsuite: Update/fix rh634108-solib_address.exp for the upstreamed API. + + * Wed Feb 29 2012 Jan Kratochvil - 7.4.50.20120120-23.fc17 + - Add kernel vDSO workaround (`no loadable ...') on RHEL-5 (kernel BZ 765875). + - Fix skipping of prologues on RHEL-5 gcc-4.1 -O2 -g code (BZ 797889). + - Fix breakpoint warning during 'next' over exit() (Tom Tromey, BZ 797892). + + * Tue Feb 28 2012 Jan Kratochvil - 7.4.50.20120120-22.fc17 + - testsuite: Fix gdb.base/macscp.exp ccache workaround in SCL mode. + - Adjust the RHEL/F version string automatically (BZ 797651, BZ 797646). + - Provide gdbtui for RHEL-5 and RHEL-6 as it is removed upstream (BZ 797664). + + * Fri Feb 24 2012 Jan Kratochvil - 7.4.50.20120120-21.fc17 + - testsuite: Do not use gcc44/gfortran44 on RHEL-5 if in SCL mode. + + * Wed Feb 22 2012 Jan Kratochvil - 7.4.50.20120120-20.fc17 + - Fix libinproctrace.so build on RHEL-5 i386 (disable it on RHEL-5). + + * Wed Feb 22 2012 Jan Kratochvil - 7.4.50.20120120-19.fc17 + - Implement SCL (scl-utils-build) macros. + + * Tue Feb 21 2012 Jan Kratochvil - 7.4.50.20120120-18.fc17 + - Fix debuginfo gdb-gdb.py build without redhat-rpm-config and on RHEL-5. + - Provide precompiled variants of gdb-gdb.py. + + * Mon Feb 13 2012 Jan Kratochvil - 7.4.50.20120120-17.fc17 + - gstack: Turn off --readnever (suggested by Oliver Henshaw). + + * Fri Feb 10 2012 Jan Kratochvil - 7.4.50.20120120-16.fc17 + - [RHELs] Drop simulation of legacy behavior - new GDB should behave as new GDB. + + * Fri Feb 10 2012 Jan Kratochvil - 7.4.50.20120120-15.fc17 + - Simplify %%setup .spec rule. + + * Fri Feb 10 2012 Jan Kratochvil - 7.4.50.20120120-14.fc17 + - Drop --with upstream .spec rules. + + * Fri Feb 10 2012 Jan Kratochvil - 7.4.50.20120120-13.fc17 + - Drop --with debug .spec rules. + + * Thu Feb 9 2012 Jan Kratochvil - 7.4.50.20120120-12.fc17 + - Improve performance for C++ symbols expansion (Tom Tromey, BZ 787487). + - Install also gdb-gdb.py pretty printers. + + * Thu Feb 9 2012 Jan Kratochvil - 7.4.50.20120120-11.fc17 + - Fix possible NULL crash in find_charset_names (Tom Tromey, BZ 786091). + - [ppc*] Fix build failure due to GCC aliasing warning (BZ 786504). + +------------------------------------------------------------------- +Tue Jun 12 07:41:22 UTC 2012 - cfarrell@suse.com + +- license update: GPL-3.0+ and GPL-3.0-with-GCC-exception and LGPL-2.1+ and + LGPL-3.0+ + SPDX format + +------------------------------------------------------------------- +Wed May 9 05:13:38 UTC 2012 - coolo@suse.com + +- Fix the minimum to get it through factory-auto + +------------------------------------------------------------------- +Tue Apr 3 14:08:43 UTC 2012 - rguenther@suse.com + +- Fixup missed debuginfo handling SUSE specifics. + +------------------------------------------------------------------- +Thu Jan 26 09:42:11 UTC 2012 - rguenther@suse.com + +- Merge from gdb-7.4.50.20120120-10.fc17.src.rpm. + + * Sat Jan 21 2012 Jan Kratochvil - 7.4.50.20120120-10.fc17 + - Rebase to FSF GDB 7.4.50.20120120. + - Drop the g77 .spec provisioning as it has been fixed in FSF GDB. + + * Thu Jan 19 2012 Jan Kratochvil - 7.4.50.20120103-9.fc17 + - Enable smaller %{_bindir}/gdb in future by no longer using -rdynamic. + - Make --enablerepo to use '*-debug*' for RHEL compatibility (BZ 781571). + - On older RHELs make readline bundled again (BZ 701131). + - Fix build compatibility with RHEL-5 due to false noarch build. + + * Wed Jan 11 2012 Jan Kratochvil - 7.4.50.20120103-8.fc17 + - Disable unexpected GDB directories relocatability. + + * Wed Jan 11 2012 Jan Kratochvil - 7.4.50.20120103-7.fc17 + - Fix BuildRequires for RHEL compatibility (BZ 701131). + + * Wed Jan 11 2012 Jan Kratochvil - 7.4.50.20120103-6.fc17 + - Provide %%snap timestamp for: Provides: bundled(librarypackage) + - Replace %%define by %%global. + - Replace Java in Summary with Fortran (only GCC-compiled Java is supported). + - Unbundle readline-6.2 with a workaround of skipped "ask" (BZ 701131). + - Work around readline-6.2 incompatibility not asking for --more-- (BZ 701131). + + * Sat Jan 7 2012 Jan Kratochvil - 7.4.50.20120103-5.fc17 + - Mark %{_sysconfdir}/gdbinit as %%config(noreplace). + - Add appropriate: Provides: bundled(librarypackage). + - Remove excessive explicit Requires: librarypackage. + + * Thu Jan 5 2012 Jan Kratochvil - 7.4.50.20120103-4.fc17 + - Fix linking on non-x86* (such as s390*) after libgdb.a removal. + + * Wed Jan 4 2012 Jan Kratochvil - 7.4.50.20120103-3.fc17 + - Reinclude gdb-dlopen-stap-probe.patch (missing in Fedora glibc - BZ 752476). + + * Tue Jan 3 2012 Jan Kratochvil - 7.4.50.20120103-2.fc17 + - Fix SystemTap support regression on i686 (Sergio Durigan Junior). + + * Tue Jan 3 2012 Jan Kratochvil - 7.4.50.20120103-1.fc17 + - Rebase to FSF GDB 7.4.50.20120103. + + * Mon Nov 28 2011 Jan Kratochvil - 7.3.50.20110722-11.fc17 + - No longer build bundled libstdc++ pretty printers on RHELs >= 7. + + * Sat Nov 5 2011 Sergio Durigan Junior - 7.3.50.20110722-10.fc16 + - Backport fix for crash in cp_scan_for_anonymous_namespace + (Aleksandar Ristovski, BZ 750341). + + * Fri Oct 14 2011 Jan Kratochvil - 7.3.50.20110722-9.fc16 + - Backport `info os processes' crash fix - for Eclipse (Pedro Alves, BZ 746294). + + * Tue Oct 11 2011 Jan Kratochvil - 7.3.50.20110722-8.fc16 + - Fix PIE testsuite run; new lib/future.exp hack and use -fPIC instead of -fPIE. + + * Mon Sep 26 2011 Jan Kratochvil - 7.3.50.20110722-7.fc16 + - [vla] Fix VLA arrays displayed in `bt full' (BZ 738482). + - Fix DW_OP_GNU_implicit_pointer for DWARF32 v3+ on 64-bit arches. + - Fix internal error on some optimized-out values. + + * Tue Aug 16 2011 Jan Kratochvil - 7.3.50.20110722-6.fc16 + - Python command/function auto-loading (Phil Muldoon, BZ 730976). + - Work around PR libc/13097 "linux-vdso.so.1" warning message. + - [TUI] Fix stepi on stripped code. + - Add BuildRequires: systemtap-sdt-devel for archer-sergiodj-stap-patch-split. + + * Wed Aug 10 2011 Jan Kratochvil - 7.3.50.20110722-5.fc16 + - Fix dlopen of libpthread.so, patched glibc required (Gary Benson, BZ 669432). + + * Tue Aug 9 2011 Jan Kratochvil - 7.3.50.20110722-4.fc16 + - Improve GDB performance on inferior dlopen calls (Gary Benson, BZ 698001). + - [python] Fix crash when pretty printer fails (Phil Muldoon, BZ 712715). + - Fix crash on invalid C++ mangled names (BZ 729283). + + * Fri Jul 29 2011 Jan Kratochvil - 7.3.50.20110722-3.fc16 + - Fix regression from VLA merge affecting -O0 -g watchpoints. + + * Fri Jul 29 2011 Jan Kratochvil - 7.3.50.20110722-2.fc16 + - Include gcc -g3 .debug_macro implementation by Tom Tromey. + + * Sat Jul 23 2011 Jan Kratochvil - 7.3.50.20110722-1.fc16 + - Rebase to FSF GDB 7.3.50.20110722. + - Improve gcc-4.6 stdarg false prologue end workaround (GDB PR 12435 + GCC PR 47471). + +------------------------------------------------------------------- +Wed Oct 12 12:09:41 UTC 2011 - rguenther@suse.com + +- Add patch to use old ptrace interface on powerpc to fix watchpoint + issues. [bnc#718313] + +------------------------------------------------------------------- +Thu Aug 4 10:28:50 UTC 2011 - rguenther@novell.com + +- Merge from gdb-7.3-41.fc15.src.rpm. [fate#310741] + + * Tue Jul 26 2011 Jan Kratochvil - 7.3-41.fc15 + - Rebase to the final FSF GDB 7.3 release. + - Improve gcc-4.6 stdarg false prologue end workaround (GDB PR 12435 + GCC PR 47471). + + * Sun Jul 3 2011 Jan Kratochvil - 7.2.90.20110703-40.fc15 + - Rebase to FSF GDB 7.2.90.20110703 (which is a 7.3 pre-release). + - Adjust the `print errno' patch due to the DW_AT_linkage_name following again. + + * Fri Jun 24 2011 Jan Kratochvil - 7.2.90.20110525-39.fc15 + - Fix install-info for the gdb-doc subpackage (BZ 715228). + +------------------------------------------------------------------- +Thu Jun 16 09:18:33 UTC 2011 - rguenther@novell.com + +- Merge from gdb-7.2.90.20110525-38.fc15.src.rpm. [fate#310741] + + * Wed May 25 2011 Jan Kratochvil - 7.2.90.20110525-38.fc15 + - Rebase to FSF GDB 7.2.90.20110525 (which is a 7.3 pre-release). + - [stap] Fix double free (Sergio Durigan Junior). + + * Tue May 3 2011 Jan Kratochvil - 7.2.90.20110429-37.fc15 + - Search also for . files in /usr/lib/debug/.build-id (BZ 641377). + +------------------------------------------------------------------- +Wed May 18 11:01:03 UTC 2011 - rguenther@novell.com + +- Merge from gdb-7.2.90.20110429-36.fc15.src.rpm. + + * Mon May 2 2011 Jan Kratochvil - 7.2.90.20110429-36.fc15 + - Bundle readline-6.2 with a workaround of skipped "ask" (BZ 701131). + - Use --without-system-readline, disable Requires and BuildRequires of readline. + - Drop gdb-6.5-readline-long-line-crash.patch and gdb-readline-6.0-signal.patch. + + * Fri Apr 29 2011 Jan Kratochvil - 7.2.90.20110429-35.fc15 + - Rebase to FSF GDB 7.2.90.20110429 (which is a 7.3 pre-release). + - Fix -O2 -g breakpoints internal error + prologue skipping (BZ 612253). + - Fix case insensitive symbols for Fortran by iFort (BZ 645773). + - Fix physname-related CU expansion issue for C++ (PR 12708). + - Fix Python access to inlined frames (BZ 694824). + + * Mon Apr 11 2011 Jan Kratochvil - 7.2.90.20110411-34.fc15 + - Rebase to FSF GDB 7.2.90.20110411 (which is a 7.3 pre-release). + - Include the proper fix for anonymous struct typedefs (Tom Tromey, BZ 672230). + + * Wed Mar 30 2011 Fabio M. Di Nitto - 7.2.50.20110328-33.fc15 + - Cleanup spec file to add sparc|sparcv9|sparc64. + - Add sparc specific workarounds to toolchain badness: + - disable mmap in bdf/ via --without-mmap configure option. + - add patch to not build mmap support on sparc for gdb/. + - gdb code is NOT at fault, but we need a working gdb while we sort out + the toolchain and rebuild all packages. this workaround is NOT for upstream. + + * Tue Mar 29 2011 Jan Kratochvil - 7.2.50.20110328-32.fc15 + - Fix occasional crash on `print errno' with no -pthread and no -g3 (BZ 690908). + +------------------------------------------------------------------- +Thu Apr 14 12:50:20 UTC 2011 - rguenther@novell.com + +- Merge from gdb-7.2.50.20110328-31.fc15.src.rpm. + + * Mon Mar 28 2011 Jan Kratochvil - 7.2.50.20110328-31.fc15 + - Rebase to FSF GDB 7.2.50.20110328 (which is a 7.3 pre-release). + - Bundle %%{libstdcxxpython}.tar.bz2 unconditionally - for rebulds on RHELs. + + * Sun Mar 20 2011 Jan Kratochvil - 7.2.50.20110320-30.fc15 + - Fix threading internal error on corrupted memory (BZ 677654). + - Fix i386 rwatch+awatch before run (BZ 688788, on top of BZ 541866). + + * Sun Mar 20 2011 Jan Kratochvil - 7.2.50.20110320-29.fc15 + - Rebase to FSF GDB 7.2.50.20110320 (which is a 7.3 pre-release). + - Merge archer-sergiodj-stap, the SystemTap probes breakpoints feature. + - [stap] Fix -O2 warnings. + - Fix Ada support crash on uninitialized gdbarch. + + * Sat Mar 5 2011 Jan Kratochvil - 7.2.50.20110305-28.fc15 + - Rebase to FSF GDB 7.2.50.20110305 (which is a 7.3 pre-release). + + * Fri Feb 25 2011 Jan Kratochvil - 7.2.50.20110222-27.fc15 + - Include doc also in the PDF form; new BuildRequires: texinfo-tex. + + * Wed Feb 23 2011 Jan Kratochvil - 7.2.50.20110222-26.fc15 + - Rebase to FSF GDB 7.2.50.20110222 (which is a 7.3 pre-release). + - Fix attach/core-load of {,un}prelinked i386 libs (bugreport by Michal Toman). + + * Mon Feb 21 2011 Jan Kratochvil - 7.2.50.20110218-25.fc15 + - Drop %%{_datadir}/gdb/syscalls/* for unsupported arches. + + * Fri Feb 18 2011 Jan Kratochvil - 7.2.50.20110218-24.fc15 + - Rebase to FSF GDB 7.2.50.20110218 (which is a 7.3 pre-release). + - [vla] Fox Fortran vector slices for allocated arrays (for BZ 609782). + + * Tue Feb 15 2011 Jan Kratochvil - 7.2.50.20110213-23.fc15 + - Move the GFDL License to gdb-doc. + + * Tue Feb 15 2011 Jan Kratochvil - 7.2.50.20110213-22.fc15 + - Fix gdb-doc Group to be Documentation, also provide it as noarch. + + * Tue Feb 15 2011 Jan Kratochvil - 7.2.50.20110213-21.fc15 + - Drop non-user (gdbint) and obsolete (stabs) documentation. + - Install also HTML files besides the INFO file. + - Create new subpackage gdb-doc for both INFO and HTML files. + + * Sun Feb 13 2011 Jan Kratochvil - 7.2.50.20110213-20.fc15 + - Rebase to FSF GDB 7.2.50.20110213 (which is a 7.3 pre-release). + - Fix occasionall unfound source lines (affecting at least glibc debugging). + - Fix const/volatile qualifiers of C++ types (PR c++/12328). + - Be backward compatible for --rebuild with <=fc14 librpm.so.1. + +- Revert documentation split. + +------------------------------------------------------------------- +Thu Mar 3 12:42:45 UTC 2011 - rguenther@novell.com + +- Merge from gdb-7.2.50.20110206-19.fc15.src.rpm. + + * Tue Feb 08 2011 Fedora Release Engineering - 7.2.50.20110206-19 + - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + + * Sun Feb 6 2011 Jan Kratochvil - 7.2.50.20110206-18.fc15 + - Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz). + + * Sun Feb 6 2011 Jan Kratochvil - 7.2.50.20110206-17.fc15 + - Rebase to FSF GDB 7.2.50.20110206 (which is a 7.3 pre-release). + + * Thu Jan 27 2011 Jan Kratochvil - 7.2.50.20110125-16.fc15 + - Fix Python new-backtrace command (BZ 672235, Phil Muldoon). + + * Wed Jan 26 2011 Jan Kratochvil - 7.2.50.20110125-15.fc15 + - Temporary fix of F15 gcc-4.6 child DIEs of DW_TAG_typedef (BZ 672230). + - Workaround gcc-4.6 stdarg false prologue end (GDB PR 12435 + GCC PR 47471). + + * Tue Jan 25 2011 Jan Kratochvil - 7.2.50.20110125-14.fc15 + - Rebase to FSF GDB 7.2.50.20110125 (which is a 7.3 pre-release). + - Fix discontiguous address ranges in .gdb_index - v3->v4 (BZ 672281). + - Fix DWARF-3+ DW_AT_accessibility default assumption for F15 gcc-4.6. + + * Thu Jan 20 2011 Jan Kratochvil - 7.2.50.20110117-13.fc15 + - Use librpm.so.2 for rpm-4.9.0 in Fedora 15. + + * Mon Jan 17 2011 Jan Kratochvil - 7.2.50.20110117-12.fc15 + - Use %%{?dist} for sanity checking tools compliance (suggested by Petr Muller). + + * Mon Jan 17 2011 Jan Kratochvil - 7.2.50.20110117-11.fc15 + - Rebase to FSF GDB 7.2.50.20110117 (which is a 7.3 pre-release). + - Fix callback-mode readline-6.0 regression for CTRL-C (for RHEL-6.0). + - Fix occasional NULL dereference of the readline-6.0 workaround (BZ 575516). + + * Sat Jan 15 2011 Jan Kratochvil - 7.2.50.20110107-10.fc15 + - [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604). + - [archer-tromey-delayed-symfile] New test gdb.dwarf2/dw2-aranges.exp. + - [archer-keiths-expr-cumulative+upstream] Import C++ testcases. + - testsuite: Fix gdb-test-expr-cumulative-archer.patch compatibility. + + * Fri Jan 7 2011 Jan Kratochvil - 7.2.50.20110107-9.fc15 + - Remove --with-pythondir as no longer valid. + - Provide %{_bindir}gdb-add-index even on RHEL-5. + - Provide again libstdc++ pretty printers for any RHEL. + + * Fri Jan 7 2011 Jan Kratochvil - 7.2.50.20110107-8.fc15 + - Rebase to FSF GDB 7.2.50.20110107 (which is a 7.3 pre-release). + - Import archer-tromey-python (BZ 666177, branch update by Phil Muldoon). + + * Tue Jan 4 2011 Jan Kratochvil - 7.2.50.20110104-7.fc15 + - Rebase to FSF GDB 7.2.50.20110104 (which is a 7.3 pre-release). + - New testcase py-prettyprint.exp:print hint_error (for BZ 611569, BZ 629236). + - New test gdb.arch/x86_64-pid0-core.exp for kernel PID 0 cores (BZ 611435). + + * Sat Jan 1 2011 Jan Kratochvil - 7.2.50.20101231-6.fc15 + - Fix --with-system-readline doc build upstream regression. + + * Sat Jan 1 2011 Jan Kratochvil - 7.2.50.20101231-5.fc15 + - Rebase to FSF GDB 7.2.50.20101231 (which is a 7.3 pre-release). + - Remove gdb-6.3-bt-past-zero-20051201.patch, gdb-archer-ada.patch and + gdb-6.3-framepczero-20040927.patch already removed from .spec before. + - Remove gdb-6.5-dwarf-stack-overflow.patch, upstreamed (Tom Tromey). + - Remove gdb-6.6-bz225783-gdb-debuginfo-paths.patch, upstreamed (Tom Tromey). + - Remove gdb-6.6-readline-system.patch, reimplemented upstream (Tom Tromey). + - Remove gdb-bz642879-elfread-sigint-stale.patch, upstreamed (Jan Kratochvil). + - Remove gdb-next-over-throw.patch, upstreamed (Tom Tromey). + + * Mon Dec 27 2010 Jan Kratochvil - 7.2.50.20101117-4.fc15 + - Provide stub %%{_sysconfdir}/gdbinit (BZ 651232). + + * Mon Dec 27 2010 Jan Kratochvil - 7.2.50.20101117-3.fc15 + - Fix ppc* compilation of PRPSINFO in the core files (BZ 662995, for BZ 254229). + - Fix (disable) non-x86* compilation of libinproctrace.so (for BZ 662995). + + * Thu Nov 18 2010 Jan Kratochvil - 7.2.50.20101117-2.fc15 + - Drop gdb-6.8-glibc-headers-compat.patch: GNU/Linux irrelevant (Tom Tromey). + - Drop gdb-6.3-terminal-fix-20050214.patch: The bug is not reproducible. + - Drop gdb-6.7-kernel-headers-compat.patch: kernel-headers seem to be fixed. + - Drop gdb-archer-ada.patch: No longer needed for Ada (Keith Seitz). + - New PR backtrace/12237, drop gdb-6.3-framepczero-20040927.patch + gdb-6.3-bt-past-zero-20051201.patch as they already had no effect. + - Drop gdb-6.8-gcc35998-ada-memory-trash.patch as a different fix is upstream. + - Drop gdb-6.3-inheritance-20050324.patch: the call is redundent (Tom Tromey). + - Drop gdb-6.3-large-core-20051206.patch: obsoleted by MAX_COPY_BYTES. + + * Thu Nov 18 2010 Jan Kratochvil - 7.2.50.20101117-1.fc15 + - Rebase to FSF GDB 7.2.50.20101117 (which is a 7.3 pre-release). + + * Sun Nov 7 2010 Jan Kratochvil - 7.2-25.fc14 + - iFort compat. - case insensitive DWARF not in lowercase (BZ 645773). + + * Thu Oct 14 2010 Jan Kratochvil - 7.2-24.fc14 + - Add gdb.spec comments on the *.patch files upstream merge status. + + * Thu Oct 14 2010 Jan Kratochvil - 7.2-23.fc14 + - Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879). + - Fix crash on CTRL-C while reading an ELF symbol file (BZ 642879). + + * Tue Oct 12 2010 Jan Kratochvil - 7.2-22.fc14 + - testsuite: Provide missing lib/gdb-python.exp (for BZ 639089). + + * Tue Oct 12 2010 Jan Kratochvil - 7.2-21.fc14 + - Fix python stale error state, also fix its save/restore (BZ 639089). + - Fix inferior exec of new PIE x86_64 (BZ 638979). + + * Tue Oct 12 2010 Jan Kratochvil - 7.2-20.fc14 + - Fixup Release for 20.fc14. + + * Tue Oct 12 2010 Jan Kratochvil - 7.2-19.fc14 + - Use .gdb_index v3 to fix excessive resources rqmnts (BZ 640634, Tom Tromey). + + * Wed Oct 6 2010 Jan Kratochvil - 7.2-18.fc14 + - Fix false warning: non-absolute filename: (BZ 640648). + + * Thu Sep 30 2010 Jan Kratochvil - 7.2-17.fc14 + - New Conflicts: elfutils < 0.149 due to the .gdb_index .debug support. + +------------------------------------------------------------------- +Mon Dec 6 13:53:30 UTC 2010 - rguenther@novell.com + +- On SLE10 package libinproctrace in the main gdb package. + +------------------------------------------------------------------- +Wed Oct 13 10:52:15 UTC 2010 - rguenther@novell.com + +- Merge from gdb-7.2-16.fc14.src.rpm. + +------------------------------------------------------------------- +Mon Sep 13 10:42:49 UTC 2010 - rguenther@novell.com + +- Change python-base from recommends to requires, gdb no longer + works without some basic python modules. [bnc#638858] + +------------------------------------------------------------------- +Mon Sep 6 09:45:11 UTC 2010 - rguenther@novell.com + +- Merge from gdb-7.2-1.fc14.src.rpm. + +------------------------------------------------------------------- +Wed Aug 25 11:04:38 UTC 2010 - rguenther@novell.com + +- Backport fix for gcore not handling GNU_RELRO sections. [bnc#596646] + +------------------------------------------------------------------- +Wed Aug 25 10:53:50 UTC 2010 - rguenther@novell.com + +- Merge from gdb-7.1-33.fc13.src.rpm. + +------------------------------------------------------------------- +Fri Aug 6 12:25:13 UTC 2010 - rguenther@novell.com + +- Backport fix for setting of VSX registers. [bnc#626970] + +------------------------------------------------------------------- +Thu Aug 5 11:24:00 UTC 2010 - rguenther@novell.com + +- Merge from gdb-7.1-30.fc13.src.rpm. + +------------------------------------------------------------------- +Thu Aug 5 11:18:33 UTC 2010 - rguenther@novell.com + +- For SLE10 do not build a separate gdbserver package. + +------------------------------------------------------------------- +Thu Jul 22 09:54:36 UTC 2010 - rguenther@novell.com + +- Merge from gdb-7.1-29.fc13.src.rpm. + +------------------------------------------------------------------- +Tue Jun 1 11:46:20 UTC 2010 - rguenther@novell.com + +- Fix build on hppa fix. + +------------------------------------------------------------------- +Tue Jun 1 10:57:30 UTC 2010 - bg@novell.com + +- Fix build on hppa. + +------------------------------------------------------------------- +Fri May 21 12:17:19 UTC 2010 - rguenther@novell.com + +- Merge from gdb-7.1-20.fc13.src.rpm. + +------------------------------------------------------------------- +Thu Apr 22 19:13:48 UTC 2010 - aj@suse.de + +- Add upstream change to fix build with -Werror + +------------------------------------------------------------------- +Thu Apr 15 14:22:36 CEST 2010 - rguenther@novell.com + +- Merge from gdb-7.1-12.fc13.src.rpm. +- Re-write history to match SLE11 SP1 changelog + * Drop some more strange RHEL stuff. + * Fix build for SLE10. + +------------------------------------------------------------------- +Mon Mar 15 11:21:05 CET 2010 - rguenther@novell.com + +- Fix info documentation registering. [bnc#588278] + +------------------------------------------------------------------- +Thu Feb 11 13:43:11 CET 2010 - kukuk@suse.de + +- Re-Add baselibs.conf + +------------------------------------------------------------------- +Thu Oct 22 17:03:30 CEST 2009 - rguenther@suse.de + +- Merge from gdb-7.0-2.fc12.src.rpm. [fate#304116] + [bnc#488132] [bnc#498749] + +------------------------------------------------------------------- +Mon Oct 19 12:48:43 CEST 2009 - rguenther@suse.de + +- Recommend python-base. + +------------------------------------------------------------------- +Mon Oct 12 10:22:38 CEST 2009 - rguenther@suse.de + +- Fix python dependency. + +------------------------------------------------------------------- +Wed Oct 7 15:11:51 UTC 2009 - crrodriguez@opensuse.org + +- fix info files (un)installation. + +------------------------------------------------------------------- +Mon Oct 5 14:23:33 CEST 2009 - rguenther@suse.de + +- Merge from gdb-6.8.91.20090930-2.fc12.src.rpm. + +------------------------------------------------------------------- +Thu Sep 24 11:40:44 CEST 2009 - rguenther@suse.de + +- Merge from gdb-6.8.91.20090921-1.fc12.src.rpm. + +------------------------------------------------------------------- +Mon Sep 14 14:29:20 CEST 2009 - rguenther@suse.de + +- Merge from gdb-6.8.50.20090910-1.fc12.src.rpm. + +------------------------------------------------------------------- +Mon Aug 24 17:30:30 CEST 2009 - rguenther@suse.de + +- Fix gdb-6.3-ia64-sigtramp-frame-20050708.patch patch to allow + ia64 to build again. + +------------------------------------------------------------------- +Mon Aug 24 14:07:52 CEST 2009 - rguenther@suse.de + +- Merge from gdb-6.8.50.20090818-4.fc12.src.rpm. + +------------------------------------------------------------------- +Mon Aug 17 14:04:46 CEST 2009 - rguenther@suse.de + +- Merge from gdb-6.8.50.20090811-2.fc12.src.rpm. + +------------------------------------------------------------------- +Tue Aug 11 17:32:38 CEST 2009 - rguenther@suse.de + +- Remove no longer applied patches. + +------------------------------------------------------------------- +Thu Aug 6 12:29:19 CEST 2009 - rguenther@suse.de + +- Fixup the merge. + +------------------------------------------------------------------- +Thu Aug 6 12:11:40 CEST 2009 - rguenther@suse.de + +- Merge from gdb-6.8.50.20090803-2.fc12.src.rpm. + +------------------------------------------------------------------- +Tue Jul 28 13:44:45 CEST 2009 - rguenther@suse.de + +- Fix crash during debuginfo reading. + +------------------------------------------------------------------- +Wed Jul 8 13:22:36 CEST 2009 - rguenther@suse.de + +- Drop fixes done upstream. + +------------------------------------------------------------------- +Wed Jun 17 16:43:08 CEST 2009 - matz@suse.de + +- Apply fix for backtraces without unwind info again. [#390722] +- Disable gdb-6.5-bz218379-ppc-solib-trampoline-fix.patch, it's not + necessary anymore and breaks the above. + +------------------------------------------------------------------- +Wed May 27 18:07:26 CEST 2009 - rguenther@suse.de + +- Merge FC11 update 23. + - Fix crashes due to (missing) varobj revalidation, for VLA (for brc#377541). + - Archer update to the snapshot: e2812eadef2c15baeccd003e11fdf3fbc0b90dc2 + - Archer backport: 58dcda94ac5d6398f47382505e9d3d9d866d79bf + + f3de7bbd655337fe6705aeaafcc970deff3dd5d5 + - Implement Fortran modules namespaces (brc#466118). + +------------------------------------------------------------------- +Mon May 18 10:42:26 CEST 2009 - rguenther@suse.de + +- Add patch to fix handling of string DW_AT_const_values. [bnc#329420] +- Verified + * Fix printing of 'inf'. [bnc#466266] + * Stepping through templates. [bnc#414230] + * gcore script. [fate#303462] + +------------------------------------------------------------------- +Thu May 14 15:26:42 CEST 2009 - rguenther@suse.de + +- Change reported version to mention SUSE instead of Fedora. +- Fix handling of bogus global namespace DIEs from GCC 4.1. [bnc#329420] +- Fix Power7 DFP detection. [bnc#492331] + +------------------------------------------------------------------- +Thu May 7 15:00:14 CEST 2009 - rguenther@suse.de + +- Fix build for SLE10. [fate#305977] +- Adjust missing debug packages suggested install command. + +------------------------------------------------------------------- +Wed Apr 29 15:11:15 CEST 2009 - rguenther@suse.de + +- Adjust package name and release to not contain macros. + +------------------------------------------------------------------- +Mon Apr 27 16:18:02 CEST 2009 - rguenther@suse.de + +- Disable rpm support for locating debug info packages. + +------------------------------------------------------------------- +Mon Apr 27 13:33:06 CEST 2009 - rguenther@suse.de + +- Switch to Fedora 11 source RPM. + * includes partially merge from Archer. [bnc#329420, bnc#497141, + bnc#492782] + +------------------------------------------------------------------- +Tue Mar 10 11:14:25 CET 2009 - rguenther@suse.de + +- Add VLA support patch from Fedora to fix possible + dwarf_expr_frame_base NULL checking regression. +- Fix readline incompatibility. + +------------------------------------------------------------------- +Mon Mar 2 11:42:03 CET 2009 - rguenther@suse.de + +- Integrate support for transparently debugging inline functions. + +------------------------------------------------------------------- +Mon Feb 16 11:40:00 CET 2009 - schwab@suse.de + +- Update to head to trunk. + +------------------------------------------------------------------- +Tue Feb 3 16:18:13 CET 2009 - schwab@suse.de + +- Fix merge error. + +------------------------------------------------------------------- +Thu Jan 22 17:17:14 CET 2009 - schwab@suse.de + +- Add updates for Cell combined debugger. + +------------------------------------------------------------------- +Tue Jan 20 15:45:56 CET 2009 - schwab@suse.de + +- Do not call get_frame_arch for NULL frame pointers. +- Remove deprecated_safe_get_selected_frame call from read_var_value. + +------------------------------------------------------------------- +Fri Jan 16 15:30:23 CET 2009 - bwalle@suse.de + +- Recommend Python for GDB to prevent strange error messages to + be presented to the user in the default case. + +------------------------------------------------------------------- +Wed Dec 10 12:34:56 CET 2008 - olh@suse.de + +- use Obsoletes: -XXbit only for ppc64 to help solver during distupgrade + (bnc#437293) + +------------------------------------------------------------------- +Thu Nov 20 16:33:45 CET 2008 - schwab@suse.de + +- Update to head of trunk. +- Don't lose running state of the inferior. +- Fix dangling pointers after following fork. + +------------------------------------------------------------------- +Sun Nov 9 19:18:33 CET 2008 - schwab@suse.de + +- Update .debug_line parser patch. + +------------------------------------------------------------------- +Mon Nov 3 19:21:09 CET 2008 - schwab@suse.de + +- Update to head of trunk. +- Fix auxv decoding. + +------------------------------------------------------------------- +Mon Nov 3 12:51:52 CET 2008 - schwab@suse.de + +- Revert broken change from jblunck. + +------------------------------------------------------------------- +Thu Oct 30 12:34:56 CET 2008 - olh@suse.de + +- obsolete old -XXbit packages (bnc#437293) + +------------------------------------------------------------------- +Tue Oct 28 12:43:31 CET 2008 - jblunck@suse.de + +- Fix segfault when reading line number program (bnc #439457). + +------------------------------------------------------------------- +Mon Oct 27 16:05:13 CET 2008 - schwab@suse.de + +- Complain about invalid line number program. + +------------------------------------------------------------------- +Tue Oct 7 15:00:24 CEST 2008 - schwab@suse.de + +- Fix crash. + +------------------------------------------------------------------- +Wed Sep 24 14:23:01 CEST 2008 - schwab@suse.de + +- Update to head of trunk. +- Add POWER7 support. +- Add gcore. +- Add spu-elf to list of targets. + +------------------------------------------------------------------- +Fri Sep 12 11:36:50 CEST 2008 - schwab@suse.de + +- Update to head of trunk. +- Add Cell combined debugger patch. + +------------------------------------------------------------------- +Thu Sep 4 11:30:34 CEST 2008 - schwab@suse.de + +- Update to head of trunk. + +------------------------------------------------------------------- +Fri Aug 15 17:58:02 CEST 2008 - schwab@suse.de + +- Update to head of trunk. + +------------------------------------------------------------------- +Fri Aug 8 15:30:07 CEST 2008 - schwab@suse.de + +- Update to head of trunk. +- Enable multi-target support. + +------------------------------------------------------------------- +Fri Jul 18 13:18:33 CEST 2008 - schwab@suse.de + +- Update to head of trunk. + +------------------------------------------------------------------- +Mon Jul 7 13:42:05 CEST 2008 - schwab@suse.de + +- Update to head of trunk. + +------------------------------------------------------------------- +Wed Jun 18 16:47:02 CEST 2008 - schwab@suse.de + +- Update to head of trunk. + +------------------------------------------------------------------- +Fri May 23 11:29:13 CEST 2008 - matz@suse.de + +- Try harder to provide backtraces without debuginfo on i386. [bnc #390722] + +------------------------------------------------------------------- +Wed May 21 10:39:41 CEST 2008 - schwab@suse.de + +- Fix assertion failure. + +------------------------------------------------------------------- +Fri May 9 14:05:00 CEST 2008 - schwab@suse.de + +- Split off gdbserver. +- Fix watchpoints. + +------------------------------------------------------------------- +Thu Apr 10 12:54:45 CEST 2008 - ro@suse.de + +- added baselibs.conf file to build xxbit packages + for multilib support + +------------------------------------------------------------------- +Fri Mar 28 10:55:28 CET 2008 - schwab@suse.de + +- Update to gdb 6.8. + * New native configurations + NetBSD/hppa hppa*-*netbsd* + Xtensa GNU/Linux xtensa*-*-linux* + * New targets + NetBSD/hppa hppa*-*-netbsd* + Xtensa GNU/Lunux xtensa*-*-linux* + * Change in command line behavior -- corefiles vs. process ids. + When the '-p NUMBER' or '--pid NUMBER' options are used, and + attaching to process NUMBER fails, GDB no longer attempts to open a + core file named NUMBER. Attaching to a program using the -c option + is no longer supported. Instead, use the '-p' or '--pid' options. + * GDB can now be built as a native debugger for debugging Windows x86 + (mingw32) Portable Executable (PE) programs. + * Pending breakpoints no longer change their number when their address + is resolved. + * GDB now supports breakpoints with multiple locations, + including breakpoints on C++ constructors, inside C++ templates, + and in inlined functions. + * GDB's ability to debug optimized code has been improved. GDB more + accurately identifies function bodies and lexical blocks that occupy + more than one contiguous range of addresses. + * Target descriptions can now describe registers for PowerPC. + * The GDB remote stub, gdbserver, now supports the AltiVec and SPE + registers on PowerPC targets. + * The GDB remote stub, gdbserver, now supports thread debugging on GNU/Linux + targets even when the libthread_db library is not available. + * The GDB remote stub, gdbserver, now supports the new file transfer + commands (remote put, remote get, and remote delete). + * The GDB remote stub, gdbserver, now supports run and attach in + extended-remote mode. + * hppa*64*-*-hpux11* target broken + The debugger is unable to start a program and fails with the following + error: "Error trying to get information about dynamic linker". + The gdb-6.7 release is also affected. + * GDB now supports the --enable-targets= configure option to allow + building a single GDB executable that supports multiple remote + target architectures. + * GDB now supports debugging C and C++ programs which use the + Decimal Floating Point extension. In addition, the PowerPC target + now has a set of pseudo-registers to inspect decimal float values + stored in two consecutive float registers. + * The -break-insert MI command can optionally create pending + breakpoints now. + * Improved support for debugging Ada + Many improvements to the Ada language support have been made. These + include: + - Better support for Ada2005 interface types + - Improved handling of arrays and slices in general + - Better support for Taft-amendment types + - The '{type} ADDRESS' expression is now allowed on the left hand-side + of an assignment + - Improved command completion in Ada + - Several bug fixes + * New commands + set print frame-arguments (all|scalars|none) + show print frame-arguments + The value of this variable can be changed to control which argument + values should be printed by the debugger when displaying a frame. + remote put + remote get + remote delete + Transfer files to and from a remote target, and delete remote files. + * New MI commands + -target-file-put + -target-file-get + -target-file-delete + Transfer files to and from a remote target, and delete remote files. + * New remote packets + vFile:open: + vFile:close: + vFile:pread: + vFile:pwrite: + vFile:unlink: + Open, close, read, write, and delete files on the remote system. + * GDB on GNU/Linux and HP/UX can now debug through "exec" of a new + process. + vAttach + Attach to an existing process on the remote system, in extended-remote + mode. + vRun + Run a new process on the remote system, in extended-remote mode. + +------------------------------------------------------------------- +Wed Mar 5 15:38:06 CET 2008 - schwab@suse.de + +- Update to head of gdb_6_8-branch. + +------------------------------------------------------------------- +Thu Feb 14 13:41:54 CET 2008 - schwab@suse.de + +- Update to head of trunk. + +------------------------------------------------------------------- +Thu Jan 31 15:34:47 CET 2008 - schwab@suse.de + +- Update to head of trunk. + +------------------------------------------------------------------- +Thu Jan 10 11:57:13 CET 2008 - schwab@suse.de + +- Update to head of trunk. + +------------------------------------------------------------------- +Mon Nov 12 14:47:26 CET 2007 - schwab@suse.de + +- Update to gdb 6.7.1. + * hppa*64*-*-hpux11* target broken + The debugger is unable to start a program and fails with the following + error: "Error trying to get information about dynamic linker". + The gdb-6.7 release is also affected. + +------------------------------------------------------------------- +Fri Oct 19 15:02:27 CEST 2007 - olh@suse.de + +- allow build with old distributions, libexpat-devel is new in 10.3 + +------------------------------------------------------------------- +Thu Oct 11 18:52:04 CEST 2007 - schwab@suse.de + +- Update to gdb 6.7. + * Resolved 101 resource leaks, null pointer dereferences, etc. in gdb, + bfd, libiberty and opcodes, as revealed by static analysis donated by + Coverity, Inc. (http://scan.coverity.com). + * When looking up multiply-defined global symbols, GDB will now prefer the + symbol definition in the current shared library if it was built using the + -Bsymbolic linker option. + * When the Text User Interface (TUI) is not configured, GDB will now + recognize the -tui command-line option and print a message that the TUI + is not supported. + * The GDB remote stub, gdbserver, now has lower overhead for high + frequency signals (e.g. SIGALRM) via the QPassSignals packet. + * GDB for MIPS targets now autodetects whether a remote target provides + 32-bit or 64-bit register values. + * Support for C++ member pointers has been improved. + * GDB now understands XML target descriptions, which specify the + target's overall architecture. GDB can read a description from + a local file or over the remote serial protocol. + * Vectors of single-byte data use a new integer type which is not + automatically displayed as character or string data. + * The /s format now works with the print command. It displays + arrays of single-byte integers and pointers to single-byte integers + as strings. + * Target descriptions can now describe target-specific registers, + for architectures which have implemented the support (currently + only ARM, M68K, and MIPS). + * GDB and the GDB remote stub, gdbserver, now support the XScale + iWMMXt coprocessor. + * The GDB remote stub, gdbserver, has been updated to support + ARM Windows CE (mingw32ce) debugging, and GDB Windows CE support + has been rewritten to use the standard GDB remote protocol. + * GDB can now step into C++ functions which are called through thunks. + * GDB for the Cell/B.E. SPU now supports overlay debugging. + * The GDB remote protocol "qOffsets" packet can now honor ELF segment + layout. It also supports a TextSeg= and DataSeg= response when only + segment base addresses (rather than offsets) are available. + * The /i format now outputs any trailing branch delay slot instructions + immediately following the last instruction within the count specified. + * The GDB remote protocol "T" stop reply packet now supports a + "library" response. Combined with the new "qXfer:libraries:read" + packet, this response allows GDB to debug shared libraries on targets + where the operating system manages the list of loaded libraries (e.g. + Windows and SymbianOS). + * The GDB remote stub, gdbserver, now supports dynamic link libraries + (DLLs) on Windows and Windows CE targets. + * GDB now supports a faster verification that a .debug file matches its binary + according to its build-id signature, if the signature is present. + * New commands + set remoteflow + show remoteflow + Enable or disable hardware flow control (RTS/CTS) on the serial port + when debugging using remote targets. + set mem inaccessible-by-default + show mem inaccessible-by-default + If the target supplies a memory map, for instance via the remote + protocol's "qXfer:memory-map:read" packet, setting this variable + prevents GDB from accessing memory outside the memory map. This + is useful for targets with memory mapped registers or which react + badly to accesses of unmapped address space. + set breakpoint auto-hw + show breakpoint auto-hw + If the target supplies a memory map, for instance via the remote + protocol's "qXfer:memory-map:read" packet, setting this variable + lets GDB use hardware breakpoints automatically for memory regions + where it can not use software breakpoints. This covers both the + "break" command and internal breakpoints used for other commands + including "next" and "finish". + catch exception + catch exception unhandled + Stop the program execution when Ada exceptions are raised. + catch assert + Stop the program execution when an Ada assertion failed. + set sysroot + show sysroot + Set an alternate system root for target files. This is a more + general version of "set solib-absolute-prefix", which is now + an alias to "set sysroot". + info spu + Provide extended SPU facility status information. This set of + commands is available only when debugging the Cell/B.E. SPU + architecture. + * New native configurations + OpenBSD/sh sh*-*openbsd* + set tdesc filename + unset tdesc filename + show tdesc filename + Use the specified local file as an XML target description, and do + not query the target for its built-in description. + * New targets + OpenBSD/sh sh*-*-openbsd* + MIPS64 GNU/Linux (gdbserver) mips64-linux-gnu + Toshiba Media Processor mep-elf + * New remote packets + QPassSignals: + Ignore the specified signals; pass them directly to the debugged program + without stopping other threads or reporting them to GDB. + qXfer:features:read: + Read an XML target description from the target, which describes its + features. + qXfer:spu:read: + qXfer:spu:write: + Read or write contents of an spufs file on the target system. These + packets are available only on the Cell/B.E. SPU architecture. + qXfer:libraries:read: + Report the loaded shared libraries. Combined with new "T" packet + response, this packet allows GDB to debug shared libraries on + targets where the operating system manages the list of loaded + libraries (e.g. Windows and SymbianOS). + * Removed targets + Support for these obsolete configurations has been removed. + alpha*-*-osf1* + alpha*-*-osf2* + d10v-*-* + hppa*-*-hiux* + i[34567]86-ncr-* + i[34567]86-*-dgux* + i[34567]86-*-lynxos* + i[34567]86-*-netware* + i[34567]86-*-sco3.2v5* + i[34567]86-*-sco3.2v4* + i[34567]86-*-sco* + i[34567]86-*-sysv4.2* + i[34567]86-*-sysv4* + i[34567]86-*-sysv5* + i[34567]86-*-unixware2* + i[34567]86-*-unixware* + i[34567]86-*-sysv* + i[34567]86-*-isc* + m68*-cisco*-* + m68*-tandem-* + mips*-*-pe + rs6000-*-lynxos* + sh*-*-pe + * Other removed features + target abug + target cpu32bug + target est + target rom68k + Various m68k-only ROM monitors. + target hms + target e7000 + target sh3 + target sh3e + Various Renesas ROM monitors and debugging interfaces for SH and + H8/300. + target ocd + Support for a Macraigor serial interface to on-chip debugging. + GDB does not directly support the newer parallel or USB + interfaces. + DWARF 1 support + A debug information format. The predecessor to DWARF 2 and + DWARF 3, which are still supported. + Support for the HP aCC compiler on HP-UX/PA-RISC + SOM-encapsulated symbolic debugging information, automatic + invocation of pxdb, and the aCC custom C++ ABI. This does not + affect HP-UX for Itanium or GCC for HP-UX/PA-RISC. Code compiled + with aCC can still be debugged on an assembly level. + MIPS ".pdr" sections + A MIPS-specific format used to describe stack frame layout + in debugging information. + Scheme support + GDB could work with an older version of Guile to debug + the interpreter and Scheme programs running in it. + set mips stack-arg-size + set mips saved-gpreg-size + Use "set mips abi" to control parameter passing for MIPS. + +------------------------------------------------------------------- +Mon Oct 1 15:44:07 CEST 2007 - schwab@suse.de + +- Update to head of gdb_6_7-branch. + +------------------------------------------------------------------- +Mon Sep 24 11:33:32 CEST 2007 - schwab@suse.de + +- Fix internal error [#309928]. + +------------------------------------------------------------------- +Thu Jul 26 12:41:05 CEST 2007 - schwab@suse.de + +- Update to head of trunk. + +------------------------------------------------------------------- +Fri Jul 13 11:46:27 CEST 2007 - schwab@suse.de + +- Update to head of trunk. + +------------------------------------------------------------------- +Sun Jun 24 18:52:47 CEST 2007 - schwab@suse.de + +- Fix annotations for commands prompt. + +------------------------------------------------------------------- +Thu Jun 21 12:37:56 CEST 2007 - schwab@suse.de + +- Update to head of trunk. + +------------------------------------------------------------------- +Fri Jun 8 17:15:17 CEST 2007 - schwab@suse.de + +- Update to head of trunk. + +------------------------------------------------------------------- +Fri May 11 15:22:37 CEST 2007 - schwab@suse.de + +- Update to head of trunk. + +------------------------------------------------------------------- +Fri Apr 13 15:43:47 CEST 2007 - schwab@suse.de + +- Avoid crash on object with no text section [#176306]. + +------------------------------------------------------------------- +Wed Apr 11 17:16:45 CEST 2007 - schwab@suse.de + +- Handle non-threaded processes in gstack [#262694]. + +------------------------------------------------------------------- +Sun Apr 1 21:32:33 CEST 2007 - schwab@suse.de + +- Properly decode CR register number. + +------------------------------------------------------------------- +Thu Mar 29 13:45:08 CEST 2007 - schwab@suse.de + +- Update solib-extract-address patch. + +------------------------------------------------------------------- +Tue Mar 20 13:41:02 CET 2007 - schwab@suse.de + +- Update single stepping patch again [#154486]. + +------------------------------------------------------------------- +Fri Mar 16 13:39:50 CET 2007 - schwab@suse.de + +- Update single stepping patch [#154486]. + +------------------------------------------------------------------- +Thu Mar 15 18:22:31 CET 2007 - schwab@suse.de + +- Fix altivec vector return location [#250004]. + +------------------------------------------------------------------- +Mon Mar 12 18:07:07 CET 2007 - schwab@suse.de + +- Update ppc DWARF patch to also handle broken debug info from old + compilers. + +------------------------------------------------------------------- +Thu Mar 8 15:04:28 CET 2007 - schwab@suse.de + +- Deal with stepping over sequence of atomic insns [#154486]. + +------------------------------------------------------------------- +Wed Mar 7 14:05:16 CET 2007 - schwab@suse.de + +- Improve last change. + +------------------------------------------------------------------- +Tue Mar 6 18:47:10 CET 2007 - schwab@suse.de + +- Better handling of ppc64 function descriptor symbols. + +------------------------------------------------------------------- +Mon Mar 5 22:06:00 CET 2007 - schwab@suse.de + +- Remove obsolete patch. +- Fix show endian. + +------------------------------------------------------------------- +Thu Jan 11 18:29:13 CET 2007 - schwab@suse.de + +- Fix unchecked use of PC_REGNUM. + +------------------------------------------------------------------- +Wed Dec 20 12:37:40 CET 2006 - schwab@suse.de + +- Update to gdb 6.6. + * New targets + Xtensa xtensa-elf + Cell Broadband Engine SPU spu-elf + * GDB can now be configured as a cross-debugger targeting native Windows + (mingw32) or Cygwin. It can communicate with a remote debugging stub + running on a Windows system over TCP/IP to debug Windows programs. + * The GDB remote stub, gdbserver, has been updated to support Windows and + Cygwin debugging. Both single-threaded and multi-threaded programs are + supported. + * The "set trust-readonly-sections" command works again. This command was + broken in GDB 6.3, 6.4, and 6.5. + * Support for GNU/Linux Thread Local Storage (TLS, per-thread variables) no + longer requires symbolic debug information (e.g. DWARF-2). + * New commands + set substitute-path + unset substitute-path + show substitute-path + Manage a list of substitution rules that GDB uses to rewrite the name + of the directories where the sources are located. This can be useful + for instance when the sources were moved to a different location + between compilation and debugging. + set trace-commands + show trace-commands + Print each CLI command as it is executed. Each command is prefixed with + a number of `+' symbols representing the nesting depth. + The source command now has a `-v' option to enable the same feature. + * REMOVED features + The ARM Demon monitor support (RDP protocol, "target rdp"). + Kernel Object Display, an embedded debugging feature which only worked with + an obsolete version of Cisco IOS. + The 'set download-write-size' and 'show download-write-size' commands. + * New remote packets + qSupported: + Tell a stub about GDB client features, and request remote target features. + The first feature implemented is PacketSize, which allows the target to + specify the size of packets it can handle - to minimize the number of + packets required and improve performance when connected to a remote + target. + qXfer:auxv:read: + Fetch an OS auxilliary vector from the remote stub. This packet is a + more efficient replacement for qPart:auxv:read. + * Removed remote packets + qPart:auxv:read: + This packet has been replaced by qXfer:auxv:read. Only GDB 6.4 and 6.5 + used it, and only gdbserver implemented it. + +------------------------------------------------------------------- +Sat Dec 2 21:38:33 CET 2006 - schwab@suse.de + +- Update to gdb 6.5.90. + +------------------------------------------------------------------- +Sat Oct 28 00:25:25 CEST 2006 - schwab@suse.de + +- Rename detach-fork to detach fork. + +------------------------------------------------------------------- +Tue Oct 24 13:35:52 CEST 2006 - schwab@suse.de + +- Better fix for function descriptor handling on ppc64. + +------------------------------------------------------------------- +Fri Aug 25 13:40:31 CEST 2006 - schwab@suse.de + +- Minimal support for .gnu.hash. + +------------------------------------------------------------------- +Thu Aug 24 14:18:29 CEST 2006 - schwab@suse.de + +- Fix off-by-one in add_symbol_file_command [#200831]. + +------------------------------------------------------------------- +Fri Aug 11 14:45:43 CEST 2006 - schwab@suse.de + +- Correctly extend addresses read from link map. + +------------------------------------------------------------------- +Sun Jul 16 23:22:08 CEST 2006 - schwab@suse.de + +- Fix function decriptor handing on ppc64. + +------------------------------------------------------------------- +Wed Jun 21 10:16:16 CEST 2006 - schwab@suse.de + +- Update to final gdb 6.5. + +------------------------------------------------------------------- +Sat Jun 3 10:04:56 CEST 2006 - schwab@suse.de + +- Update to gdb 6.5 RC 1. + +------------------------------------------------------------------- +Wed May 31 14:41:40 CEST 2006 - schwab@suse.de + +- Set long double size to 16 [#180103]. + +------------------------------------------------------------------- +Mon May 22 14:53:53 CEST 2006 - schwab@suse.de + +- Update to gdb 6.4.90 snapshot 20060522. + +------------------------------------------------------------------- +Sun Apr 23 16:05:38 CEST 2006 - schwab@suse.de + +- Add patch to avoid losing compilation directory. +- Fix a parallel build problem. + +------------------------------------------------------------------- +Tue Apr 4 21:48:43 CEST 2006 - schwab@suse.de + +- Relocate PIEs. + +------------------------------------------------------------------- +Mon Mar 27 00:47:48 CEST 2006 - schwab@suse.de + +- Handle .eh_frame register encoding that is different from .dwarf_frame. +- Remove obsolete patch. + +------------------------------------------------------------------- +Wed Jan 25 21:30:16 CET 2006 - mls@suse.de + +- converted neededforbuild to BuildRequires + +------------------------------------------------------------------- +Mon Jan 23 12:01:15 CET 2006 - schwab@suse.de + +- Add fix for PIC prologue analyzer on powerpc. + +------------------------------------------------------------------- +Wed Dec 14 01:11:46 CET 2005 - schwab@suse.de + +- Add fix for observer notify queue after attach. + +------------------------------------------------------------------- +Fri Dec 2 15:13:15 CET 2005 - schwab@suse.de + +- Update to gdb 6.4. + +------------------------------------------------------------------- +Tue Nov 22 13:11:03 CET 2005 - schwab@suse.de + +- Update to gdb 6.3.90. + +------------------------------------------------------------------- +Fri Nov 4 01:06:09 CET 2005 - schwab@suse.de + +- Update to gdb-6.3.50 snapshot 20051103. + +------------------------------------------------------------------- +Mon Oct 3 14:47:06 CEST 2005 - schwab@suse.de + +- Update to gdb 6.3.50 snapshot 20051003. + +------------------------------------------------------------------- +Mon Sep 19 19:06:04 CEST 2005 - schwab@suse.de + +- Fix warnings. + +------------------------------------------------------------------- +Sun Aug 21 15:04:46 CEST 2005 - schwab@suse.de + +- Add DWARF CFI unwinder on ppc. + +------------------------------------------------------------------- +Mon Jun 20 23:33:40 CEST 2005 - schwab@suse.de + +- Require libunwind-devel on ia64. + +------------------------------------------------------------------- +Thu Jun 9 15:51:37 CEST 2005 - schwab@suse.de + +- Add patch for ia64 vDSO support and unwinding through signals and + syscalls [#60766]. + +------------------------------------------------------------------- +Mon Apr 11 20:35:27 CEST 2005 - schwab@suse.de + +- Fix backtrace through vsyscall [#63483]. + +------------------------------------------------------------------- +Mon Apr 11 01:13:30 CEST 2005 - schwab@suse.de + +- Add patch to fix bugs in rs6000/powerpc register set functions. +- Fix a testsuite bug. + +------------------------------------------------------------------- +Sun Mar 6 17:52:14 CET 2005 - schwab@suse.de + +- Add patch to suppress fork attach/detach messages. + +------------------------------------------------------------------- +Wed Mar 2 17:41:41 CET 2005 - schwab@suse.de + +- Add patch to fix following vfork from a secondary thread. + +------------------------------------------------------------------- +Mon Feb 28 15:26:00 CET 2005 - schwab@suse.de + +- Don't ignore DW_TAG_member [#66406]. + +------------------------------------------------------------------- +Tue Feb 1 17:02:10 CET 2005 - schwab@suse.de + +- Find separate debug symbol files in /usr/lib/debug by default. + +------------------------------------------------------------------- +Thu Jan 27 17:13:46 CET 2005 - schwab@suse.de + +- Add patch to handle back-to-back and nested signals. + +------------------------------------------------------------------- +Thu Jan 27 13:21:20 CET 2005 - schwab@suse.de + +- Add patch to implement reggroups for ppc. + +------------------------------------------------------------------- +Wed Jan 26 11:14:23 CET 2005 - schwab@suse.de + +- Add patch to implement PPC GNU/Linux sigtramp frame code. + +------------------------------------------------------------------- +Wed Jan 12 14:26:25 CET 2005 - schwab@suse.de + +- Don't error out when encountering an unavailable value. + +------------------------------------------------------------------- +Fri Dec 3 15:33:47 CET 2004 - schwab@suse.de + +- Downgrade errors to warnings during backtrace [#48484]. +- Undocument --readnever since it may not be supported by future releases. +- Fix patches from last change. + +------------------------------------------------------------------- +Fri Dec 3 14:05:13 CET 2004 - kukuk@suse.de + +- Add --readnever option as workaround for [#48485] + +------------------------------------------------------------------- +Sun Nov 14 21:47:53 CET 2004 - schwab@suse.de + +- Add libunwind-devel to neededforbuild. + +------------------------------------------------------------------- +Sat Nov 13 15:59:26 CET 2004 - schwab@suse.de + +- Fix missing dependencies. + +------------------------------------------------------------------- +Wed Nov 10 11:56:32 CET 2004 - schwab@suse.de + +- Version 6.2.91 renamed to 6.3. + +------------------------------------------------------------------- +Tue Nov 9 00:57:31 CET 2004 - schwab@suse.de + +- Update to gdb 6.2.91 (6.3 release candidate). + +------------------------------------------------------------------- +Mon Nov 8 15:34:08 CET 2004 - schwab@suse.de + +- Revert last change. +- Fix typo. + +------------------------------------------------------------------- +Mon Nov 8 15:04:27 CET 2004 - uli@suse.de + +- fixed to build on s390* + +------------------------------------------------------------------- +Mon Oct 25 14:51:07 CEST 2004 - schwab@suse.de + +- Fix building gdbserver on x86-64. + +------------------------------------------------------------------- +Mon Oct 25 11:43:37 CEST 2004 - schwab@suse.de + +- Update to gdb 6.2.90. +- Use libunwind on ia64. + +------------------------------------------------------------------- +Thu Sep 9 10:13:11 CEST 2004 - schwab@suse.de + +- Update to gdb 6.2.1. + +------------------------------------------------------------------- +Wed Aug 25 16:00:27 CEST 2004 - schwab@suse.de + +- Fix deadlock in child_wait [#42796]. + +------------------------------------------------------------------- +Tue Aug 24 16:43:36 CEST 2004 - schwab@suse.de + +- Import latest changes from 6.2 branch. + +------------------------------------------------------------------- +Fri Jul 30 15:23:17 CEST 2004 - schwab@suse.de + +- Update to gdb 6.2. + +------------------------------------------------------------------- +Thu Jul 29 15:53:51 CEST 2004 - schwab@suse.de + +- Update to gdb 6.1.92. + +------------------------------------------------------------------- +Mon Jul 26 21:08:42 CEST 2004 - schwab@suse.de + +- Fix handling of relative filenames in DWARF2 .debug_line. + +------------------------------------------------------------------- +Mon Jul 19 13:01:27 CEST 2004 - schwab@suse.de + +- Update to gdb 6.1.91. + +------------------------------------------------------------------- +Thu Jun 24 14:26:28 CEST 2004 - schwab@suse.de + +- Better handling of dying threads. + +------------------------------------------------------------------- +Fri Jun 18 23:57:13 CEST 2004 - schwab@suse.de + +- Update to gdb 6.1.1. + +------------------------------------------------------------------- +Tue May 25 17:14:03 CEST 2004 - schwab@suse.de + +- Fix handling of short lived threads [#40841]. + +------------------------------------------------------------------- +Sat May 1 15:07:32 CEST 2004 - schwab@suse.de + +- Restore removed hunk. + +------------------------------------------------------------------- +Fri Apr 30 21:31:35 CEST 2004 - meissner@suse.de + +- applied 3 patches to fix problems on ppc64. #39394 + +------------------------------------------------------------------- +Sat Apr 17 15:55:23 CEST 2004 - schwab@suse.de + +- Pacify autobuild. + +------------------------------------------------------------------- +Mon Apr 5 11:40:31 CEST 2004 - schwab@suse.de + +- Version 6.0.92 has been renamed to 6.1. + +------------------------------------------------------------------- +Sat Apr 3 20:34:55 CEST 2004 - schwab@suse.de + +- Update to gdb 6.0.92 (6.1 release candidate). + +------------------------------------------------------------------- +Tue Mar 30 16:50:40 CEST 2004 - schwab@suse.de + +- Fix invalid use of va_list. + +------------------------------------------------------------------- +Mon Mar 29 23:29:09 CEST 2004 - schwab@suse.de + +- Update to gdb 6.0.91. + +------------------------------------------------------------------- +Mon Mar 29 15:40:16 CEST 2004 - schwab@suse.de + +- Update to current CVS. + +------------------------------------------------------------------- +Fri Mar 19 11:59:48 CET 2004 - schwab@suse.de + +- Fix last change: don't disable testsuite. + +------------------------------------------------------------------- +Wed Mar 17 10:00:43 CET 2004 - mludvig@suse.cz + +- Added opcodes for VIA PadLock instructions. + +------------------------------------------------------------------- +Tue Mar 2 14:28:18 CET 2004 - schwab@suse.de + +- Update to gdb 6.0.90. +- Run testsuite. + +------------------------------------------------------------------- +Thu Jan 8 18:37:10 CET 2004 - schwab@suse.de + +- Fix gate area range. + +------------------------------------------------------------------- +Wed Dec 10 18:16:55 CET 2003 - schwab@suse.de + +- Support DW_TAG_subrange_type. +- Backport recent ia64 improvements from mainline. + +------------------------------------------------------------------- +Tue Oct 21 14:36:49 CEST 2003 - mludvig@ + +- Add support for debugging both i386 and amd64 apps by a single + amd64 GDB binary. + +------------------------------------------------------------------- +Mon Oct 20 16:44:00 CEST 2003 - mludvig@suse.cz + +- Correctly interpret symbol tables for debugging kernel modules + (gdb6-symtab-minimal.diff) +- Fixed support for GCC variable tracking (gdb6-vartrack.diff) +- Fixed support for Fortran arrays (gdb6-fortranarray.diff) + +------------------------------------------------------------------- +Tue Oct 7 14:50:24 CEST 2003 - schwab@suse.de + +- Hack to build on sparc. + +------------------------------------------------------------------- +Mon Oct 6 22:33:00 CEST 2003 - schwab@suse.de + +- Update to gdb 6.0. + +------------------------------------------------------------------- +Fri Oct 3 10:48:16 CEST 2003 - kukuk@suse.de + +- Remove unused tetex from neededforbuild + +------------------------------------------------------------------- +Mon Sep 29 12:00:35 CEST 2003 - schwab@suse.de + +- Update to gdb 5.3.93 pre-release. + +------------------------------------------------------------------- +Wed Sep 17 18:39:07 CEST 2003 - schwab@suse.de + +- Remove debugging hooks. + +------------------------------------------------------------------- +Wed Sep 17 17:50:23 CEST 2003 - schwab@suse.de + +- Ignore more insns during i386 prologue decoding [#30288]. +- Fix hash table mixup in bfd_simple interface. + +------------------------------------------------------------------- +Tue Sep 16 14:50:44 CEST 2003 - schwab@suse.de + +- Update to gdb 5.3.92 pre-release. + * Fixes bug 31033. + +------------------------------------------------------------------- +Wed Sep 3 17:56:43 CEST 2003 - schwab@suse.de + +- Update to gdb 5.3.91 pre-release. + +------------------------------------------------------------------- +Tue Aug 19 14:09:44 CEST 2003 - schwab@suse.de + +- Update to gdb 5.3.90 2003-08-19 cvs snapshot. + +------------------------------------------------------------------- +Mon Jun 23 13:16:24 CEST 2003 - kukuk@suse.de + +- Fix compiling on SPARC + +------------------------------------------------------------------- +Tue Jun 10 15:54:25 CEST 2003 - schwab@suse.de + +- Don't package mmalloc.info, since libmmalloc isn't included either. + +------------------------------------------------------------------- +Thu May 15 12:09:51 CEST 2003 - schwab@suse.de + +- Remove unwanted files. + +------------------------------------------------------------------- +Thu Apr 24 12:20:23 CEST 2003 - ro@suse.de + +- fix install_info --delete call and move from preun to postun + +------------------------------------------------------------------- +Fri Apr 11 10:14:30 CEST 2003 - mludvig@suse.cz + +- Fix read_2u() function in dwarf2cfi.c + +------------------------------------------------------------------- +Thu Apr 10 18:09:43 CEST 2003 - mludvig@suse.cz + +- Add 'info cfi
' command. +- Fix off-by-4 bug in the CFI parser. + +------------------------------------------------------------------- +Mon Apr 7 13:11:34 CEST 2003 - schwab@suse.de + +- Only delete info entries when removing last version. + +------------------------------------------------------------------- +Thu Mar 27 17:01:30 CET 2003 - schwab@suse.de + +- Fix specfile. + +------------------------------------------------------------------- +Thu Mar 6 15:46:52 CET 2003 - aj@suse.de + +- Fix neededforbuild. + +------------------------------------------------------------------- +Wed Feb 26 17:35:10 CET 2003 - mludvig@suse.cz + +- Added loclist support +- Fixed eh_frame parsing problems +- Updated for proposed x86-64 ABI change + +------------------------------------------------------------------- +Thu Feb 6 17:48:35 CET 2003 - schwab@suse.de + +- Use %install_info. + +------------------------------------------------------------------- +Tue Feb 4 20:22:27 CET 2003 - schwab@suse.de + +- Enable TUI. + +------------------------------------------------------------------- +Sun Jan 26 20:39:57 CET 2003 - olh@suse.de + +- add inital native ppc64 support + +------------------------------------------------------------------- +Thu Jan 09 13:51:58 CET 2003 - mludvig@suse.cz + +- Fixed compilation problem with last gdb-asmbtrace.diff. + No new feature. + +------------------------------------------------------------------- +Tue Jan 07 17:41:49 CET 2003 - mludvig@suse.cz + +- Several Dwarf2 and x86-64 specific changes + * Added ability to do backtrace from some functions + without debug info (patch gdb-asmbtrace.diff) + * Fixed crash on re-run of a debugged program. + * Added some more verbosity to dwarf2cfi engine. + +------------------------------------------------------------------- +Thu Dec 12 15:03:36 CET 2002 - schwab@suse.de + +- Update to gdb 5.3. + * GNU/Linux shared library multi-threaded performance improved. + * ``gdbserver'' now supports multi-threaded applications on some targets + * GDB now supports C/C++ preprocessor macros. + +------------------------------------------------------------------- +Fri Oct 11 11:44:53 CEST 2002 - aj@suse.de + +- Handle gcc code generated by gcc -f-elimante-dwarf2-dups -g. + +------------------------------------------------------------------- +Thu Sep 26 12:13:23 CEST 2002 - schwab@suse.de + +- Avoid installing libbfd, libopcodes, libiberty and libmmalloc [#20199]. + +------------------------------------------------------------------- +Wed Sep 18 17:15:11 CEST 2002 - sf@suse.de + +- added patch from mludvig to remove framepointer on x86_64 + +------------------------------------------------------------------- +Wed Sep 4 10:34:56 CEST 2002 - kukuk@suse.de + +- Add Patch for reading SPARC core files + +------------------------------------------------------------------- +Tue Sep 3 14:01:05 CEST 2002 - schwab@suse.de + +- Remove tetex from neededforbuild. + +------------------------------------------------------------------- +Wed Jul 24 10:51:03 CEST 2002 - schwab@suse.de + +- Update to gdb 5.2.1. + +------------------------------------------------------------------- +Thu Jul 18 12:26:11 CEST 2002 - mludvig@suse.de + +- Fix PLT recognisation. + +------------------------------------------------------------------- +Mon Jul 8 15:19:58 CEST 2002 - schwab@suse.de + +- Add fix for memory leak. + +------------------------------------------------------------------- +Tue Jul 2 16:05:09 CEST 2002 - mludvig@suse.cz + +- removed my previous patches +- added a huge one suse-521-x8664.diff + +------------------------------------------------------------------- +Thu Jun 6 12:38:48 CEST 2002 - sf@suse.de + +- added fpregset.diff (from mludvig@suse.de) +- added dwarf2cfi.diff (from mludvig@suse.de) + +------------------------------------------------------------------- +Wed May 15 12:05:22 CEST 2002 - sf@suse.de + +- added some dwarf2-patches for x86_64 + (from mludvig@suse.de) + +------------------------------------------------------------------- +Thu May 9 19:03:27 CEST 2002 - schwab@suse.de + +- Fix breakpoints on MLX bundle. + +------------------------------------------------------------------- +Mon May 6 17:57:10 CEST 2002 - schwab@suse.de + +- Sparc doesn't have gdbserver either. + +------------------------------------------------------------------- +Sun May 5 15:57:22 CEST 2002 - schwab@suse.de + +- Update to gdb 5.2. +- Gdbserver now available for all but alpha. + +------------------------------------------------------------------- +Fri Jan 25 11:10:12 CET 2002 - schwab@suse.de + +- Update to gdb 5.1.1. + +------------------------------------------------------------------- +Thu Nov 22 15:22:51 CET 2001 - schwab@suse.de + +- Update to gdb 5.1. +- Build and install gdbserver on i386 and ia64. + +------------------------------------------------------------------- +Sat Aug 18 22:59:47 CEST 2001 - schwab@suse.de + +- Update to gdb snapthot 20010316. + +------------------------------------------------------------------- +Fri May 18 15:40:30 CEST 2001 - schwab@suse.de + +- Include ia64 warning patches (from nadvornik@suse.cz). + +------------------------------------------------------------------- +Thu Apr 12 15:15:53 CEST 2001 - schwab@suse.de + +- Remove declaration of tilde_expand, now in readline header. + +------------------------------------------------------------------- +Sun Apr 1 01:12:02 CEST 2001 - schwab@suse.de + +- Fix hardware watchpoints on ia64. + +------------------------------------------------------------------- +Fri Mar 30 14:45:15 CEST 2001 - schwab@suse.de + +- Fix crash on info architecture (#6865). + +------------------------------------------------------------------- +Wed Mar 28 10:57:09 CEST 2001 - schwab@suse.de + +- Use installed readline library. + +------------------------------------------------------------------- +Tue Mar 6 18:25:45 CET 2001 - schwab@suse.de + +- Remove some ia64 hacks. + +------------------------------------------------------------------- +Tue Dec 12 18:22:12 CET 2000 - schwab@suse.de + +- Improve handling of breakpoints in shared libraries. + +------------------------------------------------------------------- +Fri Nov 17 11:25:57 CET 2000 - kukuk@suse.de + +- Update to working gdb snapshot + +------------------------------------------------------------------- +Wed Sep 27 12:56:18 CEST 2000 - fober@suse.de + +- s390: added s390-sigregs-SuSE.patch + +------------------------------------------------------------------- +Thu Sep 14 14:38:38 CEST 2000 - fober@suse.de + +- s390: incorporate new ibm patches for gdb 5.0 + +------------------------------------------------------------------- +Wed Sep 6 17:20:46 CEST 2000 - fober@suse.de + +- s390: incorporate ibm patches for gdb 5.0 + +------------------------------------------------------------------- +Fri Jun 30 16:37:17 CEST 2000 - kukuk@suse.de + +- Add gdb-5.0 + +------------------------------------------------------------------- +Tue Apr 4 12:43:40 MEST 2000 - bk@suse.de + +- s390 team added s390 support + +------------------------------------------------------------------- +Tue Mar 21 17:33:22 CET 2000 - schwab@suse.de + +- Fix core dump reading (#2586). + +------------------------------------------------------------------- +Fri Feb 4 14:14:20 CET 2000 - kukuk@suse.de + +- Add patches for PPC +- Move /usr/info -> /usr/share/info + +------------------------------------------------------------------- +Mon Dec 6 16:52:58 MET 1999 - kukuk@suse.de + +- Remove gdb 4.17 +- Add gdb 4.18 fixes for SPARC + +------------------------------------------------------------------- +Mon Sep 13 17:23:57 CEST 1999 - bs@suse.de + +- ran old prepare_spec on spec file to switch to new prepare_spec. + +------------------------------------------------------------------- +Fri Sep 3 12:00:15 MEST 1999 - kukuk@suse.de + +- Use RPM values for CFLAGS and configure + +------------------------------------------------------------------- +Tue Aug 24 17:05:53 MEST 1999 - uli@suse.de + +- added -fsigned-char to CFLAGS (PPC) + +------------------------------------------------------------------- +Mon Aug 23 18:14:32 MEST 1999 - kukuk@suse.de + +- Add gdb 4.18 thread patch from RH + +------------------------------------------------------------------- +Mon Jul 19 09:54:42 MEST 1999 - florian@suse.de + +- add gdb-4.17.0.12 as /usr/bin/gdb-4.17 + +------------------------------------------------------------------- +Wed Jul 7 17:16:59 MEST 1999 - kukuk@suse.de + +- update to 4.18 using diff from jurix + +------------------------------------------------------------------- +Mon Feb 22 23:39:42 MET 1999 - ro@suse.de + +- update to 4.17.0.11 using diff from jurix + +------------------------------------------------------------------- +Thu Jan 21 14:05:35 MET 1999 - ro@suse.de + +- update to 4.17.0.8 + +------------------------------------------------------------------- +Thu Oct 1 16:55:44 MEST 1998 - ro@suse.de + +- update to 4.17.0.4 using jurix-diff + +------------------------------------------------------------------- +Tue Sep 15 11:18:43 MEST 1998 - ro@suse.de + +- hacked for GLIBC: include sys/ucontext and sys/ptrace where needed +- catch strup redeclarations +- cleaned up patch-sequence + +---------------------------------------------------------------------- +Wed Oct 29 00:00:08 MET 1997 - florian@suse.de + +- fix in libc to correctly support core-files + +- add bug-fix to read symbols from dynamic symbol tables + +- apply all patches from debian gdb-4.16-11 + + +---------------------------------------------------------------------- +Tue Oct 22 15:43:38 MET DST 1996 - florian@suse.de + + +Neue Version 4.16. + +gdb kompiliert nur mit libc 5.4.7 richtig. Mit 5.2.18 kann gdb +keine core-files lesen. +Ich waere dafuer, einfach das Binary von libc 5.4.7 zu benutzen. +Wird schon funktionieren... diff --git a/gdb.spec b/gdb.spec new file mode 100644 index 0000000..28573e6 --- /dev/null +++ b/gdb.spec @@ -0,0 +1,1438 @@ +# +# spec file +# +# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2012 RedHat +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define flavor @BUILD_FLAVOR@%{nil} + +%bcond_with ringdisabled +%bcond_with for_chroot + +%if "%flavor" == "testsuite" +%if %{with ringdisabled} +ExclusiveArch: do_not_build +%endif +%if 0%{?qemu_user_space_build} +# In a qemu_user_space_build ptrace is not supported, so we can't test gdb. +ExclusiveArch: do_not_build +%endif + +# Disable big-endian ppc testing. +ExcludeArch: ppc ppc64 + +%define build_main 0 +%define build_testsuite 1 +%else +%define build_main 1 +%define build_testsuite 0 +%endif + +%if %{build_testsuite} +%define debug_package %{nil} +%endif + +%if %{build_main} +%define name_suffix %{nil} +%else +%if %{build_testsuite} +%define name_suffix -testresults +%else +%define name_suffix -%{flavor} +%endif +%endif + +%bcond_without fpc + +%if %{build_main} +Summary: A GNU source-level debugger for C, C++, Fortran and other languages +License: GPL-3.0-only WITH GCC-exception-3.1 AND GPL-3.0-or-later AND LGPL-2.1-or-later AND LGPL-3.0-or-later +Group: Development/Languages/C and C++ +%endif +%if %{build_testsuite} +Summary: GDB testsuite results +License: SUSE-Public-Domain +Group: Development/Languages/C and C++ +%endif +Name: gdb%{name_suffix} + +Version: 13.2 +Release: 0 + +# The release always contains a leading reserved number, start it at 1. +# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. + +BuildRoot: %{_tmppath}/%{name}-%{version}-build +# Do not provide URL for snapshots as the file lasts there only for 2 days. +# ftp://sourceware.org/pub/gdb/releases/gdb-%%{version}.tar.gz +Source: gdb-%{version}.tar.bz2 +URL: http://gnu.org/software/gdb/ + +%if "%{scl}" == "devtoolset-1.1" +Obsoletes: devtoolset-1.0-%{pkg_name} +%endif + +# For our convenience +%global gdb_src gdb-%{version} +%global gdb_build build-%{_target_platform} +%global gdb_docdir %{_docdir}/gdb-doc + +%global have_inproctrace 0 +%ifarch %{ix86} x86_64 +%global have_inproctrace 1 +%endif # %%{ix86} x86_64 + +# Choose python version +%if 0%{?suse_version} >= 1200 +%define python python3 +%else +# Skip for SLE-11 due to lack of python3. +%define _without_python 1 +%endif + +# GDB patches have the format `gdb--bz-.patch'. +# They should be created using patch level 1: diff -up ./gdb (or gdb-6.3/gdb). + +#= +#push=Should be pushed upstream. +#maybepush=Should be pushed upstream unless it got obsoleted there. +#fedora=Should stay as a Fedora patch. +#ia64=Drop after RHEL-5 rebases and rebuilds are no longer meaningful. +#fedoratest=Keep it in Fedora only as a regression test safety. +#+ppc=Specific for ppc32/ppc64/ppc* +#+work=Requires some nontrivial work. + +# Cleanup any leftover testsuite processes as it may stuck mock(1) builds. +#=push +Source2: gdb-orphanripper.c + +# Man page for gstack(1). +#=push +Source3: gdb-gstack.man + +# /etc/gdbinit (from Debian but with Fedora compliant location). +#=fedora +Source4: gdbinit +Source5: gdbinit.without-python + +# libipt: Intel Processor Trace Decoder Library +%global libipt_version 2.0.5 +Source7: v%{libipt_version}.tar.gz + +# Infrastructure to sync patches from the Fedora rpm +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 +Source17: qa-local.sh +Source18: qa-remote.sh +Source19: README.qa +Source20: import-fedora.sh + +%if %{build_testsuite} +NoSource: 0 +NoSource: 2 +NoSource: 3 +NoSource: 4 +NoSource: 5 +NoSource: 7 +NoSource: 10 +NoSource: 11 +NoSource: 12 +NoSource: 13 +NoSource: 14 +NoSource: 15 +NoSource: 16 +NoSource: 17 +NoSource: 18 +NoSource: 19 +NoSource: 20 +%endif + +# Fedora import from branch f38, commit 82cc8e0. + +#Fedora Packages begin +Patch2: gdb-6.3-gstack-20050411.patch +Patch3: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch +Patch4: gdb-6.5-sharedlibrary-path.patch +Patch6: gdb-6.5-last-address-space-byte-test.patch +Patch8: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch +Patch9: gdb-6.5-bz109921-DW_AT_decl_file-test.patch +Patch11: gdb-6.3-bz202689-exec-from-pthread-test.patch +Patch12: gdb-6.6-bz229517-gcore-without-terminal.patch +Patch13: gdb-6.6-testsuite-timeouts.patch +Patch14: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch +Patch15: gdb-6.3-attach-see-vdso-test.patch +Patch16: gdb-6.5-bz243845-stale-testing-zombie-test.patch +Patch17: gdb-6.6-buildid-locate.patch +Patch18: gdb-6.6-buildid-locate-solib-missing-ids.patch +Patch19: gdb-6.6-buildid-locate-rpm.patch +Patch22: gdb-6.7-testsuite-stable-results.patch +Patch23: gdb-6.5-ia64-libunwind-leak-test.patch +Patch24: gdb-6.5-missed-trap-on-step-test.patch +Patch25: gdb-6.5-gcore-buffer-limit-test.patch +Patch26: gdb-6.3-mapping-zero-inode-test.patch +Patch27: gdb-6.8-bz442765-threaded-exec-test.patch +Patch28: gdb-6.5-section-num-fixup-test.patch +Patch30: gdb-simultaneous-step-resume-breakpoint-test.patch +Patch31: gdb-core-open-vdso-warning.patch +Patch32: gdb-ccache-workaround.patch +Patch33: gdb-lineno-makeup-test.patch +Patch35: gdb-archer-next-over-throw-cxx-exec.patch +Patch36: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch +Patch37: gdb-test-bt-cfi-without-die.patch +Patch38: gdb-bz634108-solib_address.patch +Patch39: gdb-test-pid0-core.patch +Patch40: gdb-test-dw2-aranges.patch +Patch42: gdb-glibc-strstr-workaround.patch +Patch43: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch +Patch44: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch +Patch45: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch +Patch46: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch +Patch49: gdb-rhbz1149205-catch-syscall-after-fork-test.patch +Patch50: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch +Patch51: gdb-rhbz1350436-type-printers-error.patch +Patch52: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch +Patch53: gdb-fedora-libncursesw.patch +Patch54: gdb-opcodes-clflushopt-test.patch +Patch55: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch +Patch57: gdb-linux_perf-bundle.patch +Patch59: gdb-rhbz1553104-s390x-arch12-test.patch +Patch60: gdb-binutils29988-read_indexed_address.patch +Patch61: gdb-rhbz2192105-ftbs-dangling-pointer +Patch62: gdb-rhbz2160211-excessive-core-file-warnings.patch +Patch63: gdb-rhbz2196395-debuginfod-legacy-openssl-crash.patch +Patch64: gdb-bz2237515-debuginfod-double-free.patch +Patch65: gdb-bz2237392-dwarf-obstack-allocation.patch +Patch66: gdb-rhbz2233961-CVE-2022-4806.patch +Patch67: gdb-rhbz2233965-memory-leak.patch +Patch68: gdb-rhbz1773651-gdb-index-internal-error.patch +#Fedora Packages end + +# Fedora patches fixup +# These need a number with at least four digits, otherwise patchlist.pl removes +# them when upgrading. + +Patch1000: fixup-gdb-linux_perf-bundle.patch +Patch1002: fixup-gdb-rhbz1553104-s390x-arch12-test.patch +Patch1003: fixup-gdb-glibc-strstr-workaround.patch +Patch1004: fixup-gdb-6.5-bz243845-stale-testing-zombie-test.patch +Patch1005: fixup-gdb-test-bt-cfi-without-die.patch +Patch1006: fixup-2-gdb-rhbz1553104-s390x-arch12-test.patch +Patch1007: fixup-gdb-test-dw2-aranges.patch +Patch1008: fixup-gdb-bz634108-solib_address.patch +Patch1009: fixup-gdb-6.3-gstack-20050411.patch +Patch1010: fixup-gdb-6.3-attach-see-vdso-test.patch +Patch1011: fixup-gdb-lineno-makeup-test.patch +Patch1012: fixup-gdb-rhbz1261564-aarch64-hw-watchpoint-test.pat.patch + +# openSUSE specific + +# Hardcodes /bin/bash, given that path is known. +Patch1100: gdb-gcore-bash.patch +# Make gdb emit zypper install hints, rather than debuginfo-install hints. +Patch1101: gdb-6.6-buildid-locate-rpm-suse.patch + +# openSUSE specific -- testsuite + +# Silences ada pie compilation FAILs. Todo: Fix ada pie compilation. +Patch1200: gdb-testsuite-ada-pie.patch +# Strictly speaking, not a testsuite patch, but purpose is to enable gdb.gdb +# testcases. +##Patch1201: 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. +Patch1202: gdb-testsuite-fix-gdb-server-ext-run-exp-for-obs.patch +# Tests the zypper install hints. +Patch1203: gdb-testsuite-add-gdb.suse-zypper-hint.exp.patch +# Tests that no branding is leaked from sourcing the fedora package. +Patch1204: gdb-testsuite-add-gdb.suse-debranding.exp.patch + +# Patches to upstream + +# 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 + +# Backports from release branch + +# + +# Backports from master, available in next release. + +Patch2000: remove-some-unnecessary-includes-from-exp.y.patch +Patch2001: gdb-testsuite-fix-gdb.gdb-python-helper.exp-with-o2-.patch +Patch2002: gdb-testsuite-simplify-gdb.base-unwind-on-each-insn..patch +Patch2003: gdb-testsuite-handle-output-after-prompt-in-gdb.thre.patch +Patch2004: gdb-testsuite-add-xfail-in-gdb.arch-i386-pkru.exp.patch +Patch2005: gdb-testsuite-factor-out-proc-linux_kernel_version.patch +Patch2006: gdb-testsuite-add-xfail-in-gdb.python-py-record-btra.patch +Patch2007: gdb-testsuite-fix-gdb.threads-schedlock.exp-on-fast-.patch +Patch2008: gdb-testsuite-simplify-gdb.arch-amd64-disp-step-avx..patch +Patch2009: gdb-testsuite-fix-gdb.threads-schedlock.exp-for-gcc-.patch +Patch2010: gdb-testsuite-add-xfail-case-in-gdb.python-py-record.patch +Patch2011: aarch64-avoid-initializers-for-vlas.patch +Patch2012: gdb-tdep-aarch64-fix-frame-address-of-last-insn.patch +Patch2013: fix-pr30369-regression-on-aarch64-arm-pr30506.patch +Patch2014: gdb-testsuite-fix-breakpoint-regexp-in-gdb.ada-out_o.patch +Patch2015: gdb-testsuite-relax-breakpoint-count-check-in-gdb.py.patch +Patch2016: gdb-testsuite-fix-buffer-overflow-in-gdb.base-signed.patch +Patch2017: gdb-testsuite-require-syscall-time-in-gdb.reverse-ti.patch +Patch2018: gdb-testsuite-handle-missing-gdc-in-gdb.dlang-dlang-.patch +Patch2019: gdb-testsuite-add-basic-lmap-for-tcl-8.6.patch +Patch2020: gdb-testsuite-fix-gdb.rust-watch.exp-on-ppc64le.patch +Patch2021: gdb-testsuite-fix-gdb.python-py-breakpoint.exp-timeo.patch +Patch2022: powerpc-fix-for-gdb.reverse-finish-precsave.exp-and-.patch +Patch2023: powerpc-regression-fix-for-reverse-finish-command.patch +Patch2024: gdb-testsuite-don-t-use-string-cat-in-gdb.dwarf2-dw2.patch +Patch2025: move-step_until-procedure.patch +Patch2026: gdb-testsuite-fix-gdb.arch-i386-signal.exp-on-x86_64.patch +Patch2027: gdb-testsuite-fix-regexps-in-gdb.base-step-over-sysc.patch +Patch2028: gdb-testsuite-add-kfail-for-pr-ada-30908.patch +Patch2029: gdb-testsuite-fix-gdb.ada-mi_task_arg.exp-with-newer.patch +Patch2030: gdb-testsuite-fix-gdb.cp-m-static.exp-regression-on-.patch +Patch2031: gdb-symtab-fix-line-number-of-static-const-class-mem.patch +Patch2032: gdb-symtab-handle-pu-in-iterate_over_some_symtabs.patch +Patch2033: gdb-testsuite-fix-gdb.dwarf2-nullptr_t.exp-with-cc-w.patch +Patch2034: gdb-symtab-fix-too-many-symbols-in-gdbpy_lookup_stat.patch +Patch2035: gdb-support-rseq-auxvs.patch +Patch2036: gdb-testsuite-add-xfail-for-gdb-29965-in-gdb.threads.patch +Patch2037: gdb-cli-handle-pending-c-after-rl_callback_read_char.patch +Patch2038: gdb-testsuite-add-have_host_locale.patch +Patch2039: gdb-symtab-find-main-language-without-symtab-expansi.patch +Patch2040: gdb-symtab-don-t-deduplicate-variables-in-gdb-index.patch +Patch2041: xcoffread.c-fix-werror-dangling-pointer-issue-with-m.patch +Patch2042: avoid-manual-memory-management-in-go-lang.c.patch +Patch2043: gdb-go-handle-v3-go_0-mangled-prefix.patch +Patch2044: gdb-symtab-handle-self-reference-die.patch +Patch2045: gdb-symtab-handle-self-reference-in-inherit_abstract.patch +Patch2046: gdb-symtab-add-optimized-out-static-var-to-cooked-in.patch +Patch2047: gdb-testsuite-fix-gdb.python-py-breakpoint.exp-with-.patch +Patch2048: gdb-tui-fix-segfault-in-tui_find_disassembly_address.patch +# Part of upstream commit deb1ba4e38b ("[gdb/tui] Fix TUI resizing for TERM=ansi"). +Patch2049: gdb-testsuite-add-wait_for_msg-arg-to-term-resize-fi.patch + +# Backports from master, not yet available in next release. + +Patch2070: gdb-symtab-work-around-pr-gas-29517.patch +Patch2071: gdb-symtab-add-producer_is_gas.patch +Patch2072: gdb-symtab-work-around-gas-pr28629.patch +Patch2073: gdb-tdep-fix-nr-array-elements-in-ppc64_aggregate_ca.patch +Patch2074: gdb-tui-fix-wmaybe-uninitialized-in-tui_find_disasse.patch + +# Backport from gdb-patches + +# https://sourceware.org/pipermail/gdb-patches/2021-September/182226.html +Patch2100: gdb-python-finishbreakpoint-update.patch +# https://sourceware.org/pipermail/gdb-patches/2021-October/182444.html +Patch2101: gdb-testsuite-prevent-compilation-fails-with-unix-fpie-pie.patch +# https://sourceware.org/pipermail/gdb-patches/2021-October/182919.html +Patch2104: gdb-testsuite-work-around-skip_prologue-problems-in-gdb.threads-process-dies-while-detaching.exp.patch +# https://sourceware.org/pipermail/gdb-patches/2021-May/178990.html +Patch2105: gdb-cli-add-ignore-errors-command.patch +# https://sourceware.org/pipermail/gdb-patches/2023-November/203942.html +Patch2106: gdb-fix-segfault-in-for_each_block-part-2.patch +# https://sourceware.org/pipermail/gdb-patches/2023-November/203928.html +Patch2107: gdb-tui-allow-command-window-of-1-or-2-lines.patch +# https://sourceware.org/pipermail/gdb-patches/2023-November/203929.html +Patch2108: gdb-tui-fix-resizing-of-terminal-to-1-or-2-lines.patch +# https://sourceware.org/pipermail/gdb-patches/2023-November/203943.html +Patch2109: gdb-fix-segfault-in-for_each_block-part-1.patch + +# https://sourceware.org/pipermail/gdb-patches/2023-December/205054.html +Patch2120: gdb-symtab-refactor-condition-in-scan_attributes.patch +Patch2121: gdb-symtab-factor-out-m_die_range_map-usage.patch +Patch2122: gdb-symtab-handle-nullptr-parent-in-parent_map-set_p.patch +Patch2123: gdb-symtab-factor-out-m_deferred_entries-usage.patch +Patch2124: gdb-symtab-resolve-deferred-entries-inter-shard-case.patch +Patch2125: gdb-symtab-keep-track-of-processed-dies-in-shard.patch +Patch2126: gdb-symtab-resolve-deferred-entries-intra-shard-case.patch +Patch2127: gdb-symtab-don-t-defer-backward-refs-inter-cu-intra-.patch +Patch2128: gdb-symtab-recurse-into-c-dw_tag_subprogram-dies-for.patch +Patch2129: gdb-symtab-keep-track-of-all-parents-for-cooked-inde.patch +Patch2130: gdb-symtab-fix-dw_tag_inlined_subroutine-entries-in-.patch + +# Debug patches. + +# + +# Other. Needs comment for each patch. + +# + +# End of patches. + +BuildRequires: bison +BuildRequires: flex +%if 0%{suse_version} > 1110 +%define gcc gcc +%else +%define gcc gcc48 +%endif +BuildRequires: %{gcc} +BuildRequires: %{gcc}-c++ +BuildRequires: gettext +BuildRequires: glibc-devel +%if 0%{suse_version} > 1110 && 0%{suse_version} < 1330 +# GDB supports guile 2.0, but not guile 2.2 (swo#21104). Disable guile +# support for newer distro versions in anticipation of a move to guile 2.2. +BuildRequires: guile-devel +%endif +BuildRequires: libexpat-devel +%if 0%{suse_version} >= 1200 +BuildRequires: makeinfo +%else +BuildRequires: texinfo +%endif +BuildRequires: expect + +# Dependency is there for SLE-11, but configure test fails. +BuildRequires: mpfr-devel + +BuildRequires: ncurses-devel +BuildRequires: pkg-config +BuildRequires: readline-devel +BuildRequires: rpm-devel +# SLE-10 doesn't have xz-devel. +%if 0%{suse_version} >= 1110 +BuildRequires: xz-devel +%endif +BuildRequires: zlib-devel +%if 0%{!?_without_python:1} +Requires: %{python}-base +BuildRequires: %{python}-devel +%endif # 0%{!?_without_python:1} +%global have_libdebuginfod 0 +%if 0%{?suse_version} > 1500 +%global have_libdebuginfod 1 +%endif +%if 0%{have_libdebuginfod} +BuildRequires: libdebuginfod-devel +%endif +%global have_libipt 0 +%if 0%{suse_version} > 1110 +%ifarch %{ix86} x86_64 +%global have_libipt 1 +BuildRequires: cmake +%endif +%endif + +# BuildArch would break RHEL-5 by overriding arch and not building noarch. +%if 0%{?el5:1} +ExclusiveArch: noarch i386 x86_64 ppc ppc64 ia64 s390 s390x +%endif # 0%{?el5:1} + +%ifarch s390x +%if %{suse_version} > 1500 +BuildRequires: babeltrace-devel +%endif +%endif + +%ifarch i386 x86_64 ppc64 ppc64le aarch64 riscv64 +%if %{suse_version} >= 1500 +BuildRequires: babeltrace-devel +%endif +%endif + +%if 0%{?suse_version} >= 1500 +BuildRequires: libboost_regex-devel +BuildRequires: libsource-highlight-devel +%endif + +%if 0%{?suse_version} >= 1500 +BuildRequires: libzstd-devel +%endif + +%if %{build_testsuite} + +# Copied from gcc9/gcc.spec.in +# Ada currently fails to build on a few platforms, enable it only +# on those that work +%if %{suse_version} >= 1310 +%if %{suse_version} >= 1330 +%define ada_arch %ix86 x86_64 ppc ppc64 ppc64le s390 s390x ia64 aarch64 riscv64 +%else +%define ada_arch %ix86 x86_64 ppc ppc64 s390 ia64 +%endif +%else +%define ada_arch %ix86 x86_64 ppc s390 ia64 +%endif + +# Ensure the devel libraries are installed for both multilib arches. +%global bits_local %{?_isa} +%global bits_other %{?_isa} +%if 0%{!?el5:1} +%ifarch s390x +%global bits_other (%{__isa_name}-32) +%else #!s390x +%ifarch ppc +%global bits_other (%{__isa_name}-64) +%else #!ppc +%ifarch sparc64 ppc64 s390x x86_64 +%global bits_other (%{__isa_name}-32) +%endif #sparc64 ppc64 s390x x86_64 +%endif #!ppc +%endif #!s390x +%endif #!el5 + +BuildRequires: dejagnu +BuildRequires: sharutils +# gcc-objc++ is not covered by the GDB testsuite. + +%if 0%{?suse_version} >= 1200 +# Skip for SLE-11 due to: +# unresolvable: conflict for providers of libquadmath0 +# needed by libgfortran3 +# (provider libquadmath0-gcc5 is in conflict with libquadmath0) +BuildRequires: %{gcc}-fortran +%endif + +BuildRequires: %{gcc}-objc +%ifarch %ada_arch +BuildRequires: %{gcc}-ada +%endif + +%define supported_32bit_arch x86_64 ppc64 + +%if 0%{!?disable_32bit:1} +%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 +BuildRequires: glibc-devel-static-32bit +%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 +# gcc-go package (bsc#1096677), so we only require it for known fixed +# versions. +BuildRequires: gcc-go +%endif + +%if %{with fpc} && 0%{?is_opensuse} +%ifarch x86_64 aarch64 armv7l +# Tumbleweed and Leap 15.x. +%if 0%{?suse_version} >= 1500 +BuildRequires: fpc +%endif +%ifarch %{ix86} +# Tumbleweed and Leap 15.{0,1,2}. +# fpc seems to be unavailable for Leap 15.{3,4}/i586. +%if 0%{?suse_version} > 1500 || (0%{?sle_version} >= 150000 && 0%{?sle_version} <= 150200) +BuildRequires: fpc +%endif +%endif +%endif +%endif + +%if 0%{?suse_version} >= 1200 +%ifnarch s390 +# s390 (for SLE12) doesn't have valgrind +BuildRequires: valgrind +%endif +%endif + +%if 0%{?suse_version} >= 1200 +BuildRequires: systemtap-sdt-devel +%endif + +%if 0%{have_libdebuginfod} +BuildRequires: curl +BuildRequires: elfutils-debuginfod +%endif + +# SLE-10 doesn't have xz. +%if 0%{suse_version} >= 1110 +# Missing on SLE-11 +BuildRequires: xz +%endif + +%if 0%{!?_without_python:1} +# Provide python package xml.etree.ElementTree, used by test-case +# gdb.python/py-send-packet.exp. +BuildRequires: %{python}-xml +%endif + +%endif # %%{build_testsuite} + +%ifarch ia64 +BuildRequires: libunwind-devel +Requires: libunwind +%endif + +%if %{build_main} + +%if 0%{!?_without_python:1} +%if 0%{?suse_version} >= 1500 +# For SLE-15 and later, we use source-highlight by default, and +# pygments as fallback. So, suggests rather than recommends is what we want. +# Don't bother older releases with this. +Suggests: %{python}-Pygments +%endif +%endif + +%description +GDB, the GNU debugger, allows you to debug programs written in C, C++, +Java, and other languages, by executing them in a controlled fashion +and printing their data. + +%package -n gdbserver +Summary: A standalone server for GDB (the GNU source-level debugger) +License: GPL-3.0-only WITH GCC-exception-3.1 AND GPL-3.0-or-later AND LGPL-2.1-or-later AND LGPL-3.0-or-later +Group: Development/Tools/Debuggers + +%description -n gdbserver +GDB, the GNU debugger, allows you to debug programs written in C, C++, +Java, and other languages, by executing them in a controlled fashion +and printing their data. + +This package provides a program that allows you to run GDB on a different +machine than the one which is running the program being debugged. + +%package doc +Summary: Documentation for GDB (the GNU source-level debugger) +License: GFDL-1.3-only +Group: Documentation/Other +PreReq: %{install_info_prereq} + +%if "%{scl}" == "devtoolset-1.1" +Obsoletes: devtoolset-1.0-%{pkg_name}-doc +%endif + +%description doc +GDB, the GNU debugger, allows you to debug programs written in C, C++, +Java, and other languages, by executing them in a controlled fashion +and printing their data. + +This package provides INFO, HTML and PDF user manual for GDB. +%endif + +%if %{build_testsuite} +%description +Results from running the GDB testsuite. +%endif + +%prep +%setup -q -n %{gdb_src} + +%if 0%{?rhel:1} && 0%{?rhel} <= 6 +# libstdc++ pretty printers. +tar xjf %{SOURCE5} +%endif # 0%{?rhel:1} && 0%{?rhel} <= 6 + +# Files have `# ' statements breaking VPATH / find-debuginfo.sh . +rm -f gdb/ada-exp.c gdb/ada-lex.c gdb/c-exp.c gdb/cp-name-parser.c gdb/f-exp.c +rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c gdb/go-exp.c + +# *.info* is needlessly split in the distro tar; also it would not get used as +# we build in %%{gdb_build}, just to be sure. +find -name "*.info*"|xargs rm -f + +#Fedora patching start +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch6 -p1 +%patch8 -p1 +%patch9 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch22 -p1 +%patch23 -p1 +%patch24 -p1 +%patch25 -p1 +%patch26 -p1 +%patch27 -p1 +%patch28 -p1 +%patch30 -p1 +%patch31 -p1 +%patch32 -p1 +%patch33 -p1 +%patch35 -p1 +%patch36 -p1 +%patch37 -p1 +%patch38 -p1 +%patch39 -p1 +%patch40 -p1 +%patch42 -p1 +%patch43 -p1 +%patch44 -p1 +%patch45 -p1 +%patch46 -p1 +%patch49 -p1 +%patch50 -p1 +%patch51 -p1 +%patch52 -p1 +%patch53 -p1 +%patch54 -p1 +%patch55 -p1 +%patch57 -p1 +%patch59 -p1 +%patch60 -p1 +%patch61 -p1 +%patch62 -p1 +%patch63 -p1 +%patch64 -p1 +%patch65 -p1 +%patch66 -p1 +%patch67 -p1 +%patch68 -p1 +#Fedora patching end + +%patch1000 -p1 +%patch1002 -p1 +%patch1003 -p1 +%patch1004 -p1 +%patch1005 -p1 +%patch1006 -p1 +%patch1007 -p1 +%patch1008 -p1 +%patch1009 -p1 +%patch1010 -p1 +%patch1011 -p1 +%patch1012 -p1 + +%patch1100 -p1 +%patch1101 -p1 + +%patch1200 -p1 +#%patch1201 -p1 +%patch1202 -p1 +%patch1203 -p1 +%patch1204 -p1 + +%patch1500 -p1 +%patch1501 -p1 +%patch1503 -p1 +%patch1504 -p1 +%patch1505 -p1 + +%patch2000 -p1 +%patch2001 -p1 +%patch2002 -p1 +%patch2003 -p1 +%patch2004 -p1 +%patch2005 -p1 +%patch2006 -p1 +%patch2007 -p1 +%patch2008 -p1 +%patch2009 -p1 +%patch2010 -p1 +%patch2011 -p1 +%patch2012 -p1 +%patch2013 -p1 +%patch2014 -p1 +%patch2015 -p1 +%patch2016 -p1 +%patch2017 -p1 +%patch2018 -p1 +%patch2019 -p1 +%patch2020 -p1 +%patch2021 -p1 +%patch2022 -p1 +%patch2023 -p1 +%patch2024 -p1 +%patch2025 -p1 +%patch2026 -p1 +%patch2027 -p1 +%patch2028 -p1 +%patch2029 -p1 +%patch2030 -p1 +%patch2031 -p1 +%patch2032 -p1 +%patch2033 -p1 +%patch2034 -p1 +%patch2035 -p1 +%patch2036 -p1 +%patch2037 -p1 +%patch2038 -p1 +%patch2039 -p1 +%patch2040 -p1 +%patch2041 -p1 +%patch2042 -p1 +%patch2043 -p1 +%patch2044 -p1 +%patch2045 -p1 +%patch2046 -p1 +%patch2047 -p1 +%patch2048 -p1 +%patch2049 -p1 + +%patch2070 -p1 +%patch2071 -p1 +%patch2072 -p1 +%patch2073 -p1 +%patch2074 -p1 + +%patch2100 -p1 +%patch2101 -p1 +%patch2104 -p1 +%patch2105 -p1 +%patch2106 -p1 +%patch2107 -p1 +%patch2108 -p1 +%patch2109 -p1 + +%patch2120 -p1 +%patch2121 -p1 +%patch2122 -p1 +%patch2123 -p1 +%patch2124 -p1 +%patch2125 -p1 +%patch2126 -p1 +%patch2127 -p1 +%patch2128 -p1 +%patch2129 -p1 +%patch2130 -p1 + +#unpack libipt +%if 0%{have_libipt} +tar xzf %{SOURCE7} +mv libipt-%{libipt_version} processor-trace-%{libipt_version} +%endif + +find -name "*.orig" | xargs rm -f +! find -name "*.rej" # Should not happen. + +# Remove the info and other generated files added by the FSF release +# process. +rm -f libdecnumber/gstdint.h +rm -f bfd/doc/*.info +rm -f bfd/doc/*.info-* +rm -f gdb/doc/*.info +rm -f gdb/doc/*.info-* + +# 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 +# architecture, to allow for mutliple versions to be installed and +# built. +# Initially we're in the %%{gdb_src} directory. + +for fprofile in %{?_with_profile:-fprofile} "" +do + +mkdir %{gdb_build}$fprofile +cd %{gdb_build}$fprofile + +%if 0%{suse_version} > 1110 +CC=gcc +CXX=g++ +%else +CC=gcc-4.8 +CXX=g++-4.8 +%endif +export CC +export CXX +export CFLAGS="$RPM_OPT_FLAGS" + +# Add your -Wno-x/-Wno-error=y options here: +for opt in -Wno-error=odr -Wno-error=enum-int-mismatch; do + # checking for acceptance of -Wno-foo is a bit wieldy: GCC doesn't + # warn about unknown -Wno- flags, _except_ if there are other + # diagnostics as well, so let's force an uninitialized use warning + # and grep for the diagnostic about the -Wno flag: + if ! echo "int foo(void) { int a; return a;} " | \ + $CC -x c -c - -o /dev/null -W ${opt} 2>&1 | \ + grep -E "Wno|no option" >/dev/null; then + CFLAGS="$CFLAGS ${opt}" + fi +done +%if %{have_libipt} +CFLAGS="$CFLAGS -DPERF_ATTR_SIZE_VER5_BUNDLE" +( + mkdir processor-trace-%{libipt_version}-root + mkdir processor-trace-%{libipt_version}-build + cd processor-trace-%{libipt_version}-build + # -DPTUNIT:BOOL=ON has no effect on ctest. + cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DBUILD_SHARED_LIBS=OFF \ + -DPTUNIT:BOOL=OFF \ + -DDEVBUILD:BOOL=ON \ + ../../processor-trace-%{libipt_version} + make VERBOSE=1 %{?_smp_mflags} + ctest -V %{?_smp_mflags} + make install DESTDIR=../processor-trace-%{libipt_version}-root +) +# There is also: --with-libipt-prefix +CFLAGS="$CFLAGS -I$PWD/processor-trace-%{libipt_version}-root%{_includedir}" +LDFLAGS="$LDFLAGS -L$PWD/processor-trace-%{libipt_version}-root%{_libdir}" +%endif + +export CXXFLAGS="$CFLAGS" + +export LIBRPM=$(ldd /bin/rpm \ + | grep librpm.so \ + | awk '{print $3}') +if [ "$LIBRPM" != "" ]; then + [ -f "$LIBRPM" ] +else + export LIBRPM=no +fi + +%ifarch %ix86 ia64 ppc ppc64 ppc64le s390 s390x x86_64 aarch64 riscv64 +%define build_multitarget 1 +%else +%define build_multitarget 0 +%endif + +%define extra_target_list_common i686 powerpc64le s390x x86_64 aarch64 +%if 0%{?is_opensuse} +%define extra_target_list %{extra_target_list_common} powerpc powerpc64 s390 arm m68k ia64 riscv64 +%define have_elf_extra_target_list 1 +%define elf_extra_target_list avr pru spu +%else +%define extra_target_list %{extra_target_list_common} +%define have_elf_extra_target_list 0 +%endif + +%define DIST %(echo '%distribution' | sed 's, /.*,,') + +%if %build_multitarget +EXTRA_TARGETS="%(printf ,%%s-suse-linux %{extra_target_list})" +%if %{have_elf_extra_target_list} +EXTRA_TARGETS="$EXTRA_TARGETS%(printf ,%%s-elf %{elf_extra_target_list})" +%endif +%else +EXTRA_TARGETS= +%endif + +# Reenable enable-werror on tumbleweed when upgrading to 13.1 (bsc#1211052) +../configure \ + --prefix=%{_prefix} \ + --libdir=%{_libdir} \ + --sysconfdir=%{_sysconfdir} \ + --mandir=%{_mandir} \ + --infodir=%{_infodir} \ + --htmldir=%{gdb_docdir} \ + --pdfdir=%{gdb_docdir} \ + --with-system-gdbinit=%{_sysconfdir}/gdbinit \ + --with-gdb-datadir=%{_datadir}/gdb \ + --enable-gdb-build-warnings=,-Wno-unused \ +%ifnarch %{ix86} alpha ia64 ppc s390 s390x x86_64 ppc64 ppc64le sparc sparcv9 sparc64 riscv64 aarch64 + --disable-werror \ +%else +%if %{suse_version} <= 1110 || %{suse_version} > 1500 + --disable-werror \ +%else + --enable-werror \ +%endif +%endif + --with-separate-debug-dir=/usr/lib/debug \ + --disable-sim \ + --disable-rpath \ + --with-system-zlib \ +%if %{suse_version} >= 1500 + --with-system-readline \ +%else + --without-system-readline \ +%endif + --with-expat \ +$(: ppc64 host build crashes on ppc variant of libexpat.so ) \ + --without-libexpat-prefix \ + --enable-tui \ +%if 0%{!?_without_python:1} + --with-python=%{_bindir}/%{python} \ +%else + --without-python \ +%endif +%if %{suse_version} >= 1130 + --with-rpm=$LIBRPM \ +%else + --without-rpm \ +%endif +%ifarch ia64 + --with-libunwind-ia64 \ +%else + --without-libunwind \ +%endif +%ifarch sparc sparcv9 sparc64 + --without-mmap \ +%endif + --enable-64-bit-bfd \ +%if %{have_inproctrace} + --enable-inprocess-agent \ +%else + --disable-inprocess-agent \ +%endif +%if %{have_libipt} + --with-intel-pt \ +%else + --without-intel-pt \ +%endif + --with-bugurl=http://bugs.opensuse.org/ \ + --with-pkgversion="GDB; %{DIST}" \ +$(: ia64 is obsolete. ) \ + --enable-obsolete \ + ${EXTRA_TARGETS:+--enable-targets="${EXTRA_TARGETS#,}"} \ +%ifarch sparc sparcv9 + --build=sparc-%{_vendor}-%{_target_os}%{?_gnu} +%else +$(: It breaks RHEL-5 by %{_target_platform} being noarch-redhat-linux-gnu ) \ +%ifarch noarch + $(:) +%else + --build=%{_target_platform} +%endif +%endif + +if [ -z "%{!?_with_profile:no}" ] +then + # Run all the configure tests being incompatible with $FPROFILE_CFLAGS. + make %{?_smp_mflags} configure-host configure-target + make %{?_smp_mflags} clean + + # Workaround -fprofile-use: + # linux-x86-low.c:2225: Error: symbol `start_i386_goto' is already defined + make %{?_smp_mflags} -C gdb/gdbserver linux-x86-low.o +fi + +# Global CFLAGS would fail on: +# conftest.c:1:1: error: coverage mismatch for function 'main' while reading counter 'arcs' +if [ "$fprofile" = "-fprofile" ] +then + FPROFILE_CFLAGS='-fprofile-generate' +elif [ -z "%{!?_with_profile:no}" ] +then + FPROFILE_CFLAGS='-fprofile-use' + # We cannot use -fprofile-dir as the bare filenames clash. + (cd ../%{gdb_build}-fprofile; + # It was 333 on x86_64. + test $(find -name "*.gcda"|wc -l) -gt 300 + find -name "*.gcda" | while read -r i + do + ln $i ../%{gdb_build}/$i + done + ) +else + FPROFILE_CFLAGS="" +fi + +# Prepare gdb/config.h first. +make %{?_smp_mflags} V=1 CFLAGS="$CFLAGS $FPROFILE_CFLAGS" LDFLAGS="$LDFLAGS $FPROFILE_CFLAGS" maybe-configure-gdb +perl -i.relocatable -pe 's/^(D\[".*_RELOCATABLE"\]=" )1(")$/${1}0$2/' gdb/config.status + +make %{?_smp_mflags} V=1 CFLAGS="$CFLAGS $FPROFILE_CFLAGS" LDFLAGS="$LDFLAGS $FPROFILE_CFLAGS" + +! grep '_RELOCATABLE.*1' gdb/config.h + +if [ "$fprofile" = "-fprofile" ] +then + cd gdb + cp -p gdb gdb-withindex + PATH="$PWD:$PATH" sh ../../gdb/gdb-add-index $PWD/gdb-withindex + ./gdb -nx -ex q ./gdb-withindex + ./gdb -nx -readnow -ex q ./gdb-withindex + cd .. +fi + +cd .. + +done # fprofile + +cd %{gdb_build} + +#make %{?_smp_mflags} -C gdb/doc {gdb,annotate}{.info,/index.html,.pdf} MAKEHTMLFLAGS=--no-split + +# Copy the /gdb/NEWS file to the directory above it. +cp $RPM_BUILD_DIR/%{gdb_src}/gdb/NEWS $RPM_BUILD_DIR/%{gdb_src} + +%check +# Initially we're in the %%{gdb_src} directory. +cd %{gdb_build} + +%if !%{build_testsuite} +echo ====================TESTSUITE DISABLED========================= +%else +echo ====================TESTING========================= +cd gdb +%if 0%{suse_version} > 1110 +CC=gcc +CXX=g++ +%else +CC=gcc-4.8 +CXX=g++-4.8 +mkdir progs +for i in gcc g++ gcj gfortran gnat gnatbind gnatmake; do + test -f /usr/bin/${i}-4.8 && ln -sf /usr/bin/${i}-4.8 progs/$i +done +PATH="`pwd`"/progs:${PATH} +%endif +export CC +export CXX +$CC -o ./orphanripper %{SOURCE2} -Wall -lutil -ggdb2 +# Need to use a single --ignore option, second use overrides first. +# No `%{?_smp_mflags}' here as it may race. +# WARNING: can't generate a core file - core tests suppressed - check ulimit +# "readline-overflow.exp" - Testcase is broken, functionality is OK. +( + # ULIMIT required for `gdb.base/auxv.exp'. + ulimit -H -c + ulimit -c unlimited || : + + # Setup $CHECK as `check//unix/' or `check//unix/-m64' for explicit bitsize. + # Never use two different bitsizes as it fails on ppc64. + echo 'int main (void) { return 0; }' >biarch.c + CHECK="" + for BI in -m64 -m32 -m31 "" + do + # Do not use size-less options if any of the sizes works. + # On ia64 there is no -m64 flag while we must not leave a bare `check' here + # as it would switch over some testing scripts to the backward compatibility + # mode: when `make check' was executed from inside the testsuite/ directory. + if [ -z "$BI" -a -n "$CHECK" ];then + continue + fi + # Do not use $RPM_OPT_FLAGS as the other non-size options will not be used + # in the real run of the testsuite. + if ! $CC $BI -o biarch biarch.c + then + continue + fi + CHECK="$CHECK check//unix/$BI" + done + # Do not try -m64 inferiors for -m32 GDB as it cannot handle inferiors larger + # than itself. + # s390 -m31 still uses the standard ELF32 binary format. + $CC $RPM_OPT_FLAGS -o biarch biarch.c + RPM_SIZE="$(file ./biarch|sed -n 's/^.*: ELF \(32\|64\)-bit .*$/\1/p')" + if [ "$RPM_SIZE" != "64" ] + then + CHECK="$(echo " $CHECK "|sed 's# check//unix/-m64 # #')" + fi + + # Disable some problematic testcases. + # RUNTESTFLAGS='--ignore ...' is not used below as it gets separated by the + # `check//...' target spawn and too much escaping there would be dense. + DISABLE_TESTS= + 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 + + # Run all the scheduled testsuite runs also in the PIE mode. + # See also: gdb-runtest-pie-override.exp + if rpm -q gcc-PIE; then + CHECK="$(echo $CHECK | sed 's#check//unix/[^ ]*#& &/-fno-PIE/-no-pie#g')" + else + CHECK="$(echo $CHECK | sed 's#check//unix/[^ ]*#& &/-fPIE/-pie#g')" + fi + +%if %{with for_chroot} + # When we want to chroot into a local osc build and run a test-case, we + # need -M testsuite to add all the buildrequires, but there's no need + # to run the testsuite. Instead, fail %check to make sure %clean doesn't + # remove buildroot. + false +%else + ./orphanripper make %{?_smp_mflags} -k $CHECK || : +%endif +) +for t in sum log +do + for file in testsuite*/gdb.$t + do + suffix="${file#testsuite.unix.}" + suffix="${suffix%/gdb.$t}" + ln $file gdb-%{_target_platform}$suffix.$t || : + done +done +# `tar | bzip2 | uuencode' may have some piping problems in Brew. +#tar cjf gdb-%%{_target_platform}.tar.bz2 gdb-%%{_target_platform}*.{sum,log} +#uuencode gdb-%%{_target_platform}.tar.bz2 gdb-%%{_target_platform}.tar.bz2 +# Strip dates and completion times from the log to make build-compare happy +sed -i -e '/Test Run By abuild on/d' -e 's/completed in [0-9]* seconds//' *.{sum,log} +cd ../.. +echo ====================TESTING END===================== +%endif + +%install +# Initially we're in the %%{gdb_src} directory. +cd %{gdb_build} + +# It would break RHEL-5 by leaving excessive files for the doc subpackage. +%ifnarch noarch + +make %{?_smp_mflags} install DESTDIR=$RPM_BUILD_ROOT + +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d +touch -r %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d + +%if 0%{!?_without_python:1} +sed 's#%%{_sysconfdir}#%{_sysconfdir}#g' <%{SOURCE4} >$RPM_BUILD_ROOT%{_sysconfdir}/gdbinit +touch -r %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit +%else +sed 's#%%{_sysconfdir}#%{_sysconfdir}#g' <%{SOURCE5} >$RPM_BUILD_ROOT%{_sysconfdir}/gdbinit +touch -r %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit +%endif + +for i in `find $RPM_BUILD_ROOT%{_datadir}/gdb/python/gdb -name "*.py"` +do + # Files could be also patched getting the current time. + touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/version.in $i +done + +%if 0%{?_enable_debug_packages:1} && 0%{!?_without_python:1} +mkdir -p $RPM_BUILD_ROOT/usr/lib/debug%{_bindir} +cp -p $RPM_BUILD_DIR/%{gdb_src}/gdb/gdb-gdb.py $RPM_BUILD_ROOT/usr/lib/debug%{_bindir}/ +for pyo in "" "-O";do + # RHEL-5: AttributeError: 'module' object has no attribute 'compile_file' + %{python} $pyo -c 'import compileall, re, sys; sys.exit (not compileall.compile_dir("'"$RPM_BUILD_ROOT/usr/lib/debug%{_bindir}"'", 1, "'"/usr/lib/debug%{_bindir}"'"))' +done +%endif # 0%{?_enable_debug_packages:1} && 0%{!?_without_python:1} + +mkdir $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load +%if 0%{?rhel:1} && 0%{?rhel} <= 6 +%if 0%{!?_without_python:1} +# Temporarily now: +for LIB in lib lib64;do + LIBPATH="$RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{_root_prefix}/$LIB" + mkdir -p $LIBPATH + # basename is being run only for the native (non-biarch) file. + sed -e 's,@pythondir@,%{_datadir}/gdb/python,' \ + -e 's,@toolexeclibdir@,%{_root_prefix}/'"$LIB," \ + < $RPM_BUILD_DIR/%{gdb_src}/%{libstdcxxpython}/hook.in \ + > $LIBPATH/$(basename %{_root_prefix}/%{_lib}/libstdc++.so.6.*)-gdb.py + # Test the filename 'libstdc++.so.6.*' has matched. + test -f $LIBPATH/libstdc++.so.6.[0-9]*-gdb.py +done +test ! -e $RPM_BUILD_ROOT%{_datadir}/gdb/python/libstdcxx +cp -a $RPM_BUILD_DIR/%{gdb_src}/%{libstdcxxpython}/libstdcxx \ + $RPM_BUILD_ROOT%{_datadir}/gdb/python/libstdcxx +for i in `find $RPM_BUILD_ROOT%{_datadir}/gdb/python -name "*.py"` \ + `find $RPM_BUILD_ROOT%{_datadir}/gdb/auto-load%{_prefix} -name "*.py"` \ +; do + # Files come from gdb-archer.patch and can be also further patched. + touch -r $RPM_BUILD_DIR/%{gdb_src}/gdb/version.in $i +done +%endif # 0%{!?_without_python:1} +%endif # 0%{?rhel:1} && 0%{?rhel} <= 6 + +# Remove the files that are part of a gdb build but that are owned and +# provided by other packages. +# These are part of binutils + +rm -rf $RPM_BUILD_ROOT%{_datadir}/locale/ +rm -f $RPM_BUILD_ROOT%{_infodir}/bfd* +rm -f $RPM_BUILD_ROOT%{_infodir}/standard* +rm -f $RPM_BUILD_ROOT%{_infodir}/configure* +rm -f $RPM_BUILD_ROOT%{_infodir}/sframe-spec* +rm -rf $RPM_BUILD_ROOT%{_includedir} +rm -rf $RPM_BUILD_ROOT/%{_libdir}/lib{bfd*,opcodes*,iberty*,ctf*,sframe*} + +%if %{build_testsuite} +rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit +rm -rf $RPM_BUILD_ROOT%{_bindir} +rm -rf $RPM_BUILD_ROOT%{_libdir} +rm -rf $RPM_BUILD_ROOT%{_datadir}/gdb +rm -rf $RPM_BUILD_ROOT%{_infodir} +rm -rf $RPM_BUILD_ROOT%{_mandir} +rm -rf $RPM_BUILD_ROOT/usr/src +%endif + +# pstack obsoletion + +%if %{build_main} +cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_mandir}/man1/gstack.1 +%endif +%endif # 0%{!?_with_upstream:1} + +%if %{build_main} +# Packaged GDB is not a cross-target one. +(cd $RPM_BUILD_ROOT%{_datadir}/gdb/syscalls + rm -f mips*.xml +%ifnarch sparc sparcv9 sparc64 + rm -f sparc*.xml +%endif +%ifnarch x86_64 + rm -f amd64-linux.xml +%endif +%ifnarch %{ix86} x86_64 + rm -f i386-linux.xml +%endif +%ifnarch ppc ppc64 + rm -f ppc{,64}-linux.xml +%endif +%ifnarch ppc64le + rm -f ppc64le-linux.xml +%endif +) + +# It would break RHEL-5 by leaving excessive files for the doc subpackage. +%if 0%{?el5:1} +rm -f $RPM_BUILD_ROOT%{_infodir}/annotate.info* +rm -f $RPM_BUILD_ROOT%{_infodir}/gdb.info* +%endif # 0%{?el5:1} +# -j1: There is some race resulting in: +# /usr/bin/texi2dvi: texinfo.tex appears to be broken, quitting. +make -j1 -C gdb/doc install DESTDIR=$RPM_BUILD_ROOT + +# Documentation only for development; keep 'rm's here after "noarch" above. +rm -f $RPM_BUILD_ROOT%{_infodir}/gdbint* +rm -f $RPM_BUILD_ROOT%{_infodir}/stabs* +rm -f $RPM_BUILD_ROOT%{_infodir}/ctf-spec* + +# Delete this too because the dir file will be updated at rpm install time. +# We don't want a gdb specific one overwriting the system wide one. + +rm -f $RPM_BUILD_ROOT%{_infodir}/dir + +%endif + +%post +# This step is part of the installation of the RPM. Not to be confused +# with the 'make install ' of the build (rpmbuild) process. + +# For --excludedocs: +if [ -e %{_infodir}/gdb.info.gz ] +then + %install_info --info-dir=%{_infodir} %{_infodir}/annotate.info.gz + %install_info --info-dir=%{_infodir} %{_infodir}/gdb.info.gz +fi + +%preun +if [ $1 = 0 ] +then + # For --excludedocs: + if [ -e %{_infodir}/gdb.info.gz ] + then + %install_info_delete --delete --info-dir=%{_infodir} %{_infodir}/annotate.info.gz + %install_info_delete --delete --info-dir=%{_infodir} %{_infodir}/gdb.info.gz + fi +fi + +%if %{build_main} +%files +%defattr(-,root,root) +%doc README NEWS +%if 0%{suse_version} >= 1320 +%license COPYING3 COPYING COPYING.LIB +%else +%doc COPYING3 COPYING COPYING.LIB +%endif +%{_bindir}/gcore +%{_mandir}/*/gcore.1* +%{_bindir}/gdb +%config(noreplace) %{_sysconfdir}/gdbinit +%{_sysconfdir}/gdbinit.d +%{_mandir}/*/gdb.1* +%{_bindir}/gstack +%{_mandir}/*/gstack.1* +%{_bindir}/gdb-add-index +%{_mandir}/*/gdb-add-index.1* +%{_mandir}/*/gdbinit.5* +%{_datadir}/gdb +%{_infodir}/annotate.info* +%{_infodir}/gdb.info* +%endif + +%if %{build_testsuite} +%files +%defattr(-,root,root) +%doc %{gdb_build}/gdb/gdb-*.sum +%doc %{gdb_build}/gdb/gdb-*.log +%endif + +# don't include the files in include, they are part of binutils + +%if %{build_main} +%ifnarch sparcv9 hppa +%files -n gdbserver +%defattr(-,root,root) +%{_bindir}/gdbserver +%{_mandir}/*/gdbserver.1* +%if %{have_inproctrace} +%{_libdir}/libinproctrace.so +%endif # %%{have_inproctrace} +%endif +%endif + +%if %{build_main} +%post doc +# This step is part of the installation of the RPM. Not to be confused +# with the 'make install ' of the build (rpmbuild) process. + +# For --excludedocs: +if [ -e %{_infodir}/gdb.info.gz ] +then + /sbin/install-info --info-dir=%{_infodir} %{_infodir}/annotate.info.gz || : + /sbin/install-info --info-dir=%{_infodir} %{_infodir}/gdb.info.gz || : +fi + +%preun doc +if [ $1 = 0 ] +then + # For --excludedocs: + if [ -e %{_infodir}/gdb.info.gz ] + then + /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/annotate.info.gz || : + /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gdb.info.gz || : + fi +fi +%endif + +%changelog diff --git a/gdbinit b/gdbinit new file mode 100644 index 0000000..659605a --- /dev/null +++ b/gdbinit @@ -0,0 +1,8 @@ +# System-wide GDB initialization file. +python +import glob +for f in glob.glob('%{_sysconfdir}/gdbinit.d/*.gdb'): + gdb.execute('source %s' % f) +for f in glob.glob('%{_sysconfdir}/gdbinit.d/*.py'): + gdb.execute('source %s' % f) +end diff --git a/gdbinit.without-python b/gdbinit.without-python new file mode 100644 index 0000000..a3603e8 --- /dev/null +++ b/gdbinit.without-python @@ -0,0 +1,5 @@ +# System-wide GDB initialization file. + +# FIXME: Source /etc/gdbinit.d/*.gdb +# Without python support, there's currently no way to do this. See also +# swo#13578 - "source command file globbing". diff --git a/import-fedora.sh b/import-fedora.sh new file mode 100644 index 0000000..4a738c2 --- /dev/null +++ b/import-fedora.sh @@ -0,0 +1,155 @@ +#!/bin/bash + +# Fedora Packages not copied: +# +skip_patches=( + # Not applicable for openSUSE. + gdb-add-index.patch + gdb-6.3-rh-testversion-20041202.patch + gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch + gdb-6.8-bz466901-backtrace-full-prelinked.patch + gdb-container-rh-pkg.patch + + # Broken. + # Over-specific test-case in a shell script. + gdb-6.5-BEA-testsuite.patch + # Hangs for horizontal-scroll-mode on, times out after 10 minutes. + gdb-6.5-readline-long-line-crash-test.patch + + # Fragile test-case, requires glibc to fail in a certain way. + gdb-rhbz1156192-recursive-dlopen-test.patch + + # Obsolete (dropped by fedora). + gdb-6.7-charsign-test.patch + gdb-test-ivy-bridge.patch + gdb-ppc-power7-test.patch + gdb-6.3-bz140532-ppc-unwinding-test.patch + + # Obsolete. + gdb-6.7-charsign-test.patch + gdb-6.7-ppc-clobbered-registers-O2-test.patch +) + +usage () +{ + echo "usage: $(basename "$0") " +} + +dir="$1" + +if [ ! -f "$dir"/_patch_order ]; then + usage + exit 1 +fi + +mark1="^#Fedora Packages begin" +mark2="^#Fedora Packages end" +mark3="^#Fedora patching start" +mark4="^#Fedora patching end" + +remove_current_patches () +{ + # shellcheck disable=SC2207 + current_patches=($(awk "/$mark1/,/$mark2/{ print }" gdb.spec \ + | grep Patch \ + | awk '{print $2}')) + + for current_patch in "${current_patches[@]}"; do + rm -f "$current_patch" + done +} + +skip () +{ + local p + p="$1" + + for skip_patch in "${skip_patches[@]}"; do + if [ "$p" = "$skip_patch" ]; then + return 0 + fi + done + + return 1 +} + +import_patches () +{ + # Get the parts of gdb.spec that we want to keep unchanged. + awk "NR==1,/$mark1/" gdb.spec \ + > gdb.spec.1 + awk "/$mark2/,/$mark3/" gdb.spec \ + > gdb.spec.3 + awk "/$mark4/,0" gdb.spec \ + > gdb.spec.5 + + # Start generating the parts of gdb.spec that we want to change. + f1=gdb.spec.2 + f2=gdb.spec.4 + rm -f $f1 $f2 + + # Handle each fedora patch. + skipped_patches=() + n=1 + # shellcheck disable=SC2013 + for p in $(cat "$dir"/_patch_order); do + if skip "$p"; then + echo "Skipped: $p" + skipped_patches=("${skipped_patches[@]}" "$p") + + # Keep numbers the same as in fedora package. + n=$((n + 1)) + continue + fi + + cp "$dir"/"$p" . + + printf \ + "%-16s%s\n" "Patch$n:" "$p" \ + >> $f1 + + echo \ + "%patch$n -p1" \ + >> $f2 + + n=$((n + 1)) + done + + # Report which patches did not get skipped. + for skip_patch in "${skip_patches[@]}"; do + found=false + for skipped_patch in "${skipped_patches[@]}"; do + if [ "$skip_patch" = "$skipped_patch" ]; then + found=true + break + fi + done + if ! $found; then + echo "Not skipped: $skip_patch" + fi + done + + # Assemble new gdb.spec. + rm -f gdb.spec.new + for n in $(seq 1 5); do + cat gdb.spec."$n" \ + >> gdb.spec.new + done + + # Cleanup. + for n in $(seq 1 5); do + rm -f gdb.spec."$n" + done + + # Update gdb.spec. + mv gdb.spec.new gdb.spec +} + +main () +{ + remove_current_patches + + import_patches +} + +main "$@" diff --git a/import-patches.sh b/import-patches.sh new file mode 100644 index 0000000..ec964fb --- /dev/null +++ b/import-patches.sh @@ -0,0 +1,100 @@ +#!/bin/sh + +# Invoke as: +# $ ./import-patches.sh [ --dry-run ] /00*.patch + +usage () +{ + echo "./import-patches.sh [ --dry-run ] +" +} + +dryrun=false +case "$1" in + -dryrun|-dry-run|--dryrun|--dry-run) + dryrun=true + shift + ;; +esac + +n="$1" +shift + +case $n in + "") + echo "Missing argument" + usage + exit 1 + ;; + [0-9][0-9]*) + ;; + *) + echo "Need numeric argument" + usage + exit 1 + ;; +esac + +if [ "$n" = "" ]; then + echo "Missing argument" + usage + exit 1 +fi + +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" + + # Filter out ChangeLog entries. + filterdiff -x "*/ChangeLog" tmp.patches/"$f" > tmp.patches/tmp."$f" + mv tmp.patches/tmp."$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/move-step_until-procedure.patch b/move-step_until-procedure.patch new file mode 100644 index 0000000..de58aa1 --- /dev/null +++ b/move-step_until-procedure.patch @@ -0,0 +1,162 @@ +From d1e39adc6c93765434e8c6ddfe6192e85318241b Mon Sep 17 00:00:00 2001 +From: Carl Love +Date: Wed, 1 Mar 2023 11:45:43 -0500 +Subject: [PATCH 8/9] Move step_until procedure + +Procedure step_until from test gdb.reverse/step-indirect-call-thunk.exp +is moved to lib/gdb.exp and renamed repeat_cmd_until. The existing procedure +gdb_step_until in lib/gdb.exp is simpler variant of the new repeat_cmd_until +procedure. The existing procedure gdb_step_until is changed to just call +the new repeat_cmd_until procedure with the command set to "step" and an +optional CURRENT string. The default CURRENT string is set to "\}" to work +with the existing uses of procedure gdb_step_until. +--- + .../gdb.reverse/step-indirect-call-thunk.exp | 49 +++---------------- + gdb/testsuite/lib/gdb.exp | 47 ++++++++++++------ + 2 files changed, 41 insertions(+), 55 deletions(-) + +diff --git a/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp b/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp +index a9d22e45cfc..9970ff57a1b 100644 +--- a/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp ++++ b/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp +@@ -30,39 +30,6 @@ if { ![runto_main] } { + return -1 + } + +-# Do repeated stepping COMMANDs in order to reach TARGET from CURRENT +-# +-# COMMAND is a stepping command +-# CURRENT is a string matching the current location +-# TARGET is a string matching the target location +-# TEST is the test name +-# +-# The function issues repeated COMMANDs as long as the location matches +-# CURRENT up to a maximum of 100 steps. +-# +-# TEST passes if the resulting location matches TARGET and fails +-# otherwise. +-# +-proc step_until { command current target test } { +- global gdb_prompt +- +- set count 0 +- gdb_test_multiple "$command" "$test" { +- -re "$current.*$gdb_prompt $" { +- incr count +- if { $count < 100 } { +- send_gdb "$command\n" +- exp_continue +- } else { +- fail "$test" +- } +- } +- -re "$target.*$gdb_prompt $" { +- pass "$test" +- } +- } +-} +- + gdb_test_no_output "record" + gdb_test "next" ".*" "record trace" + +@@ -82,20 +49,20 @@ gdb_test "reverse-next" "apply\.2.*" \ + "reverse-step through thunks and over inc" + + # We can use instruction stepping to step into thunks. +-step_until "stepi" "apply\.2" "indirect_thunk" "stepi into call thunk" +-step_until "stepi" "indirect_thunk" "inc" \ ++repeat_cmd_until "stepi" "apply\.2" "indirect_thunk" "stepi into call thunk" ++repeat_cmd_until "stepi" "indirect_thunk" "inc" \ + "stepi out of call thunk into inc" + set alphanum_re "\[a-zA-Z0-9\]" + set pic_thunk_re "__$alphanum_re*\\.get_pc_thunk\\.$alphanum_re* \\(\\)" +-step_until "stepi" "(inc|$pic_thunk_re)" "return_thunk" "stepi into return thunk" +-step_until "stepi" "return_thunk" "apply" \ ++repeat_cmd_until "stepi" "(inc|$pic_thunk_re)" "return_thunk" "stepi into return thunk" ++repeat_cmd_until "stepi" "return_thunk" "apply" \ + "stepi out of return thunk back into apply" + +-step_until "reverse-stepi" "apply" "return_thunk" \ ++repeat_cmd_until "reverse-stepi" "apply" "return_thunk" \ + "reverse-stepi into return thunk" +-step_until "reverse-stepi" "return_thunk" "inc" \ ++repeat_cmd_until "reverse-stepi" "return_thunk" "inc" \ + "reverse-stepi out of return thunk into inc" +-step_until "reverse-stepi" "(inc|$pic_thunk_re)" "indirect_thunk" \ ++repeat_cmd_until "reverse-stepi" "(inc|$pic_thunk_re)" "indirect_thunk" \ + "reverse-stepi into call thunk" +-step_until "reverse-stepi" "indirect_thunk" "apply" \ ++repeat_cmd_until "reverse-stepi" "indirect_thunk" "apply" \ + "reverse-stepi out of call thunk into apply" +diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp +index cd043ce3436..b36d3a9d8c1 100644 +--- a/gdb/testsuite/lib/gdb.exp ++++ b/gdb/testsuite/lib/gdb.exp +@@ -9336,31 +9336,50 @@ gdb_caching_proc arm_cc_for_target { + + # Step until the pattern REGEXP is found. Step at most + # MAX_STEPS times, but stop stepping once REGEXP is found. +-# ++# CURRENT matches current location + # If REGEXP is found then a single pass is emitted, otherwise, after + # MAX_STEPS steps, a single fail is emitted. + # + # TEST_NAME is the name used in the pass/fail calls. + +-proc gdb_step_until { regexp {test_name ""} {max_steps 10} } { +- if { $test_name == "" } { +- set test_name "stepping until regexp" +- } ++proc gdb_step_until { regexp {test_name "stepping until regexp"} \ ++ {current "\}"} { max_steps 10 } } { ++ repeat_cmd_until "step" $current $regexp $test_name "10" ++} ++ ++# Do repeated stepping COMMANDs in order to reach TARGET from CURRENT ++# ++# COMMAND is a stepping command ++# CURRENT is a string matching the current location ++# TARGET is a string matching the target location ++# TEST_NAME is the test name ++# MAX_STEPS is number of steps attempted before fail is emitted ++# ++# The function issues repeated COMMANDs as long as the location matches ++# CURRENT up to a maximum of MAX_STEPS. ++# ++# TEST_NAME passes if the resulting location matches TARGET and fails ++# otherwise. ++ ++proc repeat_cmd_until { command current target \ ++ {test_name "stepping until regexp"} \ ++ {max_steps 100} } { ++ global gdb_prompt + + set count 0 +- gdb_test_multiple "step" "$test_name" { +- -re "$regexp\r\n$::gdb_prompt $" { +- pass $test_name +- } +- -re ".*$::gdb_prompt $" { +- if {$count < $max_steps} { +- incr count +- send_gdb "step\n" ++ gdb_test_multiple "$command" "$test_name" { ++ -re "$current.*$gdb_prompt $" { ++ incr count ++ if { $count < $max_steps } { ++ send_gdb "$command\n" + exp_continue + } else { +- fail $test_name ++ fail "$test_name" + } + } ++ -re "$target.*$gdb_prompt $" { ++ pass "$test_name" ++ } + } + } + +-- +2.35.3 + diff --git a/patchlist.pl b/patchlist.pl new file mode 100644 index 0000000..c081f24 --- /dev/null +++ b/patchlist.pl @@ -0,0 +1,74 @@ +#!/usr/bin/perl + +die "need gdb-Fedora directory" unless -d $ARGV[0]; + +my $gdbFedora = $ARGV[0]; +my $dir = `pwd`; +chomp($dir); + +system "rm \$(grep \"^Patch[0-9]\\{1,3\\}:\" gdb.spec | awk '{print \$2}') 2>/dev/null"; +system "rm *.tar.bz2"; +system "cp -p $gdbFedora/*.tar.bz2 ./"; +system "pushd $gdbFedora ; sh $dir/patchname_get.sh -v gdb.spec 2>$dir/test.txt; popd"; +system "grep \"^Patch\" test.txt > test2.txt"; + +my @patchliste = `cat test2.txt`; +my @patchdeklarationen = (); +my @patchstatements = (); +my %seenpatches = (); +my $blockcounter = 0; +my @patchcopy = (); + +foreach my $line (@patchliste) { + chomp($line); + if ($line =~ /\((.*)\)/) { + $patchname = $1; + if (exists $seenpatches{$patchname}){ + my $oldcount = $seenpatches{$patchname}; + push @patchstatements, "%patch$oldcount -p1 -R\n"; + } + else { + $count = $count + 1; + push @patchdeklarationen, "Patch$count: ". (($count < 10) ? " " : (($count < 100) ? " " : "")) ."$patchname\n"; + push @patchstatements, "%patch$count -p1\n"; + $seenpatches{$patchname} = $count; + push @patchcopy, $patchname; + } + } +} + +foreach my $copy (@patchcopy) { + system "cp \"$gdbFedora/$copy\" ./"; +} + +open F, ">gdb.spec.new"; +foreach my $line (`cat gdb.spec`) { + if ($line eq "#Fedora Packages begin\n") { + print F $line; + $blockcounter = 1; + } + elsif ($line eq "#Fedora Packages end\n") { + $blockcounter = 0; + } + elsif($line eq "#Fedora patching start\n") { + print F $line; + $blockcounter = 3; + } + elsif($line eq "#Fedora patching end\n") { + $blockcounter = 0; + } + if ($blockcounter == 0){ + print F $line; + } elsif ($blockcounter == 1) { + print F @patchdeklarationen; + $blockcounter = 2; + } elsif ($blockcounter == 3) { + print F @patchstatements; + $blockcounter = 4; + } +} +close F; + +system "mv gdb.spec.new gdb.spec"; +system "rm test.txt test2.txt"; +system "osc addremove"; diff --git a/patchname_get.sh b/patchname_get.sh new file mode 100644 index 0000000..7406a24 --- /dev/null +++ b/patchname_get.sh @@ -0,0 +1,314 @@ +#!/bin/bash + + + +: ${QUILT_DIR=/usr/share/quilt} + + +if ! [ -r $QUILT_DIR/scripts/patchfns ] +then + echo "Cannot read library $QUILT_DIR/scripts/patchfns" >&2 + exit 1 +fi +. $QUILT_DIR/scripts/patchfns +cd ${SUBDIR:-.} + +usage() { + echo "Usage: ${0##*/} [--fuzz=N] specfile" + exit 1 +} + +options=$(getopt -o v --long sourcedir:,fuzz: -n "${0##*/}" -- "$@") || exit + +eval set -- "$options" + +sourcedir= + +while true +do + case "$1" in + -v) + verbose=1 + shift ;; + --sourcedir) + sourcedir=${2%/}/ + shift 2 ;; + --fuzz) + # Only works with rpm 4.6 and later + DEFINE_FUZZ="%define _default_patch_fuzz $2" + shift 2 ;; + --) + shift + break ;; + esac +done + +[ "${sourcedir:0:1}" = / ] || sourcedir=$PWD/$sourcedir + +specfile=$1 +if [ $# -ne 1 -o ! -f "$specfile" ] +then + + usage +fi +if [ "${specfile:0:1}" = / ] +then + specdir=$(dirname "$specfile") + specfile=${specfile##*/} +else + specdir=$PWD +fi + +tmpdir="$(gen_tempfile -d ${VARTMPDIR:-/var/tmp}/${0##*/})" +mkdir -p $tmpdir || exit 1 +add_exit_handler "rm -rf $tmpdir" +mkdir -p $tmpdir/build +mkdir -p $tmpdir/bin + +# Older versions of Suse packages have a symbolic release number, and rpmbuild +# won't like that, so change it to something compliant. +if grep -q '^Release:.*[<>]' "$specdir/$specfile" +then + sed -e '/^Release:/s/[<>]//g' < "$specdir/$specfile" > $tmpdir/"$specfile" + specdir=$tmpdir +fi + +# Redirect file descriptors +# 5 is used in verbose mode, 4 in non-verbose mode, and 2 for both (real errors) +if [ -n "$verbose" ] +then + exec 3>&1 5>&2 4>/dev/null +else + exec 3>&1 4>&2 5>/dev/null +fi + + + +# wrapper script for patch and tar +cat <<-'EOF' > $tmpdir/bin/wrapper + #! /bin/bash + + # find original data file by md5sum + original_file() { + local file=$1 md5sum + + set -- $(md5sum < $file) + md5sum=$1 + while read md5sum_ file_ + do + if [ "$md5sum" = "$md5sum_" ] + then + echo ${file_#\*} + return 0 + fi + done < $tmpdir/md5sums + + # Try harder + if ! [ -e $tmpdir/more-md5sums ] + then + ( cd $RPM_BUILD_DIR + find . -type f \ + | sed -e 's:^.\/::' \ + | xargs md5sum \ + ) > $tmpdir/more-md5sums + fi + + while read md5sum_ file_ + do + if [ "$md5sum" = "$md5sum_" ] + then + echo ${file_#\*} + return 0 + fi + done < $tmpdir/more-md5sums + return 1 + } + + + + + + # Extract a command line option with or without argument + cmdline_option() { + local letter=$1 no_arg=$2 + shift + + while [ $# -ne 0 ] + do + if [ "${1:0:2}" = -$letter ] + then + if [ -z "$no_arg" ] + then + [ "$1" = -$letter ] && set -- "$1$2" + fi + echo $1 + break + fi + shift + done + } + + + strip_option() { + set -- $(cmdline_option p "$@") + [ "$1" != -p1 ] && echo $1 + } + + # Extract the -p option from the command line + strip_option() { + set -- $(cmdline_option p "$@") + [ "$1" != -p1 ] && echo $1 + } + + # Extract the -R option from the command line + reverse_option() { + set -- $(cmdline_option R no_arg "$@") + echo $1 + } + + patch_opt_d() { + local subdir=$(cmdline_option d "$@") + [ -z "$subdir" ] || echo "${subdir:2}" + } + + + + patch_input_file() { + while [ $# -gt 0 ]; do + case "$1" in + -i|--input) + if [ $# -ge 2 ]; then + echo "$2" + return + fi + ;; + -i*) + echo "${1#-i}" + return + ;; + --input=*) + echo "${1#--input=}" + return + ;; + esac + shift + done + return + } + + tar_input_file() { + case "$1" in + *C*f*) + echo "$3" + ;; + *f*) + echo "$2" + ;; + esac + } + + + tar_opt_C() { + case "$1" in + *C*f*) + echo "$2" + return ;; + esac + } + + tmpdir=${RPM_BUILD_DIR%/*} + rm -f $tmpdir/data + case "${0##*/}" in + patch) + inputfile=$(patch_input_file "$@") + ;; + tar) + inputfile=$(tar_input_file "$@") + # For tar, file - means read from stdin + [ "$inputfile" = "-" ] && inputfile= + ;; + esac + if [ -z "$inputfile" ]; then + # put data from stdin into tmpfile + cat > $tmpdir/data + fi + + unpackfile="$(original_file ${inputfile:-$tmpdir/data})" + if [ -n "$unpackfile" ] + then + case "${0##*/}" in + patch) + echo -n p >&4 + subdir=$(patch_opt_d "$@") + if [ -n "$subdir" ] + then + dir=$(cd "$subdir" && echo $PWD) + else + dir=$PWD + fi + dir=${dir/$RPM_BUILD_DIR} + dir=${dir##/} + dir=${dir// /\\ } + echo "${0##*/} ${dir:-.} $unpackfile" \ + $(strip_option "$@") $(reverse_option "$@") >&3 + ;; + tar) + echo -n t >&4 + subdir=$(tar_opt_C "$@") + if [ -n "$subdir" ] + then + dir=$(cd "$subdir" && echo $PWD) + else + dir=$PWD + fi + dir=${dir/$RPM_BUILD_DIR} + dir=${dir##/} + dir=${dir// /\\ } + echo "${0##*/} ${dir:-.} $unpackfile" >&3 + ;; + esac + fi + + PATH=${PATH#*:} + if [ -n "$inputfile" ]; then + ${0##*/} "$@" + else + ${0##*/} "$@" < $tmpdir/data + fi + +EOF + +chmod 755 $tmpdir/bin/wrapper +# If $TMPDIR is mounted with noexec, rpmbuild won't be able to execute +# our wrapper script +if [ ! -x $tmpdir/bin/wrapper ] +then + printf "Cannot execute %s; filesystem mounted with noexec?\n" \ + $tmpdir/bin/wrapper >&2 + printf "Setting %s in ~/.quiltrc may help\n" "VARTMPDIR" >&2 + exit 1 +fi + +ln -s wrapper $tmpdir/bin/patch +ln -s wrapper $tmpdir/bin/tar + +# let rpm do all the dirty specfile stuff ... +echo -n "### rpmbuild: " >&4 + +export PATH="$tmpdir/bin:$PATH" +rpmbuild --eval "%define _sourcedir $sourcedir" \ + --eval "%define _specdir $specdir" \ + --eval "%define _builddir $tmpdir/build" \ + --eval "%define __patch $tmpdir/bin/patch" \ + --eval "%define __tar $tmpdir/bin/tar" \ + --eval "$DEFINE_FUZZ" \ + --nodeps \ + -bp "$specdir/$specfile" < /dev/null >&5 2>&5 +status=$? +echo >&4 +exit $status +### Local Variables: +### mode: shell-script +### End: +# vim:filetype=sh + diff --git a/powerpc-fix-for-gdb.reverse-finish-precsave.exp-and-.patch b/powerpc-fix-for-gdb.reverse-finish-precsave.exp-and-.patch new file mode 100644 index 0000000..a114a5f --- /dev/null +++ b/powerpc-fix-for-gdb.reverse-finish-precsave.exp-and-.patch @@ -0,0 +1,498 @@ +From 338e9f159a818a3f565af96ace486781c450bd00 Mon Sep 17 00:00:00 2001 +From: Carl Love +Date: Thu, 9 Mar 2023 16:10:18 -0500 +Subject: [PATCH 5/9] PowerPC: fix for gdb.reverse/finish-precsave.exp and + gdb.reverse/finish-reverse.exp + +PPC64 multiple entry points, a normal entry point and an alternate entry +point. The alternate entry point is to setup the Table of Contents (TOC) +register before continuing at the normal entry point. When the TOC is +already valid, the normal entry point is used, this is typically the case. +The alternate entry point is typically referred to as the global entry +point (GEP) in IBM. The normal entry point is typically referred to as +the local entry point (LEP). + +When GDB is executing the finish command in reverse, the function +finish_backward currently sets the break point at the alternate entry point. +This issue is if the function, when executing in the forward direction, +entered the function via the normal entry point, execution in the reverse +direction will never sees the break point at the alternate entry point. In +this case, the reverse execution continues until the next break point is +encountered thus stopping at the wrong place. + +This patch adds a new address to struct execution_control_state to hold the +address of the alternate entry point (GEP). The finish_backwards function +is updated, if the stopping point is between the normal entry point (LEP) +and the end of the function, a breakpoint is set at the normal entry point. +If the stopping point is between the entry points, a breakpoint is set at +the alternate entry point. This ensures that GDB will always stop at the +normal entry point. If the function did enter via the alternate entry +point, GDB will detect that and continue to execute backwards in the +function until the alternate entry point is reached. + +The patch fixes the behavior of the reverse-finish command on PowerPC to +match the behavior of the command on other platforms, specifically X86. +The patch does not change the behavior of the command on X86. + +A new test is added to verify the reverse-finish command on PowerPC +correctly stops at the instruction where the function call is made. + +The patch fixes 11 regression errors in test gdb.reverse/finish-precsave.exp +and 11 regression errors in test gdb.reverse/finish-reverse.exp. + +The patch has been tested on Power 10 and X86 processor with no new +regression failures. +--- + gdb/infcmd.c | 32 ++- + gdb/infrun.c | 24 ++ + .../gdb.reverse/finish-reverse-next.c | 91 +++++++ + .../gdb.reverse/finish-reverse-next.exp | 224 ++++++++++++++++++ + 4 files changed, 362 insertions(+), 9 deletions(-) + create mode 100644 gdb/testsuite/gdb.reverse/finish-reverse-next.c + create mode 100644 gdb/testsuite/gdb.reverse/finish-reverse-next.exp + +diff --git a/gdb/infcmd.c b/gdb/infcmd.c +index 0ddc541e787..313fe2e025e 100644 +--- a/gdb/infcmd.c ++++ b/gdb/infcmd.c +@@ -1714,6 +1714,10 @@ finish_backward (struct finish_command_fsm *sm) + struct thread_info *tp = inferior_thread (); + CORE_ADDR pc; + CORE_ADDR func_addr; ++ CORE_ADDR alt_entry_point = sal.pc; ++ CORE_ADDR entry_point = alt_entry_point; ++ frame_info_ptr frame = get_selected_frame (nullptr); ++ struct gdbarch *gdbarch = get_frame_arch (frame); + + pc = get_frame_pc (get_current_frame ()); + +@@ -1722,6 +1726,15 @@ finish_backward (struct finish_command_fsm *sm) + + sal = find_pc_line (func_addr, 0); + ++ if (gdbarch_skip_entrypoint_p (gdbarch)) ++ /* Some architectures, like PowerPC use local and global entry points. ++ There is only one Entry Point (GEP = LEP) for other architectures. ++ The GEP is an alternate entry point. The LEP is the normal entry point. ++ The value of entry_point was initialized to the alternate entry point ++ (GEP). It will be adjusted to the normal entry point if the function ++ has two entry points. */ ++ entry_point = gdbarch_skip_entrypoint (gdbarch, sal.pc); ++ + tp->control.proceed_to_finish = 1; + /* Special case: if we're sitting at the function entry point, + then all we need to do is take a reverse singlestep. We +@@ -1732,15 +1745,12 @@ finish_backward (struct finish_command_fsm *sm) + no way that a function up the stack can have a return address + that's equal to its entry point. */ + +- if (sal.pc != pc) ++ if ((pc < alt_entry_point) || (pc > entry_point)) + { +- frame_info_ptr frame = get_selected_frame (nullptr); +- struct gdbarch *gdbarch = get_frame_arch (frame); +- +- /* Set a step-resume at the function's entry point. Once that's +- hit, we'll do one more step backwards. */ ++ /* We are in the body of the function. Set a breakpoint to go back to ++ the normal entry point. */ + symtab_and_line sr_sal; +- sr_sal.pc = sal.pc; ++ sr_sal.pc = entry_point; + sr_sal.pspace = get_frame_program_space (frame); + insert_step_resume_breakpoint_at_sal (gdbarch, + sr_sal, null_frame_id); +@@ -1749,8 +1759,12 @@ finish_backward (struct finish_command_fsm *sm) + } + else + { +- /* We're almost there -- we just need to back up by one more +- single-step. */ ++ /* We are either at one of the entry points or between the entry points. ++ If we are not at the alt_entry point, go back to the alt_entry_point ++ If we at the normal entry point step back one instruction, when we ++ stop we will determine if we entered via the entry point or the ++ alternate entry point. If we are at the alternate entry point, ++ single step back to the function call. */ + tp->control.step_range_start = tp->control.step_range_end = 1; + proceed ((CORE_ADDR) -1, GDB_SIGNAL_DEFAULT); + } +diff --git a/gdb/infrun.c b/gdb/infrun.c +index d5f97e33625..9c1b1f04e4d 100644 +--- a/gdb/infrun.c ++++ b/gdb/infrun.c +@@ -1868,6 +1868,7 @@ struct execution_control_state + + struct target_waitstatus ws; + int stop_func_filled_in = 0; ++ CORE_ADDR stop_func_alt_start = 0; + CORE_ADDR stop_func_start = 0; + CORE_ADDR stop_func_end = 0; + const char *stop_func_name = nullptr; +@@ -4680,6 +4681,11 @@ fill_in_stop_func (struct gdbarch *gdbarch, + ecs->stop_func_start + += gdbarch_deprecated_function_start_offset (gdbarch); + ++ /* PowerPC functions have a Local Entry Point (LEP) and a Global ++ Entry Point (GEP). There is only one Entry Point (GEP = LEP) for ++ other architectures. */ ++ ecs->stop_func_alt_start = ecs->stop_func_start; ++ + if (gdbarch_skip_entrypoint_p (gdbarch)) + ecs->stop_func_start + = gdbarch_skip_entrypoint (gdbarch, ecs->stop_func_start); +@@ -7269,6 +7275,24 @@ process_event_stop_test (struct execution_control_state *ecs) + } + } + ++ if (execution_direction == EXEC_REVERSE ++ && ecs->event_thread->control.proceed_to_finish ++ && ecs->event_thread->stop_pc () >= ecs->stop_func_alt_start ++ && ecs->event_thread->stop_pc () < ecs->stop_func_start) ++ { ++ /* We are executing the reverse-finish command. ++ If the system supports multiple entry points and we are finishing a ++ function in reverse. If we are between the entry points singe-step ++ back to the alternate entry point. If we are at the alternate entry ++ point -- just need to back up by one more single-step, which ++ should take us back to the function call. */ ++ ecs->event_thread->control.step_range_start ++ = ecs->event_thread->control.step_range_end = 1; ++ keep_going (ecs); ++ return; ++ ++ } ++ + if (ecs->event_thread->control.step_range_end == 1) + { + /* It is stepi or nexti. We always want to stop stepping after +diff --git a/gdb/testsuite/gdb.reverse/finish-reverse-next.c b/gdb/testsuite/gdb.reverse/finish-reverse-next.c +new file mode 100644 +index 00000000000..e95ee8e33a6 +--- /dev/null ++++ b/gdb/testsuite/gdb.reverse/finish-reverse-next.c +@@ -0,0 +1,91 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2012-2023 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++/* The reverse finish command should return from a function and stop on ++ the first instruction of the source line where the function call is made. ++ Specifically, the behavior should match doing a reverse next from the ++ first instruction in the function. GDB should only require one reverse ++ step or next statement to reach the previous source code line. ++ ++ This test verifies the fix for gdb bugzilla: ++ ++ https://sourceware.org/bugzilla/show_bug.cgi?id=29927 ++ ++ PowerPC supports two entry points to a function. The normal entry point ++ is called the local entry point (LEP). The alternate entry point is called ++ the global entry point (GEP). The GEP is only used if the table of ++ contents (TOC) value stored in register r2 needs to be setup prior to ++ execution starting at the LEP. A function call via a function pointer ++ will entry via the GEP. A normal function call will enter via the LEP. ++ ++ This test has been expanded to include tests to verify the reverse-finish ++ command works properly if the function is called via the GEP. The original ++ test only verified the reverse-finish command for a normal call that used ++ the LEP. */ ++ ++int ++function2 (int a, int b) ++{ ++ int ret = 0; ++ ret = ret + a + b; ++ return ret; ++} ++ ++int ++function1 (int a, int b) // FUNCTION1 ++{ ++ int ret = 0; ++ int (*funp) (int, int) = &function2; ++ /* The assembly code for this function when compiled for PowerPC is as ++ follows: ++ ++ 0000000010000758 : ++ 10000758: 02 10 40 3c lis r2,4098 <- GEP ++ 1000075c: 00 7f 42 38 addi r2,r2,32512 ++ 10000760: a6 02 08 7c mflr r0 <- LEP ++ 10000764: 10 00 01 f8 std r0,16(r1) ++ .... ++ ++ When the function is called on PowerPC with function1 (a, b) the call ++ enters at the Local Entry Point (LEP). When the function is called via ++ a function pointer, the Global Entry Point (GEP) for function1 is used. ++ The GEP sets up register 2 before reaching the LEP. ++ */ ++ ret = funp (a + 1, b + 2); ++ return ret; ++} ++ ++int ++main(int argc, char* argv[]) ++{ ++ int a, b; ++ int (*funp) (int, int) = &function1; ++ ++ /* Call function via Local Entry Point (LEP). */ ++ ++ a = 1; ++ b = 5; ++ ++ function1 (a, b); // CALL VIA LEP ++ ++ /* Call function via Global Entry Point (GEP). */ ++ a = 10; ++ b = 50; ++ ++ funp (a, b); // CALL VIA GEP ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.reverse/finish-reverse-next.exp b/gdb/testsuite/gdb.reverse/finish-reverse-next.exp +new file mode 100644 +index 00000000000..1f53b649a7d +--- /dev/null ++++ b/gdb/testsuite/gdb.reverse/finish-reverse-next.exp +@@ -0,0 +1,224 @@ ++# Copyright 2008-2023 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . */ ++ ++# This file is part of the GDB testsuite. It tests reverse stepping. ++# Lots of code borrowed from "step-test.exp". ++ ++# The reverse finish command should return from a function and stop on ++# the first instruction of the source line where the function call is made. ++# Specifically, the behavior should match doing a reverse next from the ++# first instruction in the function. GDB should only take one reverse step ++# or next statement to reach the previous source code line. ++ ++# This testcase verifies the reverse-finish command stops at the first ++# instruction in the source code line where the function was called. There ++# are two scenarios that must be checked: ++# 1) gdb is at the entry point instruction for the function ++# 2) gdb is in the body of the function. ++ ++# This test verifies the fix for gdb bugzilla: ++# https://sourceware.org/bugzilla/show_bug.cgi?id=29927 ++ ++# PowerPC supports two entry points to a function. The normal entry point ++# is called the local entry point (LEP). The alternate entry point is called ++# the global entry point (GEP). A function call via a function pointer ++# will entry via the GEP. A normal function call will enter via the LEP. ++# ++# This test has been expanded to include tests to verify the reverse-finish ++# command works properly if the function is called via the GEP. The original ++# test only verified the reverse-finish command for a normal call that used ++# the LEP. ++ ++if ![supports_reverse] { ++ return ++} ++ ++standard_testfile ++ ++if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { ++ return -1 ++} ++ ++runto_main ++set target_remote [gdb_is_target_remote] ++ ++if [supports_process_record] { ++ # Activate process record/replay. ++ gdb_test_no_output "record" "turn on process record for test1" ++} ++ ++ ++### TEST 1: reverse finish from the entry point instruction (LEP) in ++### function1 when called using the normal entry point (LEP). ++ ++# Set breakpoint at call to function1 in main. ++set bp_LEP_test [gdb_get_line_number "CALL VIA LEP" $srcfile] ++gdb_breakpoint $srcfile:$bp_LEP_test temporary ++ ++# Continue to break point at function1 call in main. ++gdb_continue_to_breakpoint \ ++ "stopped at function1 entry point instruction to stepi into function" \ ++ ".*$srcfile:$bp_LEP_test\r\n.*" ++ ++# stepi until we see "{" indicating we entered function1 ++repeat_cmd_until "stepi" "CALL VIA LEP" "{" "stepi into function1 call" "100" ++ ++# The reverse-finish command should stop on the function call instruction ++# which is the last instruction in the source code line. A reverse-next ++# instruction should then stop at the first instruction in the same source ++# code line. Another revers-next instruction stops at the previous source ++# code line. ++gdb_test "reverse-finish" ".*function1 \\(a, b\\); // CALL VIA LEP.*" \ ++ "reverse-finish function1 LEP call from LEP " ++gdb_test "reverse-next" ".*function1 \\(a, b\\); // CALL VIA LEP" \ ++ "reverse next 1 LEP entry point function call from LEP" ++gdb_test "reverse-next" ".*b = 5;.*" "reverse next 2, at b = 5, call from LEP" ++ ++ ++gdb_test "reverse-continue" ".*" "setup for test 2" ++ ++# Turn off record to clear logs and turn on again ++gdb_test "record stop" "Process record is stopped.*" \ ++ "turn off process record for test1" ++gdb_test_no_output "record" "turn on process record for test2" ++ ++ ++### TEST 2: reverse finish from the body of function1. ++ ++# Set breakpoint at call to function1 in main. ++gdb_breakpoint $srcfile:$bp_LEP_test temporary ++ ++# Continue to break point at function1 call in main. ++gdb_continue_to_breakpoint \ ++ "at function1 entry point instruction to step to body of function" \ ++ ".*$srcfile:$bp_LEP_test\r\n.*" ++ ++# do a step instruction to get to the body of the function ++gdb_test "step" ".*int ret = 0;.*" "step test 1" ++ ++# The reverse-finish command should stop on the function call instruction ++# which is the last instruction in the source code line. A reverse-next ++# instruction should then stop at the first instruction in the same source ++# code line. Another revers-next instruction stops at the previous source ++# code line. ++gdb_test "reverse-finish" ".*function1 \\(a, b\\); // CALL VIA LEP.*" \ ++ "reverse-finish function1 LEP call from function body" ++gdb_test "reverse-next" ".*function1 \\(a, b\\); // CALL VIA LEP.*" \ ++ "reverse next 1 LEP from function body" ++gdb_test "reverse-next" ".*b = 5;.*" \ ++ "reverse next 2 at b = 5, from function body" ++ ++gdb_test "reverse-continue" ".*" "setup for test 3" ++ ++# Turn off record to clear logs and turn on again ++gdb_test "record stop" "Process record is stopped.*" \ ++ "turn off process record for test2" ++gdb_test_no_output "record" "turn on process record for test3" ++ ++ ++### TEST 3: reverse finish from the alternate entry point instruction (GEP) in ++### function1 when called using the alternate entry point (GEP). ++ ++# Set breakpoint at call to funp in main. ++set bp_GEP_test [gdb_get_line_number "CALL VIA GEP" $srcfile] ++gdb_breakpoint $srcfile:$bp_GEP_test temporary ++ ++# Continue to break point at funp call in main. ++gdb_continue_to_breakpoint \ ++ "stopped at function1 entry point instruction to stepi into funp" \ ++ ".*$srcfile:$bp_GEP_test\r\n.*" ++ ++# stepi until we see "{" indicating we entered function. ++repeat_cmd_until "stepi" "CALL VIA GEP" "{" "stepi into funp call" ++ ++# The reverse-finish command should stop on the function call instruction ++# which is the last instruction in the source code line. A reverse-next ++# instruction should then stop at the first instruction in the same source ++# code line. Another revers-next instruction stops at the previous source ++# code line. ++gdb_test "reverse-finish" ".*funp \\(a, b\\);.*" \ ++ "function1 GEP call call from GEP" ++gdb_test "reverse-next" ".*funp \\(a, b\\);.*" \ ++ "reverse next 1 GEP entry point function call from GEP" ++gdb_test "reverse-next" ".*b = 50;.*" "reverse next 2 at b = 50, call from GEP" ++ ++gdb_test "reverse-continue" ".*" "setup for test 4" ++ ++# Turn off record to clear logs and turn on again ++gdb_test "record stop" "Process record is stopped.*" \ ++ "turn off process record for test3" ++gdb_test_no_output "record" "turn on process record for test4" ++ ++### TEST 4: reverse finish from between the GEP and LEP in ++### function1 when called using the alternate entry point (GEP). ++ ++# Set breakpoint at call to funp in main. ++set bp_GEP_test [gdb_get_line_number "CALL VIA GEP" $srcfile] ++gdb_breakpoint $srcfile:$bp_GEP_test temporary ++ ++# Continue to break point at funp call in main. ++gdb_continue_to_breakpoint \ ++ "stopped at function1 entry point instruction to stepi into funp again" \ ++ ".*$srcfile:$bp_GEP_test\r\n.*" ++ ++# stepi until we see "{" indicating we entered function. ++repeat_cmd_until "stepi" "CALL VIA GEP" "{" "stepi into funp call again" ++ ++# do one more stepi so we are between the GEP and LEP. ++gdb_test "stepi" "{" "stepi to between GEP and LEP" ++ ++# The reverse-finish command should stop on the function call instruction ++# which is the last instruction in the source code line. A reverse-next ++# instruction should then stop at the first instruction in the same source ++# code line. Another revers-next instruction stops at the previous source ++# code line. ++gdb_test "reverse-finish" ".*funp \\(a, b\\);.*" \ ++ "function1 GEP call call from GEP again" ++gdb_test "reverse-next" ".*funp \\(a, b\\);.*" \ ++ "reverse next 1 GEP entry point function call from GEP again" ++gdb_test "reverse-next" ".*b = 50;.*" \ ++ "reverse next 2 at b = 50, call from GEP again" ++ ++gdb_test "reverse-continue" ".*" "setup for test 5" ++ ++# Turn off record to clear logs and turn on again ++gdb_test "record stop" "Process record is stopped.*" \ ++ "turn off process record for test4" ++gdb_test_no_output "record" "turn on process record for test5" ++ ++ ++### TEST 5: reverse finish from the body of function 1 when calling using the ++### alternate entrypoint (GEP). ++gdb_breakpoint $srcfile:$bp_GEP_test temporary ++ ++# Continue to break point at funp call. ++gdb_continue_to_breakpoint \ ++ "at function1 entry point instruction to step to body of funp call" \ ++ ".*$srcfile:$bp_GEP_test\r\n.*" ++ ++# Step into body of funp, called via GEP. ++gdb_test "step" ".*int ret = 0;.*" "step test 2" ++ ++# The reverse-finish command should stop on the function call instruction ++# which is the last instruction in the source code line. A reverse-next ++# instruction should then stop at the first instruction in the same source ++# code line. Another revers-next instruction stops at the previous source ++# code line. ++gdb_test "reverse-finish" ".*funp \\(a, b\\);.*" \ ++ "reverse-finish function1 GEP call, from function body " ++gdb_test "reverse-next" ".*funp \\(a, b\\);.*" \ ++ "reverse next 1 GEP call from function body" ++gdb_test "reverse-next" ".*b = 50;.*" \ ++ "reverse next 2 at b = 50 from function body" +-- +2.35.3 + diff --git a/powerpc-regression-fix-for-reverse-finish-command.patch b/powerpc-regression-fix-for-reverse-finish-command.patch new file mode 100644 index 0000000..4e5db1b --- /dev/null +++ b/powerpc-regression-fix-for-reverse-finish-command.patch @@ -0,0 +1,74 @@ +From 64870827ac45e94375c3a217b9131de69fc5b753 Mon Sep 17 00:00:00 2001 +From: Carl Love +Date: Mon, 20 Mar 2023 16:59:33 -0400 +Subject: [PATCH 6/9] PowerPC: regression fix for reverse-finish command. + +The recent commit: + + commit 2a8339b71f37f2d02f5b2194929c9d702ef27223 + Author: Carl Love + Date: Thu Mar 9 16:10:18 2023 -0500 + + PowerPC: fix for gdb.reverse/finish-precsave.exp and gdb.reverse/finish-reverse.exp + + PPC64 multiple entry points, a normal entry point and an alternate entry + point. The alternate entry point is to setup the Table of Contents (TOC) + register before continuing at the normal entry point. When the TOC is + already valid, the normal entry point is used, this is typically the case. + The alternate entry point is typically referred to as the global entry + point (GEP) in IBM. The normal entry point is typically referred to as + the local entry point (LEP). + ..... + +Is causing regression failures on on PowerPC platforms. The regression +failures are in tests: + + gdb.reverse/finish-precsave.exp + gdb.btrace/tailcall.exp + gdb.mi/mi-reverse.exp + gdb.btrace/step.exp + gdb.reverse/until-precsave.exp + gdb.reverse/finish-reverse.exp + gdb.btrace/tailcall-only.exp + +The issue is in gdb/infcmd.c, function finish_command. The value of the +two new variables ALT_ENTRY_POINT and ENTRY_POINT are being initializezed +to SAL.PC. However, SAL has just been declared. The value of SAL.PC is +zero at this point. The intialization of ALT_ENTRY_POINT and ENTRY_POINT +needs to be after the initialization of SAL. + +This patch moves the initialization of ALT_ENTRY_POINT and ENTRY_POINT +variables to fix the regression failures. + +The patch has been tested on Power10 and on X86. +--- + gdb/infcmd.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/gdb/infcmd.c b/gdb/infcmd.c +index 313fe2e025e..d94dc0c059d 100644 +--- a/gdb/infcmd.c ++++ b/gdb/infcmd.c +@@ -1714,8 +1714,8 @@ finish_backward (struct finish_command_fsm *sm) + struct thread_info *tp = inferior_thread (); + CORE_ADDR pc; + CORE_ADDR func_addr; +- CORE_ADDR alt_entry_point = sal.pc; +- CORE_ADDR entry_point = alt_entry_point; ++ CORE_ADDR alt_entry_point; ++ CORE_ADDR entry_point; + frame_info_ptr frame = get_selected_frame (nullptr); + struct gdbarch *gdbarch = get_frame_arch (frame); + +@@ -1725,6 +1725,8 @@ finish_backward (struct finish_command_fsm *sm) + error (_("Cannot find bounds of current function")); + + sal = find_pc_line (func_addr, 0); ++ alt_entry_point = sal.pc; ++ entry_point = alt_entry_point; + + if (gdbarch_skip_entrypoint_p (gdbarch)) + /* Some architectures, like PowerPC use local and global entry points. +-- +2.35.3 + diff --git a/qa-local.sh b/qa-local.sh new file mode 100644 index 0000000..e37304e --- /dev/null +++ b/qa-local.sh @@ -0,0 +1,252 @@ +#!/bin/sh + +set -e + +pwd=$(pwd -P) + +root=$pwd/tmp-qa-local +logs=$root/logs +pkgs=$root/pkgs + +configs=" +openSUSE_Leap_15.5 +openSUSE_Leap_15.4 +openSUSE_Leap_15.3 +openSUSE_Factory +openSUSE_Factory_LegacyX86 +SLE-15 +SLE-12 +SLE-11 +" + +archs="x86_64 i586" + +version=13.2 + +usage () +{ + echo "usage: $0 <1-4>" + echo "1: Cleanup" + echo "2: List configs" + echo "3: Verify quilt setup" + echo "4: Do local builds without testsuite" + echo "5: Do local builds with testsuite" + echo "6: Verify local testsuite results" +} + +if [ $# -eq 0 ]; then + usage + exit 1 +fi + +n="$1" +shift + +extract () +{ + local package + package="$1" + + rpm2cpio "$package" \ + | cpio -idmv \ + > /dev/null \ + 2>&1 +} + +cleanup () +{ + if [ -d $root ]; then + echo "About to remove dir $root" + echo "Press ^C to abort, enter to continue" + read + fi + rm -Rf $root + mkdir -p $root +} + +acquire_sudo_rights () +{ + # Acquire sudo rights. + sudo --validate + + # Keep sudo rights alive. + while true; do + sleep 100 + sudo --validate --non-interactive + kill -0 "$$" 2>/dev/null || exit + done & +} + +have_combo () +{ + arch="$1" + c="$2" + + if [ "$arch" = "i586" ]; then + case " $c " in + " openSUSE_Factory ") + # Doesn't have i586. + return 1 + ;; + " SLE-11 "|" SLE-12 "|" SLE-15 ") + # SLE-12 and SLE-15 don't have i586. SLE-11 does, but + # we ignore that for now. + return 1 + ;; + esac + fi + if [ "$arch" = "x86_64" ]; then + case " $c " in + " openSUSE_Factory_LegacyX86 ") + # Doesn't have x86_64. + return 1 + ;; + esac + fi + return 0 +} + +case "$n" in + 1) + cleanup + ;; + + 2) + for arch in $archs; do + for c in $configs; do + if ! have_combo $arch $c; then + continue + fi + echo "$c $arch" + done + done + ;; + + 3) + quilt setup -d $root -v gdb.spec + rm -Rf $root/gdb-* + ;; + + 4) + acquire_sudo_rights + + rm -Rf $logs/$n + mkdir -p $logs/$n + + for arch in $archs; do + for c in $configs; do + if ! have_combo $arch $c; then + continue + fi + if osc build \ + --clean \ + --no-verify \ + --trust-all-projects \ + --no-service \ + $c $arch \ + > $logs/$n/LOG.$c.$arch \ + 2>&1; \ + st=$?; then + true + fi + + if [ $st -eq 0 ]; then + echo PASS: $c $arch + else + echo FAIL: $c $arch + fi + + sudo rm -Rf /var/tmp/build-root/$c-$arch + done + done + ;; + + 5) + acquire_sudo_rights + + rm -Rf $logs/$n + mkdir -p $logs/$n + + for arch in $archs; do + for c in $configs; do + if ! have_combo $arch $c; then + continue + fi + mkdir -p $pkgs/$c.$arch + if osc build \ + --clean \ + --no-verify \ + --trust-all-projects \ + --no-service \ + -k $pkgs/$c.$arch \ + $c $arch \ + -M testsuite \ + > $logs/$n/LOG.$c.$arch \ + 2>&1; \ + st=$?; then + true + fi + if [ $st -eq 0 ]; then + ok=true + else + reason="Build failed" + ok=false + fi + + if $ok; then + rpm=gdb-testresults-$version-0.$arch.rpm + if [ -f $pkgs/$c.$arch/$rpm ]; then + ( + cd $pkgs/$c.$arch + extract gdb-testresults-$version-0.$arch.rpm + ) + mv \ + $pkgs/$c.$arch/usr/share/doc/packages/gdb-testresults \ + $pkgs/gdb-testresults.$c.$arch + rm -Rf $pkgs/$c.$arch + else + ok=false + reason="Couldn't find $rpm" + fi + fi + if $ok; then + echo "PASS: $c $arch" + else + echo "FAIL: $c $arch ($reason)" + fi + + sudo rm -Rf /var/tmp/build-root/$c-$arch + done + done + ;; + + 6) + for arch in $archs; do + for c in $configs; do + if ! have_combo $arch $c; then + continue + fi + echo "CONFIG: $c $arch" + case $c in + openSUSE_Factory|openSUSE_Factory_LegacyX86) + bash qa.sh -local -$arch -factory $pkgs/gdb-testresults.$c.$arch + ;; + SLE-12) + bash qa.sh -local -$arch -sle12 $pkgs/gdb-testresults.$c.$arch + ;; + SLE-11) + bash qa.sh -local -$arch -sle11 $pkgs/gdb-testresults.$c.$arch + ;; + *) + bash qa.sh -local -$arch $pkgs/gdb-testresults.$c.$arch + ;; + esac + done + done + ;; + + *) + echo "Don't know how to handle arg: $n" + exit 1 + ;; +esac diff --git a/qa-remote.sh b/qa-remote.sh new file mode 100644 index 0000000..d9772a0 --- /dev/null +++ b/qa-remote.sh @@ -0,0 +1,163 @@ +#!/bin/sh + +scriptdir=$(cd $(dirname $0); pwd -P) + +pwd=$(pwd -P) + +root=$pwd/tmp-qa-remote +pkgs=$root/pkgs + +usage () +{ + echo "usage: $0 <1-2>" + echo " $0 <3> <1-5>" + echo "1: Cleanup" + echo "2: Get remote testsuite results" + echo "3: Verify remote testsuite result" +} + +if [ $# -eq 0 ]; then + usage + exit 1 +fi + +n="$1" +shift + +extract () +{ + local package + package="$1" + + rpm2cpio "$package" \ + | cpio -idmv \ + > /dev/null \ + 2>&1 +} + +get_item () +{ + c="$1" + arch="$2" + + if [ -d $root/binaries-testsuite.$c.$arch/gdb-testresults ]; then + echo "Already have $c $arch, skipping" + return + fi + + if [ "$c" = "openSUSE_Leap_15.2" ]; then + # Stale config, skip. + return + fi + + echo "Trying $c $arch" + + local dir + dir=$pkgs/$c.$arch + + if [ ! -d $dir ]; then + mkdir -p $dir + fi + + rpm=$(echo $dir/gdb-testresults-*.*.rpm) + rpm=$(for f in $rpm; do echo $f; done | grep -v nosrc) + rpm=$(basename $rpm) + if [ "$rpm" = "" ] || [ ! -f "$rpm" ]; then + echo "Getting rpms" + osc getbinaries -q -M testsuite -d $dir $c $arch + rpm=$(echo $dir/gdb-testresults-*.rpm) + rpm=$(for f in $rpm; do echo $f; done | grep -v nosrc) + rpm=$(basename $rpm) + echo "Got rpm: $rpm" + else + echo "Already have rpm: $rpm" + fi + + if [ ! -d $pkgs/gdb-testresults.$c.$arch ]; then + ( + echo "Extracting rpm: $rpm" + cd $dir + extract $rpm + ) + else + echo "Already extracted rpm: $rpm" + fi + + if [ -d $dir/usr/share/doc/packages/gdb-testresults ]; then + echo "Renaming" + mkdir $root/binaries-testsuite.$c.$arch + mv \ + $dir/usr/share/doc/packages/gdb-testresults \ + $root/binaries-testsuite.$c.$arch/gdb-testresults + fi + + if [ -d $root/binaries-testsuite.$c.$arch/gdb-testresults ]; then + echo "Cleaning up" + rm -Rf $dir + fi +} + +cleanup () +{ + if [ -d $root ]; then + echo "About to remove dir $root" + echo "Press ^C to abort, enter to continue" + read + fi + rm -Rf $root + mkdir -p $root +} + +report_todo () +{ + c="$1" + arch="$2" + status="$3" + + if [ "$c" = "SLE-10_SDK" ]; then + # Stale config. + return + fi + + if [ "$c" = "SLE-11" ] && [ "$arch" = "x86_64" ] && [ "$status" = "unresolvable" ]; then + # This needs fixing, but is a known problem. + return + fi + + echo -e "Todo: $c\t$arch\t$status" +} + +case "$n" in + 1) + cleanup + ;; + + 2) + osc results -M testsuite \ + | grep succeeded \ + | awk '{print $1, $2}' \ + | while read line; do + get_item $line + done + osc results -M testsuite \ + | grep -v succeeded \ + | awk '{print $1, $2, $4}' \ + | while read line; do + report_todo $line + done + ;; + + 3) + m="$1" + shift + ( + cd $root + bash $scriptdir/qa.sh $m + ) + ;; + + *) + echo "Don't know how to handle arg: $n" + exit 1 + ;; +esac diff --git a/qa.sh b/qa.sh new file mode 100644 index 0000000..cf66b71 --- /dev/null +++ b/qa.sh @@ -0,0 +1,996 @@ +#!/bin/bash + +usage () +{ + echo "usage: $0 <1-5>" + echo " $0 -local [ -sle11 | -sle12 | -factory | -i586 | -x86_64 | -aarch64 | -powerpc64le | -s390 | -s390x ] " + echo + 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 "5: gdb.sum: Check gdb.suse PASS (all configs)" + echo + echo "Verify local results at:" + echo " \$dir" + echo "-local: gdb.sum: Check FAIL and ERROR" +} + +if [ $# -eq 0 ]; then + usage + exit 1 +fi + +n="$1" +shift + +have_sle11=false +have_sle12=false +have_factory=false +have_aarch64=false +have_powerpc64le=false +have_s390=false +have_s390x=false +have_i586=false +have_x86_64=false +if [ "$n" = "-local" ]; then + while [ $# -gt 1 ]; do + case $1 in + -sle11) + have_sle11=true + ;; + -sle12) + have_sle12=true + ;; + -factory) + have_factory=true + ;; + -aarch64) + have_aarch64=true + ;; + -powerpc64le|-ppc64le) + have_powerpc64le=true + ;; + -s390) + have_s390=true + ;; + -s390x) + have_s390x=true + ;; + -i586) + have_i586=true + ;; + -x86_64) + have_x86_64=true + ;; + *) + echo "Don't know how to handle arg: $1" + usage + exit 1 + ;; + esac + shift 1 + done + 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" + "FAIL: gdb.base/step-over-syscall.exp: clone: displaced=off: continue to marker \(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=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: .*: other threads ran - unlocked" + "FAIL: gdb.threads/watchthreads-threaded.exp: watchpoint on args\[[1-3]\] hit in thread" + "FAIL: gdb.threads/watchthreads-threaded.exp: watch args\[[1-3]\]" + "FAIL: gdb.threads/watchthreads-threaded.exp: threaded watch loop" + "FAIL: gdb.threads/watchthreads-threaded.exp: combination of threaded watchpoints = 30 \+ initial values" + + # 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=26273 + "FAIL: gdb.threads/gcore-stale-thread.exp: save a corefile" + "FAIL: gdb.threads/gcore-stale-thread.exp: exited thread is current due to non-stop" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=28617 + "FAIL: gdb.base/info-os.exp: get process groups \(timeout\)" + "FAIL: gdb.base/info-os.exp: get threads \(timeout\)" + "FAIL: gdb.base/info-os.exp: get file descriptors \(timeout\)" + "FAIL: gdb.base/info-os.exp: get internet-domain sockets \(timeout\)" + "FAIL: gdb.base/info-os.exp: get shared-memory regions \(timeout\)" + "FAIL: gdb.base/info-os.exp: get semaphores \(timeout\)" + "FAIL: gdb.base/info-os.exp: get message queues \(timeout\)" + "FAIL: gdb.base/info-os.exp: info os unknown_entry \(timeout\)" + "FAIL: gdb.base/info-os.exp: continue \(timeout\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=26284 + # 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 + # Should be fixed in gdb-14. + "FAIL: gdb.base/gdb-sigterm.exp: .*internal error" + + # If a test-case fails to compile, it's not a GDB FAIL, ignore. + "FAIL: gdb.ada/.*\.exp: compilation .*\.adb" + + # 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\)\)" + + # Fails for i586. Appearantly, glibc for i586 doesn't use vdso to do + # syscalls. Fedora test-case. + "FAIL: gdb.base/set-solib-absolute-prefix.exp: backtrace with __kernel_vsyscall" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=28504 + "FAIL: gdb.arch/i386-sse.exp: check contents of data\[2\]" + "FAIL: gdb.arch/i386-sse.exp: check contents of data\[3\]" + "FAIL: gdb.arch/i386-sse.exp: check contents of data\[4\]" + "FAIL: gdb.arch/i386-sse.exp: check contents of data\[5\]" + "FAIL: gdb.arch/i386-sse.exp: check contents of data\[6\]" + "FAIL: gdb.arch/i386-sse.exp: check contents of data\[7\]" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse addps" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse addss" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse addsubpd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse andpd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse blendps" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse cmppd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse cmpps" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse cmpss" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse comisd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse comiss" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse cvtdq2pd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse cvtpd2dq" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse cvtpd2ps" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse divpd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse divsd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse divss" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse mulps" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse mulss" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse orpd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse orps" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse pabsw" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse packsswb" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse ucomisd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse ucomiss" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse unpckhpd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse unpckhps" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse xorpd" + "FAIL: gdb.reverse/i386-sse-reverse.exp: verify xmm2 after reverse xorps" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29419 + # https://sourceware.org/bugzilla/show_bug.cgi?id=29409 + "FAIL: gdb.opt/inline-small-func.exp: info breakpoints" + "FAIL: gdb.ada/access_tagged_param.exp: continue" + "FAIL: gdb.ada/inline-section-gc.exp: break callee.adb:22" + "FAIL: gdb.ada/ptype_tagged_param.exp: ptype s, with debug info" + "FAIL: gdb.ada/ref_param.exp: frame argument value printed" + "FAIL: gdb.reverse/singlejmp-reverse.exp: next to v = 1" + "FAIL: gdb.reverse/singlejmp-reverse.exp: next to f" + "FAIL: gdb.reverse/singlejmp-reverse.exp: next to nodebug" + "FAIL: gdb.reverse/singlejmp-reverse.exp: next to v = 3" + "FAIL: gdb.reverse/singlejmp-reverse.exp: reverse-step" + "FAIL: gdb.reverse/singlejmp-reverse.exp: reverse-next" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=25038 + "FAIL: gdb.reverse/test_ioctl_TCSETSW.exp: handle TCSETSW" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=26873 + "FAIL: gdb.threads/watchthreads-threaded.exp: threaded watch loop \(GDB internal error\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=28617 + "FAIL: gdb.base/info-os.exp: get file descriptors" + "FAIL: gdb.base/info-os.exp: get internet-domain sockets" + "FAIL: gdb.base/info-os.exp: get message queues" + "FAIL: gdb.base/info-os.exp: get process groups" + "FAIL: gdb.base/info-os.exp: get semaphores" + "FAIL: gdb.base/info-os.exp: get shared-memory regions" + "FAIL: gdb.base/info-os.exp: get threads" + + # Fails related to PKRU register. To be investigated. Might be fixed in + # gdb 14, but related patches look non-trivial to backport. + "FAIL: gdb.arch/i386-pkru.exp: pkru register" + "FAIL: gdb.arch/i386-pkru.exp: read pkru register" + "FAIL: gdb.arch/i386-pkru.exp: read value after setting value" + "FAIL: gdb.arch/i386-pkru.exp: variable after reading pkru" + "FAIL: gdb.base/gcore.exp: corefile restored all registers" + "FAIL: gdb.reverse/insn-reverse.exp: rdrand: compare registers on insn" + "FAIL: gdb.reverse/insn-reverse.exp: rdseed: compare registers on insn" + + # 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=29781 + "FAIL: gdb.mi/mi-multi-commands.exp: args=.*: look for second command output, command length .* \(timeout\)" + + # 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\)" + "FAIL: gdb.ada/mi_var_access.exp: update at stop 2 \(unexpected output\)" + + # Fragile test-case, requires glibc to fail in a certain way, ignore. + "FAIL: gdb.base/gdb-rhbz1156192-recursive-dlopen.exp:" + + # GDB fails to print "Thread $x stopped" message for all threads, but + # subsequent info threads shows all threads stopped, and a previous + # info threads show all threads running. Not harmful. + "FAIL: gdb.threads/interrupt-while-step-over.exp: displaced-stepping=off: iter=[0-9]*: wait for stops \(timeout\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29040 + "FAIL: gdb.threads/next-fork-other-thread.exp:" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=30521 + "FAIL: gdb.base/printcmds.exp: print {unsigned char\[\]}{0xffffffff}" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=30528 + # Fixed in 15. Backportable to 14. + "FAIL: gdb.dwarf2/per-bfd-sharing.exp: couldn't remove files in temporary cache dir" + +) # kfail + +kfail_sle12=( + + # https://sourceware.org/bugzilla/show_bug.cgi?id=26292 + "FAIL: gdb.base/checkpoint-ns.exp: .* \(timeout\)" + "FAIL: gdb.base/checkpoint.exp: .* \(timeout\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29238 + "FAIL: gdb.cp/ambiguous.exp: all vars: print jv" + "FAIL: gdb.cp/ambiguous.exp: all vars: print jva1" + "FAIL: gdb.cp/ambiguous.exp: all vars: print jva1v" + "FAIL: gdb.cp/ambiguous.exp: all vars: print jva2" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=25059 + "FAIL: gdb.cp/subtypes.exp:" + "FAIL: gdb.base/max-depth-c\+\+.exp:" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29240 + "FAIL: gdb.base/align-c.exp: print _Alignof\(double\)" + "FAIL: gdb.base/align-c.exp: print _Alignof\(long long\)" + "FAIL: gdb.base/align-c.exp: print _Alignof\(unsigned long long\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29241 + "FAIL: gdb.guile/scm-type.exp: lang_cpp: test_range: on flexible array member: guile \(print \(type-range \(field-type \(type-field \(value-type \(value-dereference f\)\) \"items\"\)\)\)\)" + "FAIL: gdb.guile/scm-type.exp: lang_cpp: test_range: on flexible array member: guile \(print \(value-subscript \(value-field \(value-dereference f\) \"items\"\) 0\)\)" + "FAIL: gdb.guile/scm-type.exp: lang_cpp: test_range: on flexible array member: guile \(print \(value-subscript \(value-field \(value-dereference f\) \"items\"\) 1\)\)" + + # Cluster of gcc 4.8 ada FAILs, to be investigated, but not high priority. + "FAIL: gdb.ada/info_locals_renaming.exp: info locals" + "FAIL: gdb.ada/interface.exp: info locals" + "FAIL: gdb.ada/length_cond.exp: cond 1 loc'first > 15" + "FAIL: gdb.ada/length_cond.exp: cond 1 loc'last > 15" + "FAIL: gdb.ada/length_cond.exp: cond 1 loc'length > 15" + "FAIL: gdb.ada/null_overload.exp: print f\(r_access'\(null\)\)" + "FAIL: gdb.ada/str_uninit.exp: print my_str" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29244 + "FAIL: gdb.arch/amd64-disp-step-avx.exp: running to main in runto" + "FAIL: gdb.arch/amd64-init-x87-values.exp: check_x87_regs_around_init: runto: run to main" + "FAIL: gdb.arch/amd64-init-x87-values.exp: check_setting_mxcsr_before_enable: runto: run to main" + "FAIL: gdb.arch/amd64-init-x87-values.exp: check_setting_x87_regs_before_enable: runto: run to main" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: frame" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: starti prompt" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step back into _start \(the program is no longer running\)" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step back into foo \(the program is no longer running\)" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step into bar \(the program is no longer running\)" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step into foo \(the program is no longer running\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29245 + # Python-2 related. + "FAIL: gdb.python/py-mi-cmd.exp: -pycmd bk3 \(unexpected output\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=26967 + "FAIL: gdb.base/longjmp.exp: next over call_longjmp \(2\)" + "FAIL: gdb.base/longjmp.exp: next over longjmp\(1\)" + "FAIL: gdb.base/longjmp.exp: next over patt3" + "FAIL: gdb.base/premature-dummy-frame-removal.exp: p some_func \(\)" + "FAIL: gdb.base/premature-dummy-frame-removal.exp: set debug frame on" + "FAIL: gdb.base/longjmp-until-in-main.exp: until \\\$line, in main" + + # Test-cases that use -static but may turn out to be PIE when using + # unix/-fPIE/-fpie. + # https://sourceware.org/bugzilla/show_bug.cgi?id=29244 + "FAIL: gdb.base/break-entry.exp: runto: run to *" + "FAIL: gdb.base/catch-fork-static.exp: run to fork" + "FAIL: gdb.threads/staticthreads.exp: runto: run to main" + "FAIL: gdb.threads/staticthreads.exp: continue to main's call of sem_post" + "FAIL: gdb.threads/staticthreads.exp: handle SIG32 helps" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step back into _start" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step back into foo" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step into bar" + "FAIL: gdb.dwarf2/frame-inlined-in-outer-frame.exp: step into foo" + + # Fails on both i586 and s390x/-m31 for SLE-12-SP3, but does not reproduce + # on s390x/-m31 for SLE-12-SP5 with trunk. + "FAIL: gdb.guile/scm-disasm.exp: disassemble via memory port" + "FAIL: gdb.guile/scm-disasm.exp: memory-port: disassemble" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=30180 + "FAIL: gdb.fortran/module.exp: print var_d" + "FAIL: gdb.fortran/module.exp: print var_x value 31" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=30531 + "FAIL: gdb.threads/clone-thread_db.exp: continue to clone_fn \(the program exited\)" + "FAIL: gdb.threads/clone-thread_db.exp: continue to end \(the program is no longer running\)" + +) # kfail_sle12 + +kfail_sle11=( + + "${kfail_sle12[@]}" + + # For SLE-11, libipt is not enabled, so on intel we can run into + # https://sourceware.org/bugzilla/show_bug.cgi?id=30073 affecting + # many test-cases. + "FAIL: gdb.btrace/" + "FAIL: gdb.python/py-record-btrace" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=26956 + "FAIL: gdb.base/command-line-input.exp: print 1" + + # Due to using old python, 2.6. + # For instance, "ValueError: zero length field name in format". + "FAIL: gdb.python/py-autoloaded-pretty-printers-in-newobjfile-event.exp: print test" + "FAIL: gdb.python/py-breakpoint.exp: test_bkpt_address: python gdb.Breakpoint\(" *{}".format\(str\(main_addr\)\)\)" + "FAIL: gdb.python/py-framefilter.exp: info frame filter after disable frame filter" + "FAIL: gdb.python/py-framefilter.exp: info frame filter after reenabling frame filter" + "FAIL: gdb.python/py-framefilter.exp: info frame filter after setting priority" + "FAIL: gdb.python/py-framefilter.exp: info frame filter before disable frame filter" + "FAIL: gdb.python/py-framefilter.exp: info frame filter before setting priority" + "FAIL: gdb.python/py-mi.exp: check tsrvw expression value \(unexpected output\)" + "FAIL: gdb.python/py-mi.exp: check tsrvw varobj value \(unexpected output\)" + "FAIL: gdb.python/py-mi.exp: create tsrvw varobj \(unexpected output\)" + "FAIL: gdb.python/py-prettyprint.exp: c\+\+: print tsrvw" + "FAIL: gdb.python/py-prettyprint.exp: c: print tsrvw" + "FAIL: gdb.python/py-value.exp: attempt to construct large value with small buffer" + "FAIL: gdb.python/py-value.exp: construct array value from buffer" + "FAIL: gdb.python/py-value.exp: construct value from buffer" + "FAIL: gdb.python/py-value.exp: print array value" + "FAIL: gdb.python/py-value.exp: print first array element" + "FAIL: gdb.python/py-value.exp: print out of bounds array element" + "FAIL: gdb.python/py-value.exp: print second array element" + "FAIL: gdb.python/py-value.exp: print third array element" + + # To be investigated. + "FAIL: gdb.base/compare-sections.exp: after run to main: compare-sections -r" + "FAIL: gdb.python/py-framefilter-thread.exp: bt no-filters" + + # Gdb runs out of virtual memory, we can expect an internal error. + "FAIL: gdb.base/gcore-excessive-memory.exp: attach \(GDB internal error\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=30154 + "FAIL: gdb.multi/multi-target-no-resumed.exp: inf_A=.: inf_B=.: send_gdb control C \(timeout\)" + +) + +kfail_factory=( + + # 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=28551 + "FAIL: gdb.go/package.exp: going to first breakpoint \\(GDB internal error\\)" + + # 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=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" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=28667 + "FAIL: gdb.reverse/watch-precsave.exp: watchpoint hit, fourth time \\(GDB internal error\\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29196 + "FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next" + "FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at continue" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29253 + "FAIL: gdb.server/stop-reply-no-thread.exp: to_disable=threads: continue to main \(timeout\)" + "FAIL: gdb.server/stop-reply-no-thread.exp: to_disable=threads: continue until exit \(timeout\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29706 + "FAIL: gdb.base/eof-exit.exp: with non-dump terminal: with bracketed-paste-mode on: close GDB with eof \(missed the prompt\)" + + # Looks like a problem with modern debug info, where stepping out of a + # function takes more one step. + "FAIL: gdb.base/rtld-step.exp: finish out of foo 1" + "FAIL: gdb.base/rtld-step.exp: next over baz in bar" + "FAIL: gdb.base/rtld-step.exp: step into foo 2" + "FAIL: gdb.base/rtld-step.exp: next over baz in foo" + "FAIL: gdb.base/rtld-step.exp: step out of foo back into bar" + "FAIL: gdb.base/rtld-step.exp: continue until exit" + + # Sets breakpoints in gdb build with lto. This is known to be slow, and + # likely to cause timeouts. + gdb.gdb/python-helper.exp + +) # kfail_factory + +kfail_aarch64=( + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29405 + "FAIL: gdb.base/step-over-syscall.exp: (fork|vfork): displaced=(on|off): pc after stepi matches insn addr after syscall" + "FAIL: gdb.base/step-over-syscall.exp: (fork|vfork): displaced=(on|off): check_pc_after_cross_syscall: single step over fork final pc" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29423 + "FAIL: gdb.base/watchpoint-unaligned.exp: continue \(timeout\)" + "FAIL: gdb.base/watchpoint-unaligned.exp: size8twice write" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=28561 + # "[gdb/testsuite] Error due to not reading \r\n at end of mi prompt" + # We match pretty aggressively here. + "FAIL: gdb.mi/.*.exp:" + "FAIL: gdb.python/.*-mi.exp:" + "FAIL: gdb.python/py-mi-.*.exp:" + "FAIL: gdb.ada/mi.*.exp:" + "FAIL: gdb.base/annota.*.exp:" + "FAIL: gdb.dwarf2/dw2-opt-structptr.exp: mi" + +) # kfail_aarch64 + +kfail_powerpc64le=( + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29792 + "FAIL: gdb.opt/solib-intra-step.exp: second-hit" + + # Known to run into timeouts. + "FAIL: gdb.gdb/python-helper.exp" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=30548 + "FAIL: gdb.base/inline-frame-cycle-unwind.exp: cycle at level [0-9]*: backtrace when the unwind is broken at frame [0-9]*" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29815 + "FAIL: gdb.reverse/finish-reverse-bkpt.exp: reverse-finish from void_func trips breakpoint at entry" + "FAIL: gdb.reverse/finish-reverse-bkpt.exp: no spurious proceed after breakpoint stop" + "FAIL: gdb.reverse/next-reverse-bkpt-over-sr.exp: reverse-next over call trips user breakpoint at function entry" + "FAIL: gdb.reverse/next-reverse-bkpt-over-sr.exp: stopped at the right callee call" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29897 + "FAIL: gdb.base/run-control-while-bg-execution.exp: action1=.*: action2=start: start \(GDB internal error\)" + "FAIL: gdb.base/run-control-while-bg-execution.exp: action1=.*: action2=run: run \(GDB internal error\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=30021 + "FAIL: gdb.base/unwind-on-each-insn.exp: instruction 6: \\\$fba_value == \\\$main_fba" + "FAIL: gdb.base/unwind-on-each-insn.exp: instruction 6: \[string equal \\\$fid \\\$main_fid\]" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=30542 + "FAIL: gdb.base/watch-before-fork.exp: test: continue to catch fork" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=30543 + "FAIL: gdb.python/py-send-packet.exp: call python run_auxv_send_packet_test function" + + # Cluster of fails related to hw watchpoint support. + "FAIL: gdb.ada/scoped_watch.exp:" + "FAIL: gdb.ada/task_watch.exp:" + "FAIL: gdb.ada/watch_minus_l.exp:" + "FAIL: gdb.base/watch-before-fork.exp:" + "FAIL: gdb.base/watch-bitfields.exp:" + "FAIL: gdb.base/watch-cond.exp:" + "FAIL: gdb.base/watch-cond-infcall.exp:" + "FAIL: gdb.base/watchpoint-during-step.exp:" + "FAIL: gdb.base/watchpoint.exp:" + "FAIL: gdb.base/watchpoint-hw-attach.exp:" + "FAIL: gdb.base/watchpoint-hw-hit-once.exp:" + "FAIL: gdb.base/watchpoints.exp:" + "FAIL: gdb.base/watchpoint-solib.exp:" + "FAIL: gdb.base/watchpoint-stops-at-right-insn.exp:" + "FAIL: gdb.base/watchpoint-unaligned.exp:" + "FAIL: gdb.base/watch-read.exp:" + "FAIL: gdb.base/watch_thread_num.exp:" + "FAIL: gdb.base/watch-vfork.exp:" + "FAIL: gdb.cp/watch-cp.exp:" + "FAIL: gdb.mi/mi-watch.exp:" + "FAIL: gdb.threads/step-over-trips-on-watchpoint.exp:" + "FAIL: gdb.threads/watchpoint-fork.exp:" + "FAIL: gdb.threads/watchthreads2.exp:" + "FAIL: gdb.threads/wp-replication.exp:" + "FAIL: gdb.base/display.exp:" + "FAIL: gdb.base/recurse.exp:" + "FAIL: gdb.base/gdb11531.exp:" + "FAIL: gdb.base/pr11022.exp:" + "FAIL: gdb.base/value-double-free.exp: continue \(the program exited\)" + "FAIL: gdb.base/value-double-free.exp: print empty\(\)" + "FAIL: gdb.cp/annota2.exp: watch triggered on a.x \(timeout\)" + "FAIL: gdb.cp/annota2.exp: annotate-quit" + "FAIL: gdb.cp/annota3.exp: watch triggered on a.x \(timeout\)" + "FAIL: gdb.cp/annota3.exp: annotate-quit \(pattern 1\)" + "FAIL: gdb.mi/pr11022.exp:" + "FAIL: gdb.python/py-breakpoint.exp: test_watchpoints: Test watchpoint write \(the program exited\)" + "FAIL: gdb.python/py-breakpoint.exp: test_bkpt_internal: Test watchpoint write \(the program exited\)" + "FAIL: gdb.python/py-breakpoint.exp: test_bkpt_eval_funcs: Test watchpoint write \(the program exited\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=31004 + "FAIL: gdb.base/run-control-while-bg-execution.exp: action1=.*: action2=run: run" +) + +kfail_powerpc64le_sle12=( + +) + +kfail_s390x_s390=( + +) + +# Plain s390 or s390x/-m31. +kfail_s390=( + + "${kfail_s390x_s390[@]}" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29841 + "FAIL: gdb.reverse/.*.exp:" + + # Doesn't reproduce with trunk on SLE-12SP5. + "FAIL: gdb.guile/scm-ports.exp: buffered: test byte at sp, before flush" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29867 + "FAIL: gdb.guile/scm-lazy-string.exp: ptr: lazy string length 2 value" + "FAIL: gdb.guile/scm-lazy-string.exp: ptr: lazy string value" + "FAIL: gdb.guile/scm-lazy-string.exp: ptr: print ptr" + "FAIL: gdb.base/sym-file.exp: add-symbol-file sym-file-lib.so addr" + "FAIL: gdb.base/sym-file.exp: continue to breakpoint: gdb_add_symbol_file" + "FAIL: gdb.python/py-lazy-string.exp: ptr: lazy string length 2 value" + "FAIL: gdb.python/py-lazy-string.exp: ptr: lazy string value" + "FAIL: gdb.python/py-lazy-string.exp: ptr: print ptr" + "FAIL: gdb.python/py-nested-maps.exp: headers=on: pretty=off: exp='\*mm': depth=1: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: headers=on: pretty=off: exp='\*mm': depth=2: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: headers=on: pretty=off: exp='\*mm': depth=3: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: headers=on: pretty=off: exp='\*mm': depth=unlimited: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: pretty=off: exp='\*mm': depth=1: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: pretty=off: exp='\*mm': depth=2: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: pretty=off: exp='\*mm': depth=3: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: pretty=off: exp='\*mm': depth=unlimited: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: pretty=on: exp='\*mm': depth=1: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: pretty=on: exp='\*mm': depth=2: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: pretty=on: exp='\*mm': depth=3: p \*mm" + "FAIL: gdb.python/py-nested-maps.exp: pretty=on: exp='\*mm': depth=unlimited: p \*mm" + "FAIL: gdb.base/info-shared.exp:" + "FAIL: gdb.python/py-strfns.exp: p /d {char\[4\]} arg" + "FAIL: gdb.python/py-strfns.exp: p arg" + +) + +# s390x/-m64. +kfail_s390x=( + + "${kfail_s390x_s390[@]}" + +) + +kfail_i586=( + + # https://sourceware.org/bugzilla/show_bug.cgi?id=30518 + "FAIL: gdb.python/py-disasm.exp: memory source api: disassemble test" + "FAIL: gdb.python/py-disasm.exp: memory source api: python analyzing_disassembler.find_replacement_candidate\(\)" + "FAIL: gdb.python/py-disasm.exp: memory source api: second disassembler pass" + "FAIL: gdb.python/py-disasm.exp: memory source api: python analyzing_disassembler.check\(\)" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=30519 + "FAIL: gdb.python/py-parameter.exp: test_integer_parameter: kind=PARAM_UINTEGER: test default value" + "FAIL: gdb.python/py-parameter.exp: test_integer_parameter: kind=PARAM_UINTEGER: test default value via gdb.parameter" + "FAIL: gdb.python/py-parameter.exp: test_integer_parameter: kind=PARAM_UINTEGER: {test set to -1}" + "FAIL: gdb.python/py-parameter.exp: test_integer_parameter: kind=PARAM_UINTEGER: test value of -1" + "FAIL: gdb.python/py-parameter.exp: test_integer_parameter: kind=PARAM_UINTEGER: test value of -1 via gdb.parameter" + "FAIL: gdb.python/py-parameter.exp: test_integer_parameter: kind=PARAM_UINTEGER: test set to 1" + "FAIL: gdb.python/py-parameter.exp: test_integer_parameter: kind=PARAM_UINTEGER: test value of 1" + "FAIL: gdb.python/py-parameter.exp: test_integer_parameter: kind=PARAM_UINTEGER: test value of 1 via gdb.parameter" + "FAIL: gdb.python/py-parameter.exp: test_integer_parameter: kind=PARAM_UINTEGER: {test set to -5}" + "FAIL: gdb.python/py-parameter.exp: test_integer_parameter: kind=PARAM_UINTEGER: test value of -5 via gdb.parameter" + "FAIL: gdb.python/py-parameter.exp: test_integer_parameter: kind=PARAM_UINTEGER: test set to 5" + "FAIL: gdb.python/py-parameter.exp: test_integer_parameter: kind=PARAM_UINTEGER: test value of 5 via gdb.parameter" + "FAIL: gdb.python/py-parameter.exp: test_integer_parameter: kind=PARAM_UINTEGER: {test set to None}" + "FAIL: gdb.python/py-parameter.exp: test_integer_parameter: kind=PARAM_UINTEGER: test value of None" + "FAIL: gdb.python/py-parameter.exp: test_integer_parameter: kind=PARAM_UINTEGER: test value of None via gdb.parameter" + "FAIL: gdb.python/py-parameter.exp: test_integer_parameter: kind=PARAM_UINTEGER: test set to 0" + "FAIL: gdb.python/py-parameter.exp: test_integer_parameter: kind=PARAM_UINTEGER: test value of 0 via gdb.parameter" + +) + +kfail_armv7hl=( + + # https://sourceware.org/bugzilla/show_bug.cgi?id=30537 + "FAIL: gdb.fortran/intrinsics.exp: p cmplx \(4,4,16\) \(GDB internal error\)" + "FAIL: gdb.fortran/intrinsics.exp: ptype cmplx \(4,4,16\) \(GDB internal error\)" + +) + +case $n in + 1) + # 'FAIL: .* internal error' in gdb.sum. + # Test fail due to internal error. + # + # Todo: apply kfail_factory/kfail_sle12 only when appropriate. + kfail+=("${kfail_factory[@]}") + kfail+=("${kfail_sle12[@]}") + kfail+=("${kfail_sle11[@]}") + kfail+=("${kfail_s390[@]}") + kfail+=("${kfail_powerpc64le[@]}") + kfail+=("${kfail_armv7hl[@]}") + 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=28323 + "SLE-12.x86_64.*gdb.ada/mi_dyn_arr.exp" + + # Gdb runs out of virtual memory, we can expect an internal error. + "UNRESOLVED: gdb.base/gcore-excessive-memory.exp: attach" + "UNRESOLVED: gdb.base/gcore-excessive-memory.exp: verify we can get to main" + + # https://sourceware.org/bugzilla/show_bug.cgi?id=31001 + "UNRESOLVED: gdb.threads/async.exp: thread 1: current thread is 1" + ) + + 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: 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 [0-9]*." + # 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" + # https://sourceware.org/bugzilla/show_bug.cgi?id=28553 + "infrun.c:[0-9]*: internal-error: thread .* needs a step-over, but not in step-over queue" + # https://sourceware.org/bugzilla/show_bug.cgi?id=19675 + "linux-nat.c:[0-9]*: internal-error: wait returned unexpected" + # https://sourceware.org/bugzilla/show_bug.cgi?id=28604 + "x86-linux-dregs.c:[0-9]*: internal-error: void x86_linux_update_debug_registers\(lwp_info\*\): Assertion \`lwp_is_stopped \(lwp\)' failed." + + # https://sourceware.org/bugzilla/show_bug.cgi?id=28667 + "record-full.c:[0-9]*: internal-error: ptid_t record_full_wait_1\(target_ops\*, ptid_t, target_waitstatus\*, target_wait_flags\): Assertion \`\(options & TARGET_WNOHANG\) != 0' failed." + # https://sourceware.org/bugzilla/show_bug.cgi?id=26873 + "infrun.c:[0-9]*: internal-error: resume_1: Assertion \`!\(thread_has_single_step_breakpoints_set \(tp\) && step\)' failed." + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29783 + "frame.c:[0-9]*: internal-error: get_selected_frame: Assertion \`selected_frame != NULL' failed." + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29841 + "regcache.c:[0-9]*: internal-error: raw_read: Assertion \`buf != NULL' failed." + + # https://sourceware.org/bugzilla/show_bug.cgi?id=29897 + "displaced-stepping.c:[0-9]*: internal-error: prepare: Assertion \`buf.current_thread != thread' failed." + + # https://sourceware.org/bugzilla/show_bug.cgi?id=30537 + "f-lang.c:[0-9]*: internal-error: eval_op_f_cmplx: Assertion \`kind_arg->code \(\) == TYPE_CODE_COMPLEX' failed." + + # Test-case gdb.base/gcore-excessive-memory.exp. + "utils.c:[0-9]*: internal-error: virtual memory exhausted: can't allocate [0-9]* bytes." + ) + + kfail_re=$(join "|" "${kfail[@]}") + grep -a -H internal-error: binaries-testsuite.*/gdb-testresults/*.log \ + | grep -a -v "maint.c:[0-9]" \ + | grep -a -E -v "$kfail_re" + ;; + + 4) + ( + # 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" + "$config/gdb-x86_64-suse-linux-m32.sum") + + # + + for sum in "${sums[@]}"; do + sum=binaries-testsuite.$sum + report_sum "$sum" + done + ) + + ( + # Known clean config: Leap 15.3 i586 + config=openSUSE_Leap_15.3.i586/gdb-testresults + sums=("$config/gdb-i586-suse-linux-m32.-fno-PIE.-no-pie.sum" + "$config/gdb-i586-suse-linux-m32.sum") + + kfail+=("${kfail_i586[@]}") + + for sum in "${sums[@]}"; do + sum=binaries-testsuite.$sum + report_sum "$sum" + done + ) + + ( + # Known clean config: Leap 15.4 x86_64 + config=openSUSE_Leap_15.4.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" + "$config/gdb-x86_64-suse-linux-m32.sum") + + # + + for sum in "${sums[@]}"; do + sum=binaries-testsuite.$sum + report_sum "$sum" + done + ) + + ( + # Known clean config: Leap 15.4 i586 + config=openSUSE_Leap_15.4.i586/gdb-testresults + sums=("$config/gdb-i586-suse-linux-m32.-fno-PIE.-no-pie.sum" + "$config/gdb-i586-suse-linux-m32.sum") + + kfail+=("${kfail_i586[@]}") + + for sum in "${sums[@]}"; do + sum=binaries-testsuite.$sum + report_sum "$sum" + done + ) + + ( + # 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" + "$config/gdb-x86_64-suse-linux-m32.sum") + + # + + for sum in "${sums[@]}"; do + sum=binaries-testsuite.$sum + report_sum "$sum" + done + ) + + ( + # Known clean config: SLE 12 x86_64. + config=SLE-12.x86_64/gdb-testresults + sums=("$config/gdb-x86_64-suse-linux-m64.-fPIE.-pie.sum" + "$config/gdb-x86_64-suse-linux-m64.sum" + "$config/gdb-x86_64-suse-linux-m32.-fPIE.-pie.sum" + "$config/gdb-x86_64-suse-linux-m32.sum") + + kfail+=("${kfail_sle12[@]}") + + for sum in "${sums[@]}"; do + sum=binaries-testsuite.$sum + report_sum "$sum" + done + ) + + ( + # 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" + "$config/gdb-x86_64-suse-linux-m32.sum") + + kfail+=("${kfail_factory[@]}") + + for sum in "${sums[@]}"; do + sum=binaries-testsuite.$sum + report_sum "$sum" + done + ) + + ( + # Known clean config: Factory i586 + config=openSUSE_Factory_LegacyX86.i586/gdb-testresults + sums=("$config/gdb-i586-suse-linux-m32.-fno-PIE.-no-pie.sum" + "$config/gdb-i586-suse-linux-m32.sum") + + kfail+=("${kfail_factory[@]}") + kfail+=("${kfail_i586[@]}") + + for sum in "${sums[@]}"; do + sum=binaries-testsuite.$sum + report_sum "$sum" + done + ) + + ( + # Known clean config: SLE 15 aarch64. + config=SLE-15.aarch64/gdb-testresults + sums=("$config/gdb-aarch64-suse-linux.-fno-PIE.-no-pie.sum" + "$config/gdb-aarch64-suse-linux.sum") + + kfail+=("${kfail_aarch64[@]}") + + for sum in "${sums[@]}"; do + sum=binaries-testsuite.$sum + report_sum "$sum" + done + ) + + ( + # Known clean config: SLE 15 / openSUSE 15.4 powerpc64le. + for config in SLE-15.ppc64le/gdb-testresults openSUSE_Leap_15.4.ppc64le/gdb-testresults; do + sums=("$config/gdb-ppc64le-suse-linux-m64.-fno-PIE.-no-pie.sum" + "$config/gdb-ppc64le-suse-linux-m64.sum") + done + + kfail+=("${kfail_powerpc64le[@]}") + + for sum in "${sums[@]}"; do + sum=binaries-testsuite.$sum + report_sum "$sum" + done + ) + + ;; + + 5) + librpm=$(ls -1 binaries-testsuite*/gdb-testresults/*.sum \ + | grep -v SLE-11) + nolibrpm=$(ls -1 binaries-testsuite*/gdb-testresults/*.sum \ + | grep SLE-11) + if [ "$librpm" != "" ]; then + grep -c "PASS: gdb.suse/zypper-hint.exp: zypper hint printed (librpm)" \ + $librpm \ + | grep -E -v ":1" + fi + if [ "$nolibrpm" != "" ]; then + grep -c "PASS: gdb.suse/zypper-hint.exp: zypper hint printed (no librpm)" \ + $nolibrpm \ + | grep -E -v ":1" + fi + ;; + + -local) + sums=() + for f in "$dir"/*.sum; do + mapfile -t < <(echo_line "$f") + sums+=("${MAPFILE[@]}") + done + + if [ ${#sums[@]} -ne 4 ] && [ ${#sums[@]} -ne 2 ]; then + echo "No summary files to check" + exit 1 + fi + + + if $have_factory; then + kfail+=("${kfail_factory[@]}") + fi + if $have_sle11; then + kfail+=("${kfail_sle11[@]}") + fi + if $have_sle12; then + kfail+=("${kfail_sle12[@]}") + fi + if $have_aarch64; then + kfail+=("${kfail_aarch64[@]}") + fi + if $have_powerpc64le; then + kfail+=("${kfail_powerpc64le[@]}") + fi + if $have_powerpc64le && $have_sl12; then + kfail+=("${kfail_powerpc64le_sle12[@]}") + fi + if $have_s390; then + kfail+=("${kfail_s390[@]}") + fi + if $have_s390x; then + kfail+=("${kfail_s390x[@]}") + fi + if $have_i586; then + kfail+=("${kfail_i586[@]}") + fi + if $have_x86_64; then + kfail+=("${kfail_x86_64[@]}") + fi + + for sum in "${sums[@]}"; do + report_sum "$sum" + done + ;; + + *) + echo "Don't know how to handle arg: $n" + exit 1 + ;; +esac + +true diff --git a/remove-some-unnecessary-includes-from-exp.y.patch b/remove-some-unnecessary-includes-from-exp.y.patch new file mode 100644 index 0000000..e6ef23d --- /dev/null +++ b/remove-some-unnecessary-includes-from-exp.y.patch @@ -0,0 +1,171 @@ +From b4fdd96b50a92866886618f58d7408b2d086eeb0 Mon Sep 17 00:00:00 2001 +From: Tom Tromey +Date: Sat, 18 Mar 2023 08:27:17 -0600 +Subject: [PATCH] Remove some unnecessary includes from *-exp.y + +I noticed a weird comment in one of the .y files, and then ended up +removing some unnecessary #includes from these files. + +Tested by rebuilding. + +Approved-By: Simon Marchi +--- + gdb/ada-exp.y | 3 --- + gdb/c-exp.y | 3 --- + gdb/d-exp.y | 3 --- + gdb/f-exp.y | 3 --- + gdb/go-exp.y | 3 --- + gdb/m2-exp.y | 13 +++++-------- + gdb/p-exp.y | 4 ---- + 7 files changed, 5 insertions(+), 27 deletions(-) + +diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y +index 2f466e4de0a..a7052776b3a 100644 +--- a/gdb/ada-exp.y ++++ b/gdb/ada-exp.y +@@ -42,9 +42,6 @@ + #include "parser-defs.h" + #include "language.h" + #include "ada-lang.h" +-#include "bfd.h" /* Required by objfiles.h. */ +-#include "symfile.h" /* Required by objfiles.h. */ +-#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ + #include "frame.h" + #include "block.h" + #include "ada-exp.h" +diff --git a/gdb/c-exp.y b/gdb/c-exp.y +index 00599b0da7f..9ee4115560a 100644 +--- a/gdb/c-exp.y ++++ b/gdb/c-exp.y +@@ -43,9 +43,6 @@ + #include "language.h" + #include "c-lang.h" + #include "c-support.h" +-#include "bfd.h" /* Required by objfiles.h. */ +-#include "symfile.h" /* Required by objfiles.h. */ +-#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ + #include "charset.h" + #include "block.h" + #include "cp-support.h" +diff --git a/gdb/d-exp.y b/gdb/d-exp.y +index 1c299bf7ac6..3a4e7ee0434 100644 +--- a/gdb/d-exp.y ++++ b/gdb/d-exp.y +@@ -46,9 +46,6 @@ + #include "language.h" + #include "c-lang.h" + #include "d-lang.h" +-#include "bfd.h" /* Required by objfiles.h. */ +-#include "symfile.h" /* Required by objfiles.h. */ +-#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ + #include "charset.h" + #include "block.h" + #include "type-stack.h" +diff --git a/gdb/f-exp.y b/gdb/f-exp.y +index 30da537ea84..96d38af363c 100644 +--- a/gdb/f-exp.y ++++ b/gdb/f-exp.y +@@ -48,9 +48,6 @@ + #include "parser-defs.h" + #include "language.h" + #include "f-lang.h" +-#include "bfd.h" /* Required by objfiles.h. */ +-#include "symfile.h" /* Required by objfiles.h. */ +-#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ + #include "block.h" + #include + #include +diff --git a/gdb/go-exp.y b/gdb/go-exp.y +index 242e7103b94..cbaa79ee18c 100644 +--- a/gdb/go-exp.y ++++ b/gdb/go-exp.y +@@ -59,9 +59,6 @@ + #include "language.h" + #include "c-lang.h" + #include "go-lang.h" +-#include "bfd.h" /* Required by objfiles.h. */ +-#include "symfile.h" /* Required by objfiles.h. */ +-#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ + #include "charset.h" + #include "block.h" + #include "expop.h" +diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y +index 6629974a73e..3124aaad44b 100644 +--- a/gdb/m2-exp.y ++++ b/gdb/m2-exp.y +@@ -43,9 +43,6 @@ + #include "value.h" + #include "parser-defs.h" + #include "m2-lang.h" +-#include "bfd.h" /* Required by objfiles.h. */ +-#include "symfile.h" /* Required by objfiles.h. */ +-#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ + #include "block.h" + #include "m2-exp.h" + +@@ -140,7 +137,7 @@ using namespace expr; + %left '+' '-' + %left '*' '/' DIV MOD + %right UNARY +-%right '^' DOT '[' '(' ++%right '^' DOT_ID '[' '(' + %right NOT '~' + %left COLONCOLON QID + /* This is not an actual token ; it is used for precedence. +@@ -262,7 +259,7 @@ exp : DEC '(' exp ',' exp ')' + } + ; + +-exp : exp DOT NAME ++exp : exp DOT_ID NAME + { + pstate->push_new + (pstate->pop (), copy_name ($3)); +@@ -297,7 +294,7 @@ exp : exp '[' + that follow in the list. It is *not* specific to + function types */ + { pstate->start_arglist(); } +- non_empty_arglist ']' %prec DOT ++ non_empty_arglist ']' %prec DOT_ID + { + gdb_assert (pstate->arglist_len > 0); + std::vector args +@@ -311,7 +308,7 @@ exp : exp '(' + /* This is to save the value of arglist_len + being accumulated by an outer function call. */ + { pstate->start_arglist (); } +- arglist ')' %prec DOT ++ arglist ')' %prec DOT_ID + { + std::vector args + = pstate->pop_vector (pstate->end_arglist ()); +@@ -793,7 +790,7 @@ yylex (void) + else + { + pstate->lexptr++; +- return DOT; ++ return DOT_ID; + } + + /* These are character tokens that appear as-is in the YACC grammar */ +diff --git a/gdb/p-exp.y b/gdb/p-exp.y +index 6e03f1a5381..cf170408ac9 100644 +--- a/gdb/p-exp.y ++++ b/gdb/p-exp.y +@@ -50,11 +50,7 @@ + #include "parser-defs.h" + #include "language.h" + #include "p-lang.h" +-#include "bfd.h" /* Required by objfiles.h. */ +-#include "symfile.h" /* Required by objfiles.h. */ +-#include "objfiles.h" /* For have_full_symbols and have_partial_symbols. */ + #include "block.h" +-#include "completer.h" + #include "expop.h" + + #define parse_type(ps) builtin_type (ps->gdbarch ()) + +base-commit: ea9f87de71b8d5cd0f9d62ebca57cef7ee879324 +-- +2.35.3 + diff --git a/v2.0.5.tar.gz b/v2.0.5.tar.gz new file mode 100644 index 0000000..c3972db --- /dev/null +++ b/v2.0.5.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:95acf499fdf0a0f5ebd07587bb443c702b1fd79f7d869749824234388b9bff80 +size 343369 diff --git a/xcoffread.c-fix-werror-dangling-pointer-issue-with-m.patch b/xcoffread.c-fix-werror-dangling-pointer-issue-with-m.patch new file mode 100644 index 0000000..73b7e48 --- /dev/null +++ b/xcoffread.c-fix-werror-dangling-pointer-issue-with-m.patch @@ -0,0 +1,139 @@ +From c835eac78b389ce1e29aade9d0468c13854c1cb9 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Sat, 29 Apr 2023 22:46:11 +0200 +Subject: [PATCH 1/3] xcoffread.c: Fix -Werror=dangling-pointer= issue with + main_subfile. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +GCC 13 points out that main_subfile has local function scope, but a +pointer to it is assigned to the global inclTable array subfile +element field: + +In function ‘void process_linenos(CORE_ADDR, CORE_ADDR)’, + inlined from ‘void aix_process_linenos(objfile*)’ at xcoffread.c:727:19, + inlined from ‘void aix_process_linenos(objfile*)’ at xcoffread.c:720:1: +xcoffread.c:629:37: error: storing the address of local variable ‘main_subfile’ in ‘*inclTable.19_45 + _28._inclTable::subfile’ [-Werror=dangling-pointer=] + 629 | inclTable[ii].subfile = &main_subfile; + | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ +xcoffread.c: In function ‘void aix_process_linenos(objfile*)’: +xcoffread.c:579:18: note: ‘main_subfile’ declared here + 579 | struct subfile main_subfile; + | ^~~~~~~~~~~~ +xcoffread.c:496:19: note: ‘inclTable’ declared here + 496 | static InclTable *inclTable; /* global include table */ + | ^~~~~~~~~ + +Fix this by making main_subfile file static. And allocate and +deallocated together with inclTable in allocate_include_entry and +xcoff_symfile_finish. Adjust the use of main_subfile in +process_linenos to take a pointer to the subfile. +--- + gdb/xcoffread.c | 24 +++++++++++++----------- + 1 file changed, 13 insertions(+), 11 deletions(-) + +diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c +index 52ae3aecb97..53779259b57 100644 +--- a/gdb/xcoffread.c ++++ b/gdb/xcoffread.c +@@ -501,6 +501,9 @@ static int inclIndx; /* last entry to table */ + static int inclLength; /* table length */ + static int inclDepth; /* nested include depth */ + ++/* subfile structure for the main compilation unit. */ ++static subfile *main_subfile; ++ + static void allocate_include_entry (void); + + static void +@@ -551,6 +554,7 @@ allocate_include_entry (void) + inclTable = XCNEWVEC (InclTable, INITIAL_INCLUDE_TABLE_LENGTH); + inclLength = INITIAL_INCLUDE_TABLE_LENGTH; + inclIndx = 0; ++ main_subfile = new subfile; + } + else if (inclIndx >= inclLength) + { +@@ -578,9 +582,6 @@ process_linenos (CORE_ADDR start, CORE_ADDR end) + file_ptr max_offset + = XCOFF_DATA (this_symtab_objfile)->max_lineno_offset; + +- /* subfile structure for the main compilation unit. */ +- struct subfile main_subfile; +- + /* In the main source file, any time we see a function entry, we + reset this variable to function's absolute starting line number. + All the following line numbers in the function are relative to +@@ -599,7 +600,7 @@ process_linenos (CORE_ADDR start, CORE_ADDR end) + /* All source lines were in the main source file. None in include + files. */ + +- enter_line_range (&main_subfile, offset, 0, start, end, ++ enter_line_range (main_subfile, offset, 0, start, end, + &main_source_baseline); + + else +@@ -616,7 +617,7 @@ process_linenos (CORE_ADDR start, CORE_ADDR end) + if (offset < inclTable[ii].begin) + { + enter_line_range +- (&main_subfile, offset, inclTable[ii].begin - linesz, ++ (main_subfile, offset, inclTable[ii].begin - linesz, + start, 0, &main_source_baseline); + } + +@@ -627,9 +628,9 @@ process_linenos (CORE_ADDR start, CORE_ADDR end) + + main_source_baseline = inclTable[ii].funStartLine; + enter_line_range +- (&main_subfile, inclTable[ii].begin, inclTable[ii].end, ++ (main_subfile, inclTable[ii].begin, inclTable[ii].end, + start, 0, &main_source_baseline); +- inclTable[ii].subfile = &main_subfile; ++ inclTable[ii].subfile = main_subfile; + } + else + { +@@ -651,24 +652,24 @@ process_linenos (CORE_ADDR start, CORE_ADDR end) + enter remaining lines of the main file, if any left. */ + if (offset < max_offset + 1 - linesz) + { +- enter_line_range (&main_subfile, offset, 0, start, end, ++ enter_line_range (main_subfile, offset, 0, start, end, + &main_source_baseline); + } + } + + /* Process main file's line numbers. */ +- if (!main_subfile.line_vector_entries.empty ()) ++ if (!main_subfile->line_vector_entries.empty ()) + { + /* Line numbers are not necessarily ordered. xlc compilation will + put static function to the end. */ +- arrange_linetable (main_subfile.line_vector_entries); ++ arrange_linetable (main_subfile->line_vector_entries); + } + + /* Now, process included files' line numbers. */ + + for (int ii = 0; ii < inclIndx; ++ii) + { +- if (inclTable[ii].subfile != ((struct subfile *) &main_subfile) ++ if (inclTable[ii].subfile != main_subfile + && !inclTable[ii].subfile->line_vector_entries.empty ()) + { + /* Line numbers are not necessarily ordered. xlc compilation will +@@ -1811,6 +1812,7 @@ xcoff_symfile_finish (struct objfile *objfile) + { + xfree (inclTable); + inclTable = NULL; ++ delete main_subfile; + } + inclIndx = inclLength = inclDepth = 0; + } + +base-commit: 38a5283b23caca5317eaeb7927a5a11eccc6eb69 +-- +2.35.3 +