gdb/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch

265 lines
9.4 KiB
Diff
Raw Normal View History

2018-03-09 16:46:37 +00:00
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Jan Kratochvil <jan.kratochvil@redhat.com>
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 <jan.kratochvil@redhat.com>
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.
Accepting request 78265 from devel:gcc - Merge from gdb-7.3-41.fc15.src.rpm. [fate#310741] * Tue Jul 26 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 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 <jan.kratochvil@redhat.com> - 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 <jan.kratochvil@redhat.com> - 7.2.90.20110525-39.fc15 - Fix install-info for the gdb-doc subpackage (BZ 715228). - Merge from gdb-7.2.90.20110525-38.fc15.src.rpm. [fate#310741] * Wed May 25 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 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 <jan.kratochvil@redhat.com> - 7.2.90.20110429-37.fc15 - Search also for .<seqno> files in /usr/lib/debug/.build-id (BZ 641377). - Merge from gdb-7.2.90.20110429-36.fc15.src.rpm. * Mon May 2 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 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 <jan.kratochvil@redhat.com> - 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). OBS-URL: https://build.opensuse.org/request/show/78265 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gdb?expand=0&rev=85
2011-08-11 13:47:36 +00:00
Original patch hooked into target_translate_tls_address. But its inferior
call invalidates `struct frame *' in the callers - RH BZ 690908.
- 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. OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=115
2015-02-25 13:45:10 +00:00
https://bugzilla.redhat.com/show_bug.cgi?id=1166549
2007-11-03 Jan Kratochvil <jan.kratochvil@redhat.com>
* ./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
2018-03-09 16:46:37 +00:00
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
Accepting request 851545 from home:tomdevries:branches:devel:gcc-gdb-10.1-rebase - 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. - 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 - Patch updated: * gdb-testsuite-gdb-tui-new-layout-exp-partly-require-tcl86.patch - Patch updated: * gdb-testsuite-gdb-tui-new-layout-exp-partly-require-tcl86.patch - 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 - 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 - 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 - Add missing patch command for: * gdb-fortran-fix-print-dynamic-array.patch - Fix patch application on SLE-11: * gdb-testsuite-detect-gdb-prompt-after-monitor-exit.patch - 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 - Enable gdbserver for riscv64. - Restrict BuildRequires libdebuginfod to Factory and supporting archs. - 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 OBS-URL: https://build.opensuse.org/request/show/851545 OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=263
2020-11-30 14:28:07 +00:00
@@ -1210,6 +1210,10 @@ print_command_1 (const char *args, int voidprint)
Accepting request 822281 from home:tomdevries:branches:gdb-upgrade - 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 - Fix patch context: * gdb-fix-the-thread-pool.c-compilation.patch - Fix build error due to missing DIAGNOSTIC_IGNORE_UNUSED_FUNCTION. * gdb-fix-the-thread-pool.c-compilation.patch - Drop ChangeLog part of patch: * gdb-fix-unused-function-error.patch - Fix Werror=unused-function with gcc 4.8 (for Leap 42.3). * gdb-fix-unused-function-error.patch - Require %{suse_version} >= 1500 for --with-system-readline. - 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 OBS-URL: https://build.opensuse.org/request/show/822281 OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=251
2020-07-23 12:21:48 +00:00
if (exp != nullptr && *exp)
Accepting request 78265 from devel:gcc - Merge from gdb-7.3-41.fc15.src.rpm. [fate#310741] * Tue Jul 26 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 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 <jan.kratochvil@redhat.com> - 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 <jan.kratochvil@redhat.com> - 7.2.90.20110525-39.fc15 - Fix install-info for the gdb-doc subpackage (BZ 715228). - Merge from gdb-7.2.90.20110525-38.fc15.src.rpm. [fate#310741] * Wed May 25 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 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 <jan.kratochvil@redhat.com> - 7.2.90.20110429-37.fc15 - Search also for .<seqno> files in /usr/lib/debug/.build-id (BZ 641377). - Merge from gdb-7.2.90.20110429-36.fc15.src.rpm. * Mon May 2 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 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 <jan.kratochvil@redhat.com> - 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). OBS-URL: https://build.opensuse.org/request/show/78265 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gdb?expand=0&rev=85
2011-08-11 13:47:36 +00:00
{
- 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. OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=115
2015-02-25 13:45:10 +00:00
+ /* '*((int *(*) (void)) __errno_location) ()' is incompatible with
+ function descriptors. */
+ if (target_has_execution && strcmp (exp, "errno") == 0)
+ exp = "*(*(int *(*)(void)) __errno_location) ()";
expression_up expr = parse_expression (exp);
val = evaluate_expression (expr.get ());
}
2018-03-09 16:46:37 +00:00
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 <http://www.gnu.org/licenses/>.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <errno.h>
+
+int main()
+{
+ errno = 42;
+
+ return 0; /* breakpoint */
+}
2018-03-09 16:46:37 +00:00
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 <http://www.gnu.org/licenses/>.
+
+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?
2018-03-09 16:46:37 +00:00
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
- 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. OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=115
2015-02-25 13:45:10 +00:00
@@ -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 <http://www.gnu.org/licenses/>.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <errno.h>
+
+int main()
+{
+ errno = 42;
+
+ return 0; /* breakpoint */
+}
2018-03-09 16:46:37 +00:00
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
- 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. OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=115
2015-02-25 13:45:10 +00:00
@@ -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 <http://www.gnu.org/licenses/>.
+
+set testfile dw2-errno2
+set srcfile ${testfile}.c
+set binfile [standard_output_file ${testfile}]
- 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. OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=115
2015-02-25 13:45:10 +00:00
+
+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 "*-*-*"
+ }
2018-03-09 16:46:37 +00:00
+ gdb_test "print (int) errno" ".* = 42" "print errno for core"
- 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. OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=115
2015-02-25 13:45:10 +00:00
+}}
+
+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?