Revert "gcc-toolset-12-gdb package is retired on branch c10s for CS-2551"
This reverts commit 60678774a9
.
This commit is contained in:
parent
60678774a9
commit
76e5c80855
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
SOURCES/gdb-11.2.tar.xz
|
||||
SOURCES/gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz
|
||||
SOURCES/v2.0.5.tar.gz
|
||||
/gdb-11.2.tar.xz
|
||||
/gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz
|
||||
/v2.0.5.tar.gz
|
@ -1,3 +0,0 @@
|
||||
# Package Not Available
|
||||
This package is not available on CentOS Stream 10.
|
||||
It may be available on another branch.
|
365
_gdb.spec.Patch.include
Normal file
365
_gdb.spec.Patch.include
Normal file
@ -0,0 +1,365 @@
|
||||
# Match the Fedora's version info.
|
||||
#=fedora
|
||||
Patch001: gdb-6.3-rh-testversion-20041202.patch
|
||||
|
||||
# Add a wrapper script to GDB that implements pstack using the
|
||||
# --readnever option.
|
||||
#=push
|
||||
Patch002: gdb-6.3-gstack-20050411.patch
|
||||
|
||||
# Test support of multiple destructors just like multiple constructors
|
||||
#=fedoratest
|
||||
Patch003: gdb-6.3-test-dtorfix-20050121.patch
|
||||
|
||||
# Fix to support executable moving
|
||||
#=fedoratest
|
||||
Patch004: gdb-6.3-test-movedir-20050125.patch
|
||||
|
||||
# Test sibling threads to set threaded watchpoints for x86 and x86-64
|
||||
#=fedoratest
|
||||
Patch005: gdb-6.3-threaded-watchpoints2-20050225.patch
|
||||
|
||||
# Verify printing of inherited members test
|
||||
#=fedoratest
|
||||
Patch006: gdb-6.3-inheritancetest-20050726.patch
|
||||
|
||||
# Support TLS symbols (+`errno' suggestion if no pthread is found) (BZ 185337).
|
||||
#=push+jan: It should be replaced by Infinity project.
|
||||
Patch007: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
|
||||
|
||||
# Fix TLS symbols resolving for shared libraries with a relative pathname.
|
||||
# The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'.
|
||||
#=fedoratest: One should recheck if it is really fixed upstream.
|
||||
Patch008: gdb-6.5-sharedlibrary-path.patch
|
||||
|
||||
# Improved testsuite results by the testsuite provided by the courtesy of BEA.
|
||||
#=fedoratest: For upstream it should be rewritten as a dejagnu test, the test of no "??" was useful.
|
||||
Patch009: gdb-6.5-BEA-testsuite.patch
|
||||
|
||||
# Testcase for deadlocking on last address space byte; for corrupted backtraces.
|
||||
#=fedoratest
|
||||
Patch010: gdb-6.5-last-address-space-byte-test.patch
|
||||
|
||||
# Fix readline segfault on excessively long hand-typed lines.
|
||||
#=fedoratest
|
||||
Patch011: gdb-6.5-readline-long-line-crash-test.patch
|
||||
|
||||
# Test sideeffects of skipping ppc .so libs trampolines (BZ 218379).
|
||||
#=fedoratest
|
||||
Patch012: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
|
||||
|
||||
# Find symbols properly at their original (included) file (BZ 109921).
|
||||
#=fedoratest
|
||||
Patch013: gdb-6.5-bz109921-DW_AT_decl_file-test.patch
|
||||
|
||||
# Update PPC unwinding patches to their upstream variants (BZ 140532).
|
||||
#=fedoratest
|
||||
Patch014: gdb-6.3-bz140532-ppc-unwinding-test.patch
|
||||
|
||||
# Testcase for exec() from threaded program (BZ 202689).
|
||||
#=fedoratest
|
||||
Patch015: gdb-6.3-bz202689-exec-from-pthread-test.patch
|
||||
|
||||
# Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
|
||||
#=fedoratest
|
||||
Patch016: gdb-6.6-bz230000-power6-disassembly-test.patch
|
||||
|
||||
# Allow running `/usr/bin/gcore' with provided but inaccessible tty (BZ 229517).
|
||||
#=fedoratest
|
||||
Patch017: gdb-6.6-bz229517-gcore-without-terminal.patch
|
||||
|
||||
# Avoid too long timeouts on failing cases of "annota1.exp annota3.exp".
|
||||
#=fedoratest
|
||||
Patch018: gdb-6.6-testsuite-timeouts.patch
|
||||
|
||||
# Support for stepping over PPC atomic instruction sequences (BZ 237572).
|
||||
#=fedoratest
|
||||
Patch019: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
|
||||
|
||||
# Test kernel VDSO decoding while attaching to an i386 process.
|
||||
#=fedoratest
|
||||
Patch020: gdb-6.3-attach-see-vdso-test.patch
|
||||
|
||||
# Test leftover zombie process (BZ 243845).
|
||||
#=fedoratest
|
||||
Patch021: gdb-6.5-bz243845-stale-testing-zombie-test.patch
|
||||
|
||||
# New locating of the matching binaries from the pure core file (build-id).
|
||||
#=push+jan
|
||||
Patch022: gdb-6.6-buildid-locate.patch
|
||||
|
||||
# Fix loading of core files without build-ids but with build-ids in executables.
|
||||
# Load strictly build-id-checked core files only if no executable is specified
|
||||
# (Jan Kratochvil, RH BZ 1339862).
|
||||
#=push+jan
|
||||
Patch023: gdb-6.6-buildid-locate-solib-missing-ids.patch
|
||||
|
||||
#=push+jan
|
||||
Patch024: gdb-6.6-buildid-locate-rpm.patch
|
||||
|
||||
# Fix displaying of numeric char arrays as strings (BZ 224128).
|
||||
#=fedoratest: But it is failing anyway, one should check the behavior more.
|
||||
Patch025: gdb-6.7-charsign-test.patch
|
||||
|
||||
# Test PPC hiding of call-volatile parameter register.
|
||||
#=fedoratest
|
||||
Patch026: gdb-6.7-ppc-clobbered-registers-O2-test.patch
|
||||
|
||||
# Testsuite fixes for more stable/comparable results.
|
||||
#=fedoratest
|
||||
Patch027: gdb-6.7-testsuite-stable-results.patch
|
||||
|
||||
# Test ia64 memory leaks of the code using libunwind.
|
||||
#=fedoratest
|
||||
Patch028: gdb-6.5-ia64-libunwind-leak-test.patch
|
||||
|
||||
# Test hiding unexpected breakpoints on intentional step commands.
|
||||
#=fedoratest
|
||||
Patch029: gdb-6.5-missed-trap-on-step-test.patch
|
||||
|
||||
# Test gcore memory and time requirements for large inferiors.
|
||||
#=fedoratest
|
||||
Patch030: gdb-6.5-gcore-buffer-limit-test.patch
|
||||
|
||||
# Test GCORE for shmid 0 shared memory mappings.
|
||||
#=fedoratest: But it is broken anyway, sometimes the case being tested is not reproducible.
|
||||
Patch031: gdb-6.3-mapping-zero-inode-test.patch
|
||||
|
||||
# Test a crash on `focus cmd', `focus prev' commands.
|
||||
#=fedoratest
|
||||
Patch032: gdb-6.3-focus-cmd-prev-test.patch
|
||||
|
||||
# Test various forms of threads tracking across exec() (BZ 442765).
|
||||
#=fedoratest
|
||||
Patch033: gdb-6.8-bz442765-threaded-exec-test.patch
|
||||
|
||||
# Test a crash on libraries missing the .text section.
|
||||
#=fedoratest
|
||||
Patch034: gdb-6.5-section-num-fixup-test.patch
|
||||
|
||||
# Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
|
||||
#=fedoratest
|
||||
Patch035: gdb-6.8-bz466901-backtrace-full-prelinked.patch
|
||||
|
||||
# New test for step-resume breakpoint placed in multiple threads at once.
|
||||
#=fedoratest
|
||||
Patch036: gdb-simultaneous-step-resume-breakpoint-test.patch
|
||||
|
||||
# Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
|
||||
# Fix regression of undisplayed missing shared libraries caused by a fix for.
|
||||
#=fedoratest: It should be in glibc: libc-alpha: <20091004161706.GA27450@.*>
|
||||
Patch037: gdb-core-open-vdso-warning.patch
|
||||
|
||||
# Workaround ccache making lineno non-zero for command-line definitions.
|
||||
#=fedoratest: ccache is rarely used and it is even fixed now.
|
||||
Patch038: gdb-ccache-workaround.patch
|
||||
|
||||
# Testcase for "Do not make up line information" fix by Daniel Jacobowitz.
|
||||
#=fedoratest
|
||||
Patch039: gdb-lineno-makeup-test.patch
|
||||
|
||||
# Test power7 ppc disassembly.
|
||||
#=fedoratest
|
||||
Patch040: gdb-ppc-power7-test.patch
|
||||
|
||||
# Fix follow-exec for C++ programs (bugreported by Martin Stransky).
|
||||
#=fedoratest
|
||||
Patch041: gdb-archer-next-over-throw-cxx-exec.patch
|
||||
|
||||
# Backport DWARF-4 support (BZ 601887, Tom Tromey).
|
||||
#=fedoratest
|
||||
Patch042: gdb-bz601887-dwarf4-rh-test.patch
|
||||
|
||||
# Workaround librpm BZ 643031 due to its unexpected exit() calls (BZ 642879).
|
||||
#=push+jan
|
||||
Patch043: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch
|
||||
|
||||
# [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604).
|
||||
#=fedoratest
|
||||
Patch044: gdb-test-bt-cfi-without-die.patch
|
||||
|
||||
# Verify GDB Python built-in function gdb.solib_address exists (BZ # 634108).
|
||||
#=fedoratest
|
||||
Patch045: gdb-bz634108-solib_address.patch
|
||||
|
||||
# New test gdb.arch/x86_64-pid0-core.exp for kernel PID 0 cores (BZ 611435).
|
||||
#=fedoratest
|
||||
Patch046: gdb-test-pid0-core.patch
|
||||
|
||||
# [archer-tromey-delayed-symfile] New test gdb.dwarf2/dw2-aranges.exp.
|
||||
#=fedoratest
|
||||
Patch047: gdb-test-dw2-aranges.patch
|
||||
|
||||
# [archer-keiths-expr-cumulative+upstream] Import C++ testcases.
|
||||
#=fedoratest
|
||||
Patch048: gdb-test-expr-cumulative-archer.patch
|
||||
|
||||
# Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz).
|
||||
#=fedoratest
|
||||
Patch049: gdb-physname-pr11734-test.patch
|
||||
|
||||
# Fix regressions on C++ names resolving (PR 11734, PR 12273, Keith Seitz).
|
||||
#=fedoratest
|
||||
Patch050: gdb-physname-pr12273-test.patch
|
||||
|
||||
# Test GDB opcodes/ disassembly of Intel Ivy Bridge instructions (BZ 696890).
|
||||
#=fedoratest
|
||||
Patch051: gdb-test-ivy-bridge.patch
|
||||
|
||||
# Hack for proper PIE run of the testsuite.
|
||||
#=fedoratest
|
||||
Patch052: gdb-runtest-pie-override.patch
|
||||
|
||||
# Workaround PR libc/14166 for inferior calls of strstr.
|
||||
#=fedoratest: Compatibility with RHELs (unchecked which ones).
|
||||
Patch053: gdb-glibc-strstr-workaround.patch
|
||||
|
||||
# Include testcase for `Unable to see a variable inside a module (XLF)' (BZ 823789).
|
||||
#=fedoratest
|
||||
Patch054: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch
|
||||
|
||||
# Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343).
|
||||
#=fedoratest
|
||||
Patch055: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
|
||||
|
||||
# Import regression test for `gdb/findvar.c:417: internal-error:
|
||||
# read_var_value: Assertion `frame' failed.' (RH BZ 947564) from RHEL 6.5.
|
||||
#=fedoratest
|
||||
Patch056: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch
|
||||
|
||||
# Fix 'memory leak in infpy_read_memory()' (RH BZ 1007614)
|
||||
#=fedoratest
|
||||
Patch057: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
|
||||
|
||||
# Fix 'gdb gives highly misleading error when debuginfo pkg is present,
|
||||
# but not corresponding binary pkg' (RH BZ 981154).
|
||||
#=push+jan
|
||||
Patch058: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch
|
||||
|
||||
# Display Fortran strings in backtraces.
|
||||
#=fedoratest
|
||||
Patch059: gdb-fortran-frame-string.patch
|
||||
|
||||
# Testcase for '[SAP] Recursive dlopen causes SAP HANA installer to
|
||||
# crash.' (RH BZ 1156192).
|
||||
#=fedoratest
|
||||
Patch060: gdb-rhbz1156192-recursive-dlopen-test.patch
|
||||
|
||||
# Fix '`catch syscall' doesn't work for parent after `fork' is called'
|
||||
# (Philippe Waroquiers, RH BZ 1149205).
|
||||
#=fedoratest
|
||||
Patch061: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
|
||||
|
||||
# Fix 'backport GDB 7.4 fix to RHEL 6.6 GDB' [Original Sourceware bug
|
||||
# description: 'C++ (and objc): Internal error on unqualified name
|
||||
# re-set', PR 11657] (RH BZ 1186476).
|
||||
#=fedoratest
|
||||
Patch062: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch
|
||||
|
||||
# Test 'info type-printers' Python error (RH BZ 1350436).
|
||||
#=fedoratest
|
||||
Patch063: gdb-rhbz1350436-type-printers-error.patch
|
||||
|
||||
# Fix '[ppc64] and [s390x] wrong prologue skip on -O2 -g code' (Jan
|
||||
# Kratochvil, RH BZ 1084404).
|
||||
#=fedoratest
|
||||
Patch064: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
|
||||
|
||||
# Force libncursesw over libncurses to match the includes (RH BZ 1270534).
|
||||
#=push+jan
|
||||
Patch065: gdb-fedora-libncursesw.patch
|
||||
|
||||
# Test clflushopt instruction decode (for RH BZ 1262471).
|
||||
#=fedoratest
|
||||
Patch066: gdb-opcodes-clflushopt-test.patch
|
||||
|
||||
# [SCL] Skip deprecated .gdb_index warning for Red Hat built files (BZ 953585).
|
||||
#=push+jan
|
||||
Patch067: gdb-6.6-buildid-locate-rpm-scl.patch
|
||||
|
||||
# [aarch64] Fix hardware watchpoints (RH BZ 1261564).
|
||||
#=fedoratest
|
||||
Patch068: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
|
||||
|
||||
# Add messages suggesting more recent RHEL gdbserver (RH BZ 1321114).
|
||||
#=fedora
|
||||
Patch069: gdb-container-rh-pkg.patch
|
||||
|
||||
# New test for Python "Cannot locate object file for block" (for RH BZ 1325795).
|
||||
#=fedoratest
|
||||
Patch070: gdb-rhbz1325795-framefilters-test.patch
|
||||
|
||||
# [dts+el7] [x86*] Bundle linux_perf.h for libipt (RH BZ 1256513).
|
||||
#=fedora
|
||||
Patch071: gdb-linux_perf-bundle.patch
|
||||
|
||||
# Fix gdb-headless /usr/bin/ executables (BZ 1390251).
|
||||
#
|
||||
# Also, make /usr/bin/gdb.minimal be the default GDB used, if it's
|
||||
# present. For rationale, see:
|
||||
#
|
||||
# https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot
|
||||
#=fedora
|
||||
Patch072: gdb-libexec-add-index.patch
|
||||
|
||||
# New testcase for: Fix <tab>-completion crash (Gary Benson, RH BZ 1398387).
|
||||
#=fedoratest
|
||||
Patch073: gdb-rhbz1398387-tab-crash-test.patch
|
||||
|
||||
# [s390x] Backport arch12 instructions decoding (RH BZ 1553104).
|
||||
# =fedoratest
|
||||
Patch074: gdb-rhbz1553104-s390x-arch12-test.patch
|
||||
|
||||
#Backport upstream patch which fixes internal-error: Unexpected
|
||||
#type field location kind (RHBZ 1976887).
|
||||
Patch075: gdb-rhbz1976887-field-location-kind.patch
|
||||
|
||||
# Backport test for RHBZ 1976887 (Kevin Buettner).
|
||||
Patch076: gdb-test-for-rhbz1976887.patch
|
||||
|
||||
# Backport gdb.fortran testsuite changes in order to avoid Fortran
|
||||
# lexical analyzer bug.
|
||||
Patch077: gdb-rhbz2012976-paper-over-fortran-lex-problems.patch
|
||||
|
||||
# Backport manpage update
|
||||
Patch078: gdb-rhbz-853071-update-manpages.patch
|
||||
|
||||
# Backport fix for dprintf bug (RH BZ 2022177).
|
||||
Patch079: gdb-rhbz2022177-dprintf-1.patch
|
||||
|
||||
# Backport test case for dprintf bug (RH BZ 2022177).
|
||||
Patch080: gdb-rhbz2022177-dprintf-2.patch
|
||||
|
||||
#Backport upstream commit from Aaron Merey
|
||||
#3ea44f21299 gdb.texinfo: Expand documentation for debuginfod
|
||||
Patch081: gdb-rhbz2024875-expand-documentation-for-debuginfod.patch
|
||||
|
||||
#Backport upstream commit from Aaron Merey
|
||||
#7811fa5995f gdb: add set/show commands for managing debuginfo
|
||||
Patch082: gdb-rhbz2024875-set_show-for-managing-debuginfod.patch
|
||||
|
||||
#Backport upstream commit from Tom Tromey
|
||||
#2a8f1f47446 Fix unittest.exp failure due to 'set debuginfod' addition
|
||||
Patch083: gdb-rhbz2024875-fix-unittest-failure.patch
|
||||
|
||||
#Backport upstream commit from Simon Marchi
|
||||
#333f35b6315 gdb: pass/return setting setter/getter
|
||||
#scalar values by value
|
||||
Patch084: gdb-rhbz202487-rework-set-debuginfod.patch
|
||||
|
||||
#Backport upstream commit from Aaron Merey
|
||||
#b9db26b4c44 [PR gdb/27026] CTRL-C is ignored when debug info is downloaded
|
||||
Patch085: gdb-rhbz2024875-pr27026.patch
|
||||
|
||||
# Fix build problems.
|
||||
# (RHBZ 2042257, Keith Seitz, Andrew Burgess)
|
||||
Patch086: gdb-rhbz2042257-ftbs-updates.patch
|
||||
|
||||
# Backport fix which fixes internal error due to libcc_s lacking a
|
||||
# .data section.
|
||||
Patch087: gdb-rhbz2042664-fix-sect_index_data-internal-error.patch
|
||||
|
||||
# Backport upstream patch from Aaron Merey which suppresses debuginfod
|
||||
# progress messages when size is zero. (RH BZ 2068280).
|
||||
Patch088: gdb-rhbz2068280-debuginfod-unavailable-size.patch
|
||||
|
88
_gdb.spec.patch.include
Normal file
88
_gdb.spec.patch.include
Normal file
@ -0,0 +1,88 @@
|
||||
%patch001 -p1
|
||||
%patch002 -p1
|
||||
%patch003 -p1
|
||||
%patch004 -p1
|
||||
%patch005 -p1
|
||||
%patch006 -p1
|
||||
%patch007 -p1
|
||||
%patch008 -p1
|
||||
%patch009 -p1
|
||||
%patch010 -p1
|
||||
%patch011 -p1
|
||||
%patch012 -p1
|
||||
%patch013 -p1
|
||||
%patch014 -p1
|
||||
%patch015 -p1
|
||||
%patch016 -p1
|
||||
%patch017 -p1
|
||||
%patch018 -p1
|
||||
%patch019 -p1
|
||||
%patch020 -p1
|
||||
%patch021 -p1
|
||||
%patch022 -p1
|
||||
%patch023 -p1
|
||||
%patch024 -p1
|
||||
%patch025 -p1
|
||||
%patch026 -p1
|
||||
%patch027 -p1
|
||||
%patch028 -p1
|
||||
%patch029 -p1
|
||||
%patch030 -p1
|
||||
%patch031 -p1
|
||||
%patch032 -p1
|
||||
%patch033 -p1
|
||||
%patch034 -p1
|
||||
%patch035 -p1
|
||||
%patch036 -p1
|
||||
%patch037 -p1
|
||||
%patch038 -p1
|
||||
%patch039 -p1
|
||||
%patch040 -p1
|
||||
%patch041 -p1
|
||||
%patch042 -p1
|
||||
%patch043 -p1
|
||||
%patch044 -p1
|
||||
%patch045 -p1
|
||||
%patch046 -p1
|
||||
%patch047 -p1
|
||||
%patch048 -p1
|
||||
%patch049 -p1
|
||||
%patch050 -p1
|
||||
%patch051 -p1
|
||||
%patch052 -p1
|
||||
%patch053 -p1
|
||||
%patch054 -p1
|
||||
%patch055 -p1
|
||||
%patch056 -p1
|
||||
%patch057 -p1
|
||||
%patch058 -p1
|
||||
%patch059 -p1
|
||||
%patch060 -p1
|
||||
%patch061 -p1
|
||||
%patch062 -p1
|
||||
%patch063 -p1
|
||||
%patch064 -p1
|
||||
%patch065 -p1
|
||||
%patch066 -p1
|
||||
%patch067 -p1
|
||||
%patch068 -p1
|
||||
%patch069 -p1
|
||||
%patch070 -p1
|
||||
%patch071 -p1
|
||||
%patch072 -p1
|
||||
%patch073 -p1
|
||||
%patch074 -p1
|
||||
%patch075 -p1
|
||||
%patch076 -p1
|
||||
%patch077 -p1
|
||||
%patch078 -p1
|
||||
%patch079 -p1
|
||||
%patch080 -p1
|
||||
%patch081 -p1
|
||||
%patch082 -p1
|
||||
%patch083 -p1
|
||||
%patch084 -p1
|
||||
%patch085 -p1
|
||||
%patch086 -p1
|
||||
%patch087 -p1
|
||||
%patch088 -p1
|
@ -1 +0,0 @@
|
||||
gcc-toolset-12-gdb package is retired on branch c10s for CS-2551
|
120
gdb-6.3-attach-see-vdso-test.patch
Normal file
120
gdb-6.3-attach-see-vdso-test.patch
Normal file
@ -0,0 +1,120 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
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 <unistd.h>
|
||||
+
|
||||
+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 <jan.kratochvil@redhat.com>.
|
||||
+
|
||||
+# 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}"
|
320
gdb-6.3-bz140532-ppc-unwinding-test.patch
Normal file
320
gdb-6.3-bz140532-ppc-unwinding-test.patch
Normal file
@ -0,0 +1,320 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-bz140532-ppc-unwinding-test.patch
|
||||
|
||||
;; Update PPC unwinding patches to their upstream variants (BZ 140532).
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm32.S
|
||||
@@ -0,0 +1,78 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2007 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program; if not, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+ .section ".text"
|
||||
+ .align 2
|
||||
+ .globl func0
|
||||
+ .type func0, @function
|
||||
+func0:
|
||||
+ stwu 1,-16(1)
|
||||
+ mflr 0
|
||||
+ stw 31,12(1)
|
||||
+ stw 0,20(1)
|
||||
+ mr 31,1
|
||||
+ bl abort
|
||||
+ .size func0, .-func0
|
||||
+ .align 2
|
||||
+ .globl func1
|
||||
+ .type func1, @function
|
||||
+func1:
|
||||
+ stwu 1,-16(1)
|
||||
+ mflr 0
|
||||
+/* 20 = BO = branch always
|
||||
+ 31 = BI = CR bit (ignored) */
|
||||
+ bcl 20,31,.Lpie
|
||||
+.Lpie: stw 31,12(1)
|
||||
+ stw 0,20(1)
|
||||
+ mr 31,1
|
||||
+ bl func0
|
||||
+ mr 0,3
|
||||
+ lis 9,var@ha
|
||||
+ lwz 9,var@l(9)
|
||||
+ add 0,0,9
|
||||
+ mr 3,0
|
||||
+ lwz 11,0(1)
|
||||
+ lwz 0,4(11)
|
||||
+ mtlr 0
|
||||
+ lwz 31,-4(11)
|
||||
+ mr 1,11
|
||||
+ blr
|
||||
+ .size func1, .-func1
|
||||
+ .section .note.GNU-stack,"",@progbits
|
||||
+ .ident "GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-8)"
|
||||
+
|
||||
+/* Original source file:
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+extern volatile int var;
|
||||
+
|
||||
+int func0 (void) __attribute__((__noinline__));
|
||||
+int func0 (void)
|
||||
+{
|
||||
+ abort ();
|
||||
+ return var;
|
||||
+}
|
||||
+
|
||||
+int func1 (void) __attribute__((__noinline__));
|
||||
+int func1 (void)
|
||||
+{
|
||||
+ return func0 () + var;
|
||||
+}
|
||||
+
|
||||
+*/
|
||||
diff --git a/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue-asm64.S
|
||||
@@ -0,0 +1,98 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2007 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program; if not, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+ .section ".toc","aw"
|
||||
+ .section ".text"
|
||||
+ .align 2
|
||||
+ .globl func0
|
||||
+ .section ".opd","aw"
|
||||
+ .align 3
|
||||
+func0:
|
||||
+ .quad .L.func0,.TOC.@tocbase
|
||||
+ .previous
|
||||
+ .type func0, @function
|
||||
+.L.func0:
|
||||
+ mflr 0
|
||||
+ std 31,-8(1)
|
||||
+ std 0,16(1)
|
||||
+ stdu 1,-128(1)
|
||||
+ mr 31,1
|
||||
+ bl abort
|
||||
+ nop
|
||||
+ .long 0
|
||||
+ .byte 0,0,0,1,128,1,0,1
|
||||
+ .size func0,.-.L.func0
|
||||
+ .section ".toc","aw"
|
||||
+.LC1:
|
||||
+ .tc var[TC],var
|
||||
+ .section ".text"
|
||||
+ .align 2
|
||||
+ .globl func1
|
||||
+ .section ".opd","aw"
|
||||
+ .align 3
|
||||
+func1:
|
||||
+ .quad .L.func1,.TOC.@tocbase
|
||||
+ .previous
|
||||
+ .type func1, @function
|
||||
+.L.func1:
|
||||
+ mflr 0
|
||||
+/* 20 = BO = branch always
|
||||
+ 31 = BI = CR bit (ignored) */
|
||||
+ bcl 20,31,.Lpie
|
||||
+.Lpie: std 31,-8(1)
|
||||
+ std 0,16(1)
|
||||
+ stdu 1,-128(1)
|
||||
+ mr 31,1
|
||||
+ bl func0
|
||||
+ mr 11,3
|
||||
+ ld 9,.LC1@toc(2)
|
||||
+ lwz 0,0(9)
|
||||
+ add 0,11,0
|
||||
+ extsw 0,0
|
||||
+ mr 3,0
|
||||
+ ld 1,0(1)
|
||||
+ ld 0,16(1)
|
||||
+ mtlr 0
|
||||
+ ld 31,-8(1)
|
||||
+ blr
|
||||
+ .long 0
|
||||
+ .byte 0,0,0,1,128,1,0,1
|
||||
+ .size func1,.-.L.func1
|
||||
+ .section .note.GNU-stack,"",@progbits
|
||||
+ .ident "GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-8)"
|
||||
+
|
||||
+/* Original source file:
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+extern volatile int var;
|
||||
+
|
||||
+int func0 (void) __attribute__((__noinline__));
|
||||
+int func0 (void)
|
||||
+{
|
||||
+ abort ();
|
||||
+ return var;
|
||||
+}
|
||||
+
|
||||
+int func1 (void) __attribute__((__noinline__));
|
||||
+int func1 (void)
|
||||
+{
|
||||
+ return func0 () + var;
|
||||
+}
|
||||
+
|
||||
+*/
|
||||
diff --git a/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.c
|
||||
@@ -0,0 +1,29 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2007 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program; if not, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+/* Force `-fpie' double jump bl->blrl. */
|
||||
+/* No longer used. */
|
||||
+volatile int var;
|
||||
+
|
||||
+extern int func1 (void);
|
||||
+
|
||||
+int main (void)
|
||||
+{
|
||||
+ func1 ();
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/powerpc-bcl-prologue.exp
|
||||
@@ -0,0 +1,72 @@
|
||||
+# Copyright 2006, 2007 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+# Test unwinding fixes of the PPC platform, specifically on the coping with BCL
|
||||
+# jump of the PIE code.
|
||||
+
|
||||
+if ![istarget "powerpc*-*-linux*"] then {
|
||||
+ verbose "Skipping powerpc-linux prologue tests."
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set testfile "powerpc-bcl-prologue"
|
||||
+set srcfile1 ${testfile}.c
|
||||
+set flags "debug"
|
||||
+if [istarget "powerpc-*"] then {
|
||||
+ set srcfile2 ${testfile}-asm32.S
|
||||
+ set flags "$flags additional_flags=-m32"
|
||||
+} elseif [istarget "powerpc64-*"] then {
|
||||
+ set srcfile2 ${testfile}-asm64.S
|
||||
+ set flags "$flags additional_flags=-m64"
|
||||
+} else {
|
||||
+ fail "powerpc arch test"
|
||||
+ return
|
||||
+}
|
||||
+set objfile2 [standard_output_file ${testfile}-asm.o]
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile1} ${srcdir}/${subdir}/${srcfile2}" ${binfile} executable $flags] != ""} {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+# We should stop in abort(3).
|
||||
+
|
||||
+gdb_run_cmd
|
||||
+
|
||||
+gdb_test_multiple {} "continue to abort()" {
|
||||
+ -re ".*Program received signal SIGABRT,.*$gdb_prompt $" {
|
||||
+ pass "continue to abort()"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Check backtrace:
|
||||
+# #3 0x0804835f in func0 ()
|
||||
+# #4 0x0804836a in func1 ()
|
||||
+# #5 0x0804838c in main ()
|
||||
+# (gdb)
|
||||
+# `\\.?' prefixes are needed for ppc64 without `debug' (another bug).
|
||||
+
|
||||
+set test "matching unwind"
|
||||
+gdb_test_multiple "backtrace" $test {
|
||||
+ -re "\r\n#\[0-9\]\[^\r\n\]* in \\.?func0 \\(\[^\r\n\]*\r\n#\[0-9\]\[^\r\n\]* in \\.?func1 \\(\[^\r\n\]*\r\n#\[0-9\]\[^\r\n\]* in \\.?main \\(\[^\r\n\]*\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue.exp b/gdb/testsuite/gdb.arch/powerpc-prologue.exp
|
||||
--- a/gdb/testsuite/gdb.arch/powerpc-prologue.exp
|
||||
+++ b/gdb/testsuite/gdb.arch/powerpc-prologue.exp
|
||||
@@ -16,8 +16,9 @@
|
||||
# Test PowerPC prologue analyzer.
|
||||
|
||||
# Do not run on AIX (where we won't be able to build the tests without
|
||||
-# some surgery) or on PowerPC64 (ditto, dot symbols).
|
||||
-if {[istarget *-*-aix*] || ![istarget "powerpc-*-*"]} then {
|
||||
+# some surgery). PowerPC64 target would break due to dot symbols but we build
|
||||
+# there PowerPC32 inferior.
|
||||
+if {[istarget *-*-aix*] || ![istarget "powerpc*-*-*"]} then {
|
||||
verbose "Skipping PowerPC prologue tests."
|
||||
return
|
||||
}
|
109
gdb-6.3-bz202689-exec-from-pthread-test.patch
Normal file
109
gdb-6.3-bz202689-exec-from-pthread-test.patch
Normal file
@ -0,0 +1,109 @@
|
||||
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.3-bz202689-exec-from-pthread-test.patch
|
||||
|
||||
;; Testcase for exec() from threaded program (BZ 202689).
|
||||
;;=fedoratest
|
||||
|
||||
2007-01-17 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* 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 <stddef.h>
|
||||
+#include <pthread.h>
|
||||
+#include <assert.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+
|
||||
+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"
|
||||
+ }
|
||||
+}
|
53
gdb-6.3-focus-cmd-prev-test.patch
Normal file
53
gdb-6.3-focus-cmd-prev-test.patch
Normal file
@ -0,0 +1,53 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-focus-cmd-prev-test.patch
|
||||
|
||||
;; Test a crash on `focus cmd', `focus prev' commands.
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/focus-cmd-prev.exp b/gdb/testsuite/gdb.base/focus-cmd-prev.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/focus-cmd-prev.exp
|
||||
@@ -0,0 +1,40 @@
|
||||
+# Copyright 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+if $tracelevel then {
|
||||
+ strace $tracelevel
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+
|
||||
+# Do not use gdb_test or \r\n there since:
|
||||
+# commit d7e747318f4d04af033f16325f9b6d74f67079ec
|
||||
+# Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy
|
||||
+
|
||||
+set test "focus cmd"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+set test "focus prev"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re "$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
258
gdb-6.3-gstack-20050411.patch
Normal file
258
gdb-6.3-gstack-20050411.patch
Normal file
@ -0,0 +1,258 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Cagney <cagney@gnu.org>
|
||||
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 <cagney@redhat.com>
|
||||
|
||||
* 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
|
||||
@@ -1753,7 +1753,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force
|
||||
install: all
|
||||
@$(MAKE) $(FLAGS_TO_PASS) install-only
|
||||
|
||||
-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 \
|
||||
@@ -1802,7 +1802,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 \
|
||||
@@ -1825,6 +1843,18 @@ uninstall: force $(CONFIG_UNINSTALL)
|
||||
fi
|
||||
@$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
|
||||
|
||||
+.PHONY: uninstall-gstack
|
||||
+uninstall-gstack:
|
||||
+ transformed_name=`t='$(program_transform_name)'; \
|
||||
+ echo $(GSTACK) | sed -e $$t` ; \
|
||||
+ if test "x$$transformed_name" = x; then \
|
||||
+ transformed_name=$(GSTACK) ; \
|
||||
+ else \
|
||||
+ true ; \
|
||||
+ fi ; \
|
||||
+ rm -f $(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) \
|
||||
+ $(DESTDIR)$(man1dir)/$$transformed_name.1
|
||||
+
|
||||
# The C++ name parser can be built standalone for testing.
|
||||
test-cp-name-parser.o: cp-name-parser.c
|
||||
$(COMPILE) -DTEST_CPNAMES cp-name-parser.c
|
||||
diff --git a/gdb/gstack.sh b/gdb/gstack.sh
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/gstack.sh
|
||||
@@ -0,0 +1,43 @@
|
||||
+#!/bin/sh
|
||||
+
|
||||
+if test $# -ne 1; then
|
||||
+ echo "Usage: `basename $0 .sh` <process-id>" 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 <<EOF 2>&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 <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+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 <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+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
|
160
gdb-6.3-inheritancetest-20050726.patch
Normal file
160
gdb-6.3-inheritancetest-20050726.patch
Normal file
@ -0,0 +1,160 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jeff Johnston <jjohnstn@redhat.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-inheritancetest-20050726.patch
|
||||
|
||||
;; Verify printing of inherited members test
|
||||
;;=fedoratest
|
||||
|
||||
2005-07-26 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* gdb.cp/b146835.exp: New testcase.
|
||||
* gdb.cp/b146835.cc: Ditto.
|
||||
* gdb.cp/b146835b.cc: Ditto.
|
||||
* gdb.cp/b146835.h: Ditto.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.cp/b146835.cc b/gdb/testsuite/gdb.cp/b146835.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/b146835.cc
|
||||
@@ -0,0 +1,31 @@
|
||||
+#include "b146835.h"
|
||||
+#include <iostream>
|
||||
+
|
||||
+class F : public C {
|
||||
+
|
||||
+protected:
|
||||
+
|
||||
+ virtual void funcA (unsigned long a, B *b);
|
||||
+ virtual void funcB (E *e);
|
||||
+ virtual void funcC (unsigned long x, bool y);
|
||||
+
|
||||
+ char *s1, *s2;
|
||||
+ bool b1;
|
||||
+ int k;
|
||||
+
|
||||
+public:
|
||||
+ void foo() {
|
||||
+ std::cout << "foo" << std::endl;
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+
|
||||
+void F::funcA (unsigned long a, B *b) {}
|
||||
+void F::funcB (E *e) {}
|
||||
+void F::funcC (unsigned long x, bool y) {}
|
||||
+
|
||||
+int main()
|
||||
+{
|
||||
+ F f;
|
||||
+ f.foo();
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.cp/b146835.exp b/gdb/testsuite/gdb.cp/b146835.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/b146835.exp
|
||||
@@ -0,0 +1,47 @@
|
||||
+# This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+# Copyright 2005 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+# Check that GDB can properly print an inherited member variable
|
||||
+# (Bugzilla 146835)
|
||||
+
|
||||
+set testfile "b146835"
|
||||
+set srcfile ${testfile}.cc
|
||||
+set srcfile2 ${testfile}b.cc
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}" "${binfile}" executable {debug c++}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+#
|
||||
+# Run to `main' where we begin our tests.
|
||||
+#
|
||||
+
|
||||
+if ![runto_main] then {
|
||||
+ gdb_suppress_tests
|
||||
+}
|
||||
+
|
||||
+gdb_test "break 'F::foo()'" ""
|
||||
+gdb_continue_to_breakpoint "First line foo"
|
||||
+
|
||||
+# Verify that we can access the inherited member d
|
||||
+gdb_test "p d" " = \\(D \\*\\) *0x0" "Verify inherited member d accessible"
|
||||
diff --git a/gdb/testsuite/gdb.cp/b146835.h b/gdb/testsuite/gdb.cp/b146835.h
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/b146835.h
|
||||
@@ -0,0 +1,36 @@
|
||||
+
|
||||
+class A {
|
||||
+
|
||||
+protected:
|
||||
+
|
||||
+ virtual void funcA (unsigned long a, class B *b) = 0;
|
||||
+ virtual void funcB (class E *e) = 0;
|
||||
+ virtual void funcC (unsigned long x, bool y) = 0;
|
||||
+
|
||||
+ void funcD (class E *e, class D* d);
|
||||
+ virtual void funcE (E *e, D *d);
|
||||
+ virtual void funcF (unsigned long x, D *d);
|
||||
+};
|
||||
+
|
||||
+
|
||||
+class C : public A {
|
||||
+
|
||||
+protected:
|
||||
+
|
||||
+ int x;
|
||||
+ class K *k;
|
||||
+ class H *h;
|
||||
+
|
||||
+ D *d;
|
||||
+
|
||||
+ class W *w;
|
||||
+ class N *n;
|
||||
+ class L *l;
|
||||
+ unsigned long *r;
|
||||
+
|
||||
+public:
|
||||
+
|
||||
+ C();
|
||||
+ int z (char *s);
|
||||
+ virtual ~C();
|
||||
+};
|
||||
diff --git a/gdb/testsuite/gdb.cp/b146835b.cc b/gdb/testsuite/gdb.cp/b146835b.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/b146835b.cc
|
||||
@@ -0,0 +1,11 @@
|
||||
+#include "b146835.h"
|
||||
+
|
||||
+C::C() { d = 0; x = 3; }
|
||||
+
|
||||
+int C::z (char *s) { return 0; }
|
||||
+
|
||||
+C::~C() {}
|
||||
+
|
||||
+void A::funcD (class E *e, class D *d) {}
|
||||
+void A::funcE (E *e, D *d) {}
|
||||
+void A::funcF (unsigned long x, D *d) {}
|
247
gdb-6.3-mapping-zero-inode-test.patch
Normal file
247
gdb-6.3-mapping-zero-inode-test.patch
Normal file
@ -0,0 +1,247 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
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 <sys/ipc.h>
|
||||
+#include <sys/shm.h>
|
||||
+#include <stdio.h>
|
||||
+#include <errno.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <unistd.h>
|
||||
+#include <assert.h>
|
||||
+#include <time.h>
|
||||
+
|
||||
+/* 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
|
||||
+ }
|
||||
+}
|
38
gdb-6.3-rh-testversion-20041202.patch
Normal file
38
gdb-6.3-rh-testversion-20041202.patch
Normal file
@ -0,0 +1,38 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Elena Zannoni <ezannoni@redhat.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-rh-testversion-20041202.patch
|
||||
|
||||
;; Match the Fedora's version info.
|
||||
;;=fedora
|
||||
|
||||
2003-02-24 Elena Zannoni <ezannoni@redhat.com>
|
||||
|
||||
* gdb.gdb/selftest.exp: Add matching on specific Red Hat only version
|
||||
string.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
|
||||
--- a/gdb/testsuite/gdb.gdb/selftest.exp
|
||||
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
|
||||
@@ -53,6 +53,9 @@ proc test_with_self { } {
|
||||
-re ".\[0-9\]+ = +.+ +0x.*\[0-9.\]+.*$gdb_prompt $" {
|
||||
pass "printed version with cast"
|
||||
}
|
||||
+ -re ".\[0-9\]+ = .(Fedora|Red Hat Enterprise Linux) \[\\(\\)0-9.a-z\\-\]+.*$gdb_prompt $" {
|
||||
+ pass "printed version Fedora or Red Hat Enterprise Linux only"
|
||||
+ }
|
||||
}
|
||||
|
||||
# start the "xgdb" process
|
||||
diff --git a/gdb/top.c b/gdb/top.c
|
||||
--- a/gdb/top.c
|
||||
+++ b/gdb/top.c
|
||||
@@ -2195,7 +2195,7 @@ init_gdb_version_vars (void)
|
||||
struct internalvar *major_version_var = create_internalvar ("_gdb_major");
|
||||
struct internalvar *minor_version_var = create_internalvar ("_gdb_minor");
|
||||
int vmajor = 0, vminor = 0, vrevision = 0;
|
||||
- sscanf (version, "%d.%d.%d", &vmajor, &vminor, &vrevision);
|
||||
+ sscanf (version, "Fedora %d.%d.%d", &vmajor, &vminor, &vrevision);
|
||||
set_internalvar_integer (major_version_var, vmajor);
|
||||
set_internalvar_integer (minor_version_var, vminor + (vrevision > 0));
|
||||
}
|
247
gdb-6.3-test-dtorfix-20050121.patch
Normal file
247
gdb-6.3-test-dtorfix-20050121.patch
Normal file
@ -0,0 +1,247 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-test-dtorfix-20050121.patch
|
||||
|
||||
;; Test support of multiple destructors just like multiple constructors
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.cp/constructortest.cc b/gdb/testsuite/gdb.cp/constructortest.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/constructortest.cc
|
||||
@@ -0,0 +1,99 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2005 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program; if not, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
+ Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+class A
|
||||
+{
|
||||
+ public:
|
||||
+ A();
|
||||
+ ~A();
|
||||
+ int k;
|
||||
+ private:
|
||||
+ int x;
|
||||
+};
|
||||
+
|
||||
+class B: public A
|
||||
+{
|
||||
+ public:
|
||||
+ B();
|
||||
+ private:
|
||||
+ int y;
|
||||
+};
|
||||
+
|
||||
+/* C and D are for the $delete destructor. */
|
||||
+
|
||||
+class C
|
||||
+{
|
||||
+ public:
|
||||
+ C();
|
||||
+ virtual ~C();
|
||||
+ private:
|
||||
+ int x;
|
||||
+};
|
||||
+
|
||||
+class D: public C
|
||||
+{
|
||||
+ public:
|
||||
+ D();
|
||||
+ private:
|
||||
+ int y;
|
||||
+};
|
||||
+
|
||||
+int main(int argc, char *argv[])
|
||||
+{
|
||||
+ A* a = new A;
|
||||
+ B* b = new B;
|
||||
+ D* d = new D;
|
||||
+ delete a;
|
||||
+ delete b;
|
||||
+ delete d;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+A::A() /* Constructor A */
|
||||
+{
|
||||
+ x = 1; /* First line A */
|
||||
+ k = 4; /* Second line A */
|
||||
+}
|
||||
+
|
||||
+A::~A() /* Destructor A */
|
||||
+{
|
||||
+ x = 3; /* First line ~A */
|
||||
+ k = 6; /* Second line ~A */
|
||||
+}
|
||||
+
|
||||
+B::B()
|
||||
+{
|
||||
+ y = 2; /* First line B */
|
||||
+ k = 5;
|
||||
+}
|
||||
+
|
||||
+C::C() /* Constructor C */
|
||||
+{
|
||||
+ x = 1; /* First line C */
|
||||
+}
|
||||
+
|
||||
+C::~C() /* Destructor C */
|
||||
+{
|
||||
+ x = 3; /* First line ~C */
|
||||
+}
|
||||
+
|
||||
+D::D()
|
||||
+{
|
||||
+ y = 2; /* First line D */
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.cp/constructortest.exp b/gdb/testsuite/gdb.cp/constructortest.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/constructortest.exp
|
||||
@@ -0,0 +1,130 @@
|
||||
+# This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+# Copyright 2005, 2007 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+# Check that GDB can break at multiple forms of constructors.
|
||||
+
|
||||
+set testfile "constructortest"
|
||||
+set srcfile ${testfile}.cc
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+# PIE is required for testing proper BREAKPOINT_RE_SET of the multiple-PC
|
||||
+# breakpoints.
|
||||
+if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++ "additional_flags=-fpie -pie"}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+#
|
||||
+# Run to `main' where we begin our tests.
|
||||
+#
|
||||
+
|
||||
+if ![runto_main] then {
|
||||
+ gdb_suppress_tests
|
||||
+}
|
||||
+
|
||||
+# Break on the various forms of the A::A constructor.
|
||||
+# " (2 locations)" is displayed depending on G++ version.
|
||||
+gdb_test "break A\:\:A" "Breakpoint 2 at .*" "breaking on A::A"
|
||||
+
|
||||
+# Verify that we break for the A constructor two times
|
||||
+# Once for new A and once for new B
|
||||
+gdb_continue_to_breakpoint "First line A"
|
||||
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A"
|
||||
+gdb_continue_to_breakpoint "First line A"
|
||||
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::A"
|
||||
+
|
||||
+# Now do the same for destructors
|
||||
+gdb_test "break 'A::~A()'" ""
|
||||
+
|
||||
+# Verify that we break for the A destructor two times
|
||||
+# Once for delete a and once for delete b
|
||||
+gdb_continue_to_breakpoint "First line ~A"
|
||||
+gdb_test "bt" "#0.*~A.*#1.*main.*" "Verify in in-charge A::~A"
|
||||
+gdb_continue_to_breakpoint "First line ~A"
|
||||
+gdb_test "bt" "#0.*~A.*#1.*~B.*#2.*main.*" "Verify in not-in-charge A::~A"
|
||||
+
|
||||
+
|
||||
+# Verify that we can break by line number in a constructor and find
|
||||
+# both occurrences
|
||||
+runto_main
|
||||
+gdb_test "break 'A::A()'" "" "break in constructor A 2"
|
||||
+gdb_continue_to_breakpoint "First line A"
|
||||
+set second_line [gdb_get_line_number "Second line A"]
|
||||
+# " (2 locations)" is displayed depending on G++ version.
|
||||
+gdb_test "break $second_line" "Breakpoint .*, line $second_line\\..*" "break by line in constructor"
|
||||
+gdb_continue_to_breakpoint "Second line A"
|
||||
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::A second line"
|
||||
+gdb_continue_to_breakpoint "Second line A"
|
||||
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::A second line"
|
||||
+
|
||||
+# Verify that we can break by line number in a destructor and find
|
||||
+# both occurrences
|
||||
+gdb_test "break 'A::~A()'" "" "break in constructor ~A 2"
|
||||
+gdb_continue_to_breakpoint "First line ~A"
|
||||
+set second_line_dtor [gdb_get_line_number "Second line ~A"]
|
||||
+# " (2 locations)" is displayed depending on G++ version.
|
||||
+gdb_test "break $second_line_dtor" "Breakpoint .*, line $second_line_dtor\\..*" "break by line in destructor"
|
||||
+gdb_continue_to_breakpoint "Second line ~A"
|
||||
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in in-charge A::~A second line"
|
||||
+# FIXME: Analyse this case better.
|
||||
+gdb_continue_to_breakpoint "Second line ~A"
|
||||
+gdb_test "bt" "#0.*A.*#1.*main.*" "Verify in A::~A second line #2"
|
||||
+gdb_continue_to_breakpoint "Second line ~A"
|
||||
+gdb_test "bt" "#0.*A.*#1.*B.*#2.*main.*" "Verify in not-in-charge A::~A second line"
|
||||
+
|
||||
+
|
||||
+# Test now the $delete destructors.
|
||||
+
|
||||
+gdb_load ${binfile}
|
||||
+runto_main
|
||||
+
|
||||
+set first_line_dtor [gdb_get_line_number "First line ~C"]
|
||||
+set define_line_dtor [gdb_get_line_number "Destructor C"]
|
||||
+# Break on the various forms of the C::~C destructor
|
||||
+# " ([23] locations)" is displayed depending on G++ version.
|
||||
+gdb_test "break C\:\:~C" "Breakpoint .*: C::~C\\. \\(2 locations\\)" "breaking on C::~C"
|
||||
+gdb_continue_to_breakpoint "First line ~C"
|
||||
+
|
||||
+# Verify that we can break by line number in a destructor and find
|
||||
+# the $delete occurence
|
||||
+
|
||||
+gdb_load ${binfile}
|
||||
+delete_breakpoints
|
||||
+
|
||||
+# " (3 locations)" is displayed depending on G++ version.
|
||||
+gdb_test "break $first_line_dtor" "Breakpoint .*, line $first_line_dtor\\..*" "break by line in destructor"
|
||||
+
|
||||
+# Run to `main' where we begin our tests.
|
||||
+# Set the breakpoints first to test PIE multiple-PC BREAKPOINT_RE_SET.
|
||||
+# RUNTO_MAIN or RUNTO MAIN are not usable here as it runs DELETE_BREAKPOINTS.
|
||||
+
|
||||
+if ![gdb_breakpoint main] {
|
||||
+ gdb_suppress_tests
|
||||
+}
|
||||
+gdb_run_cmd
|
||||
+set test "running to main"
|
||||
+gdb_test_multiple "" $test {
|
||||
+ -re "Breakpoint \[0-9\]*, main .*$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_continue_to_breakpoint "First line ~C"
|
101
gdb-6.3-test-movedir-20050125.patch
Normal file
101
gdb-6.3-test-movedir-20050125.patch
Normal file
@ -0,0 +1,101 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Elena Zannoni <ezannoni@redhat.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-test-movedir-20050125.patch
|
||||
|
||||
;; Fix to support executable moving
|
||||
;;=fedoratest
|
||||
|
||||
2005-01-25 Elena Zannoni <ezannoni@redhat.com>
|
||||
|
||||
* gdb.base/move-dir.exp: New test.
|
||||
* gdb.base/move-dir.c: Ditto.
|
||||
* gdb.base/move-dir.h: Ditto.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/move-dir.c b/gdb/testsuite/gdb.base/move-dir.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/move-dir.c
|
||||
@@ -0,0 +1,9 @@
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include "move-dir.h"
|
||||
+
|
||||
+int main() {
|
||||
+ const char* hw = "hello world.";
|
||||
+ printf ("%s\n", hw);;
|
||||
+ other();
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/move-dir.exp b/gdb/testsuite/gdb.base/move-dir.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/move-dir.exp
|
||||
@@ -0,0 +1,57 @@
|
||||
+# Copyright 2005
|
||||
+# Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+set testfile "move-dir"
|
||||
+set srcfile ${testfile}.c
|
||||
+set incfile ${testfile}.h
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+set testdir [standard_output_file incdir]
|
||||
+
|
||||
+remote_exec build "mkdir $testdir"
|
||||
+remote_exec build "cp ${srcdir}/${subdir}/${srcfile} [standard_output_file ${srcfile}]"
|
||||
+remote_exec build "cp ${srcdir}/${subdir}/${incfile} [standard_output_file ${incfile}]"
|
||||
+
|
||||
+set additional_flags "additional_flags=-I${subdir}/incdir"
|
||||
+
|
||||
+if { [gdb_compile [standard_output_file ${srcfile}] "${binfile}" executable [list debug $additional_flags]] != "" } {
|
||||
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||
+}
|
||||
+
|
||||
+# Create and source the file that provides information about the compiler
|
||||
+# used to compile the test case.
|
||||
+
|
||||
+if [get_compiler_info ${binfile}] {
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+set oldtimeout $timeout
|
||||
+set timeout [expr "$timeout + 60"]
|
||||
+
|
||||
+# Start with a fresh gdb.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_test "cd ../.." "" ""
|
||||
+gdb_load ${binfile}
|
||||
+gdb_test "list main" ".*hw.*other.*" "found main"
|
||||
+gdb_test "list other" ".*ostring.*" "found include file"
|
||||
+
|
||||
+
|
||||
+set timeout $oldtimeout
|
||||
+return 0
|
||||
diff --git a/gdb/testsuite/gdb.base/move-dir.h b/gdb/testsuite/gdb.base/move-dir.h
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/move-dir.h
|
||||
@@ -0,0 +1,6 @@
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+void other() {
|
||||
+ const char* ostring = "other";
|
||||
+ printf ("%s\n", ostring);;
|
||||
+}
|
253
gdb-6.3-threaded-watchpoints2-20050225.patch
Normal file
253
gdb-6.3-threaded-watchpoints2-20050225.patch
Normal file
@ -0,0 +1,253 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Jeff Johnston <jjohnstn@redhat.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-threaded-watchpoints2-20050225.patch
|
||||
|
||||
;; Test sibling threads to set threaded watchpoints for x86 and x86-64
|
||||
;;=fedoratest
|
||||
|
||||
2005-02-28 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* config/i386/nm-linux.h: Change dr register routines to
|
||||
accept a ptid_t first argument. Change all calling macros
|
||||
to default the inferior_ptid for the first argument.
|
||||
(i386_linux_insert_watchpoint): New prototype.
|
||||
(i386_linux_remove_watchpoint, i386_linux_insert_hw_breakpoint): Ditto.
|
||||
(i386_linux_remove_hw_breakpoint): Ditto.
|
||||
(target_insert_watchpoint, target_remove_watchpoint): Undef and
|
||||
override.
|
||||
(target_insert_hw_breakpoint, target_remove_hw_breakpoint): Ditto.
|
||||
* config/i386/nm-linux64.h: Ditto except add amd64 versions of
|
||||
the watchpoint/hw-breakpoint insert/remove routines.
|
||||
* i386-nat.c: Include "inferior.h" to define inferior_ptid.
|
||||
* i386-linux-nat.c: Change all dr get/set routines to accept
|
||||
ptid_t as first argument and to use this argument to determine
|
||||
the tid for PTRACE.
|
||||
(i386_linux_set_debug_regs_for_thread): New function.
|
||||
(i386_linux_sync_debug_registers_callback): Ditto.
|
||||
(i386_linux_sync_debug_registers_across_threads): Ditto.
|
||||
(i386_linux_insert_watchpoint, i386_linux_remove_watchpoint): Ditto.
|
||||
(i386_linux_hw_breakpoint, i386_linux_remove_hw_breakpoint): Ditto.
|
||||
(i386_linux_new_thread): Ditto.
|
||||
(_initialize_i386_linux_nat): Ditto.
|
||||
* amd64-linux-nat.c: Change all dr get/set routines to accept
|
||||
ptid_t as first argument and to use this argument to determine
|
||||
the tid for PTRACE.
|
||||
(amd64_linux_set_debug_regs_for_thread): New function.
|
||||
(amd64_linux_sync_debug_registers_callback): Ditto.
|
||||
(amd64_linux_sync_debug_registers_across_threads): Ditto.
|
||||
(amd64_linux_insert_watchpoint, amd64_linux_remove_watchpoint): Ditto.
|
||||
(amd64_linux_hw_breakpoint, amd64_linux_remove_hw_breakpoint): Ditto.
|
||||
(amd64_linux_new_thread): Ditto.
|
||||
(_initialize_amd64_linux_nat): Register linux new thread observer.
|
||||
* testsuite/gdb.threads/watchthreads-threaded.c: New test case.
|
||||
* testsuite/gdb.threads/watchthreads-threaded.exp: Ditto.
|
||||
|
||||
[ With recent upstream GDB (6.8) reduced only to the testcase. ]
|
||||
|
||||
[ It was called watchthreads2.{exp,c} before but it conflicted with FSF GDB new
|
||||
testcase of the same name. ]
|
||||
|
||||
FIXME: The testcase does not expects multiple watchpoints hits per one stop.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/watchthreads-threaded.c b/gdb/testsuite/gdb.threads/watchthreads-threaded.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/watchthreads-threaded.c
|
||||
@@ -0,0 +1,65 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program; if not, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
+ Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+ This file is copied from schedlock.c. */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <pthread.h>
|
||||
+
|
||||
+void *thread_function(void *arg); /* Pointer to function executed by each thread */
|
||||
+
|
||||
+#define NUM 5
|
||||
+
|
||||
+unsigned int args[NUM+1];
|
||||
+
|
||||
+int main() {
|
||||
+ int res;
|
||||
+ pthread_t threads[NUM];
|
||||
+ void *thread_result;
|
||||
+ long i;
|
||||
+
|
||||
+ for (i = 0; i < NUM; i++)
|
||||
+ {
|
||||
+ args[i] = 1; /* Init value. */
|
||||
+ res = pthread_create(&threads[i],
|
||||
+ NULL,
|
||||
+ thread_function,
|
||||
+ (void *) i);
|
||||
+ }
|
||||
+
|
||||
+ args[i] = 1;
|
||||
+ thread_function ((void *) i);
|
||||
+
|
||||
+ exit(EXIT_SUCCESS);
|
||||
+}
|
||||
+
|
||||
+void *thread_function(void *arg) {
|
||||
+ int my_number = (long) arg;
|
||||
+ int *myp = (int *) &args[my_number];
|
||||
+
|
||||
+ /* Don't run forever. Run just short of it :) */
|
||||
+ while (*myp > 0)
|
||||
+ {
|
||||
+ (*myp) ++; usleep (1); /* Loop increment. */
|
||||
+ }
|
||||
+
|
||||
+ pthread_exit(NULL);
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.threads/watchthreads-threaded.exp b/gdb/testsuite/gdb.threads/watchthreads-threaded.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/watchthreads-threaded.exp
|
||||
@@ -0,0 +1,126 @@
|
||||
+# This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+# Copyright 2005 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+# Check that GDB can support multiple watchpoints across threads.
|
||||
+
|
||||
+# This test verifies that a watchpoint is detected in the proper thread
|
||||
+# so the test is only meaningful on a system with hardware watchpoints.
|
||||
+if [target_info exists gdb,no_hardware_watchpoints] {
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+set testfile "watchthreads-threaded"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+gdb_test "set can-use-hw-watchpoints 1" "" ""
|
||||
+
|
||||
+#
|
||||
+# Run to `main' where we begin our tests.
|
||||
+#
|
||||
+
|
||||
+if ![runto_main] then {
|
||||
+ gdb_suppress_tests
|
||||
+}
|
||||
+
|
||||
+set args_2 0
|
||||
+set args_3 0
|
||||
+
|
||||
+gdb_breakpoint "thread_function"
|
||||
+gdb_continue_to_breakpoint "thread_function"
|
||||
+gdb_test "disable 2" ""
|
||||
+
|
||||
+gdb_test_multiple "p args\[2\]" "get initial args2" {
|
||||
+ -re "\\\$\[0-9\]* = (.*)$gdb_prompt $" {
|
||||
+ set init_args_2 $expect_out(1,string)
|
||||
+ pass "get initial args2"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_test_multiple "p args\[3\]" "get initial args3" {
|
||||
+ -re "\\\$\[0-9\]* = (.*)$gdb_prompt $" {
|
||||
+ set init_args_3 $expect_out(1,string)
|
||||
+ pass "get initial args3"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+set args_2 $init_args_2
|
||||
+set args_3 $init_args_3
|
||||
+
|
||||
+# Watch values that will be modified by distinct threads.
|
||||
+gdb_test "watch args\[2\]" "Hardware watchpoint 3: args\\\[2\\\]"
|
||||
+gdb_test "watch args\[3\]" "Hardware watchpoint 4: args\\\[3\\\]"
|
||||
+
|
||||
+set init_line [expr [gdb_get_line_number "Init value"]+1]
|
||||
+set inc_line [gdb_get_line_number "Loop increment"]
|
||||
+
|
||||
+# Loop and continue to allow both watchpoints to be triggered.
|
||||
+for {set i 0} {$i < 30} {incr i} {
|
||||
+ set test_flag 0
|
||||
+ gdb_test_multiple "continue" "threaded watch loop" {
|
||||
+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads-threaded.c:$init_line.*$gdb_prompt $"
|
||||
+ { set args_2 1; set test_flag 1 }
|
||||
+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*watchthreads-threaded.c:$init_line.*$gdb_prompt $"
|
||||
+ { set args_3 1; set test_flag 1 }
|
||||
+ -re "Hardware watchpoint 3: args\\\[2\\\].*Old value = $args_2.*New value = [expr $args_2+1].*thread_function \\\(arg=0x2\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $"
|
||||
+ { set args_2 [expr $args_2+1]; set test_flag 1 }
|
||||
+ -re "Hardware watchpoint 4: args\\\[3\\\].*Old value = $args_3.*New value = [expr $args_3+1].*thread_function \\\(arg=0x3\\\) at .*watchthreads-threaded.c:$inc_line.*$gdb_prompt $"
|
||||
+ { set args_3 [expr $args_3+1]; set test_flag 1 }
|
||||
+ }
|
||||
+ # If we fail above, don't bother continuing loop
|
||||
+ if { $test_flag == 0 } {
|
||||
+ set i 30;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Print success message if loop succeeded.
|
||||
+if { $test_flag == 1 } {
|
||||
+ pass "threaded watch loop"
|
||||
+}
|
||||
+
|
||||
+# Verify that we hit first watchpoint in child thread.
|
||||
+set message "watchpoint on args\[2\] hit in thread"
|
||||
+if { $args_2 > 1 } {
|
||||
+ pass $message
|
||||
+} else {
|
||||
+ fail $message
|
||||
+}
|
||||
+
|
||||
+# Verify that we hit second watchpoint in child thread.
|
||||
+set message "watchpoint on args\[3\] hit in thread"
|
||||
+if { $args_3 > 1 } {
|
||||
+ pass $message
|
||||
+} else {
|
||||
+ fail $message
|
||||
+}
|
||||
+
|
||||
+# Verify that all watchpoint hits are accounted for.
|
||||
+set message "combination of threaded watchpoints = 30 + initial values"
|
||||
+if { [expr $args_2+$args_3] == [expr [expr 30+$init_args_2]+$init_args_3] } {
|
||||
+ pass $message
|
||||
+} else {
|
||||
+ fail $message
|
||||
+}
|
938
gdb-6.5-BEA-testsuite.patch
Normal file
938
gdb-6.5-BEA-testsuite.patch
Normal file
@ -0,0 +1,938 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.5-BEA-testsuite.patch
|
||||
|
||||
;; Improved testsuite results by the testsuite provided by the courtesy of BEA.
|
||||
;;=fedoratest: For upstream it should be rewritten as a dejagnu test, the test of no "??" was useful.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/threadcrash.c b/gdb/testsuite/gdb.threads/threadcrash.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/threadcrash.c
|
||||
@@ -0,0 +1,301 @@
|
||||
+/*
|
||||
+ * The point of this program is to crash in a multi-threaded app.
|
||||
+ * There are seven threads, doing the following things:
|
||||
+ * * Spinning
|
||||
+ * * Spinning inside a signal handler
|
||||
+ * * Spinning inside a signal handler executing on the altstack
|
||||
+ * * In a syscall
|
||||
+ * * In a syscall inside a signal handler
|
||||
+ * * In a syscall inside a signal handler executing on the altstack
|
||||
+ * * Finally, the main thread crashes in main, with no frills.
|
||||
+ *
|
||||
+ * These are the things threads in JRockit tend to be doing. If gdb
|
||||
+ * can handle those things, both in core files and during live
|
||||
+ * debugging, that will help (at least) JRockit development.
|
||||
+ *
|
||||
+ * Let the program create a core file, then load the core file into
|
||||
+ * gdb. Inside gdb, you should be able to do something like this:
|
||||
+ *
|
||||
+ * (gdb) t a a bt
|
||||
+ *
|
||||
+ * Thread 7 (process 4352):
|
||||
+ * #0 0x001ba7dc in __nanosleep_nocancel () from /lib/tls/libc.so.6
|
||||
+ * #1 0x001ba5ff in sleep () from /lib/tls/libc.so.6
|
||||
+ * #2 0x080488a2 in makeSyscall (ignored=0x0) at threadcrash.c:118
|
||||
+ * #3 0x006aadec in start_thread () from /lib/tls/libpthread.so.0
|
||||
+ * #4 0x001ed19a in clone () from /lib/tls/libc.so.6
|
||||
+ *
|
||||
+ * Thread 6 (process 4353):
|
||||
+ * #0 0x001ba7dc in __nanosleep_nocancel () from /lib/tls/libc.so.6
|
||||
+ * #1 0x001ba5ff in sleep () from /lib/tls/libc.so.6
|
||||
+ * #2 0x0804898f in syscallingSighandler (signo=10, info=0xb6be76f0, context=0xb6be7770)
|
||||
+ * at threadcrash.c:168
|
||||
+ * #3 <signal handler called>
|
||||
+ * #4 0x006adf5e in pthread_kill () from /lib/tls/libpthread.so.0
|
||||
+ * #5 0x08048a51 in makeSyscallFromSighandler (ignored=0x0) at threadcrash.c:204
|
||||
+ * #6 0x006aadec in start_thread () from /lib/tls/libpthread.so.0
|
||||
+ * #7 0x001ed19a in clone () from /lib/tls/libc.so.6
|
||||
+ *
|
||||
+ * Thread 5 (process 4354):
|
||||
+ * #0 0x001ba7dc in __nanosleep_nocancel () from /lib/tls/libc.so.6
|
||||
+ * #1 0x001ba5ff in sleep () from /lib/tls/libc.so.6
|
||||
+ * #2 0x08048936 in syscallingAltSighandler (signo=3, info=0x959cd70, context=0x959cdf0)
|
||||
+ * at threadcrash.c:144
|
||||
+ * #3 <signal handler called>
|
||||
+ * #4 0x006adf5e in pthread_kill () from /lib/tls/libpthread.so.0
|
||||
+ * #5 0x080489e2 in makeSyscallFromAltSighandler (ignored=0x0) at threadcrash.c:190
|
||||
+ * #6 0x006aadec in start_thread () from /lib/tls/libpthread.so.0
|
||||
+ * #7 0x001ed19a in clone () from /lib/tls/libc.so.6
|
||||
+ *
|
||||
+ * Thread 4 (process 4355):
|
||||
+ * #0 spin (ignored=0x0) at threadcrash.c:242
|
||||
+ * #1 0x006aadec in start_thread () from /lib/tls/libpthread.so.0
|
||||
+ * #2 0x001ed19a in clone () from /lib/tls/libc.so.6
|
||||
+ *
|
||||
+ * Thread 3 (process 4356):
|
||||
+ * #0 spinningSighandler (signo=12, info=0xb4de46f0, context=0xb4de4770) at threadcrash.c:180
|
||||
+ * #1 <signal handler called>
|
||||
+ * #2 0x006adf5e in pthread_kill () from /lib/tls/libpthread.so.0
|
||||
+ * #3 0x08048b2f in spinFromSighandler (ignored=0x0) at threadcrash.c:232
|
||||
+ * #4 0x006aadec in start_thread () from /lib/tls/libpthread.so.0
|
||||
+ * #5 0x001ed19a in clone () from /lib/tls/libc.so.6
|
||||
+ *
|
||||
+ * Thread 2 (process 4357):
|
||||
+ * #0 spinningAltSighandler (signo=14, info=0x959ee50, context=0x959eed0) at threadcrash.c:156
|
||||
+ * #1 <signal handler called>
|
||||
+ * #2 0x006adf5e in pthread_kill () from /lib/tls/libpthread.so.0
|
||||
+ * #3 0x08048ac0 in spinFromAltSighandler (ignored=0x0) at threadcrash.c:218
|
||||
+ * #4 0x006aadec in start_thread () from /lib/tls/libpthread.so.0
|
||||
+ * #5 0x001ed19a in clone () from /lib/tls/libc.so.6
|
||||
+ *
|
||||
+ * Thread 1 (process 4351):
|
||||
+ * #0 0x08048cf3 in main (argc=1, argv=0xbfff9d74) at threadcrash.c:273
|
||||
+ * (gdb)
|
||||
+ */
|
||||
+
|
||||
+#include <pthread.h>
|
||||
+#include <signal.h>
|
||||
+#include <assert.h>
|
||||
+#include <unistd.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#define SIGSYSCALL_ALT SIGQUIT
|
||||
+#define SIGSYSCALL SIGUSR1
|
||||
+#define SIGSPIN_ALT SIGALRM
|
||||
+#define SIGSPIN SIGUSR2
|
||||
+
|
||||
+typedef void (*sigaction_t)(int, siginfo_t *, void *);
|
||||
+
|
||||
+static void installHandler(int signo, sigaction_t handler, int onAltstack) {
|
||||
+ struct sigaction action;
|
||||
+ sigset_t sigset;
|
||||
+ int result;
|
||||
+ stack_t altstack;
|
||||
+ stack_t oldaltstack;
|
||||
+
|
||||
+ memset(&action, 0, sizeof(action));
|
||||
+ memset(&altstack, 0, sizeof(altstack));
|
||||
+ memset(&oldaltstack, 0, sizeof(oldaltstack));
|
||||
+
|
||||
+ if (onAltstack) {
|
||||
+ altstack.ss_sp = malloc(SIGSTKSZ);
|
||||
+ assert(altstack.ss_sp != NULL);
|
||||
+ altstack.ss_size = SIGSTKSZ;
|
||||
+ altstack.ss_flags = 0;
|
||||
+ result = sigaltstack(&altstack, &oldaltstack);
|
||||
+ assert(result == 0);
|
||||
+ assert(oldaltstack.ss_flags == SS_DISABLE);
|
||||
+ }
|
||||
+
|
||||
+ sigemptyset(&sigset);
|
||||
+
|
||||
+ action.sa_handler = NULL;
|
||||
+ action.sa_sigaction = handler;
|
||||
+ action.sa_mask = sigset;
|
||||
+ action.sa_flags = SA_SIGINFO;
|
||||
+ if (onAltstack) {
|
||||
+ action.sa_flags |= SA_ONSTACK;
|
||||
+ }
|
||||
+
|
||||
+ result = sigaction(signo, &action, NULL);
|
||||
+ assert(result == 0);
|
||||
+}
|
||||
+
|
||||
+static void installNormalHandler(int signo, sigaction_t handler) {
|
||||
+ installHandler(signo, handler, 0);
|
||||
+}
|
||||
+
|
||||
+static void installAlthandler(int signo, sigaction_t handler) {
|
||||
+ installHandler(signo, handler, 1);
|
||||
+}
|
||||
+
|
||||
+static void *makeSyscall(void *ignored) {
|
||||
+ (void)ignored;
|
||||
+
|
||||
+ sleep(42);
|
||||
+
|
||||
+ fprintf(stderr, "%s: returning\n", __FUNCTION__);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+/* Return true if we're currently executing on the altstack */
|
||||
+static int onAltstack(void) {
|
||||
+ stack_t stack;
|
||||
+ int result;
|
||||
+
|
||||
+ result = sigaltstack(NULL, &stack);
|
||||
+ assert(result == 0);
|
||||
+
|
||||
+ return stack.ss_flags & SS_ONSTACK;
|
||||
+}
|
||||
+
|
||||
+static void syscallingAltSighandler(int signo, siginfo_t *info, void *context) {
|
||||
+ (void)signo;
|
||||
+ (void)info;
|
||||
+ (void)context;
|
||||
+
|
||||
+ if (!onAltstack()) {
|
||||
+ printf("%s() not running on altstack!\n", __FUNCTION__);
|
||||
+ }
|
||||
+
|
||||
+ sleep(42);
|
||||
+}
|
||||
+
|
||||
+static void spinningAltSighandler(int signo, siginfo_t *info, void *context) {
|
||||
+ (void)signo;
|
||||
+ (void)info;
|
||||
+ (void)context;
|
||||
+
|
||||
+ if (!onAltstack()) {
|
||||
+ printf("%s() not running on altstack!\n", __FUNCTION__);
|
||||
+ }
|
||||
+
|
||||
+ while (1);
|
||||
+}
|
||||
+
|
||||
+static void syscallingSighandler(int signo, siginfo_t *info, void *context) {
|
||||
+ (void)signo;
|
||||
+ (void)info;
|
||||
+ (void)context;
|
||||
+
|
||||
+ if (onAltstack()) {
|
||||
+ printf("%s() running on altstack!\n", __FUNCTION__);
|
||||
+ }
|
||||
+
|
||||
+ sleep(42);
|
||||
+}
|
||||
+
|
||||
+static void spinningSighandler(int signo, siginfo_t *info, void *context) {
|
||||
+ (void)signo;
|
||||
+ (void)info;
|
||||
+ (void)context;
|
||||
+
|
||||
+ if (onAltstack()) {
|
||||
+ printf("%s() running on altstack!\n", __FUNCTION__);
|
||||
+ }
|
||||
+
|
||||
+ while (1);
|
||||
+}
|
||||
+
|
||||
+static void *makeSyscallFromAltSighandler(void *ignored) {
|
||||
+ (void)ignored;
|
||||
+
|
||||
+ int result;
|
||||
+
|
||||
+ installAlthandler(SIGSYSCALL_ALT, syscallingAltSighandler);
|
||||
+
|
||||
+ result = pthread_kill(pthread_self(), SIGSYSCALL_ALT);
|
||||
+ assert(result == 0);
|
||||
+
|
||||
+ fprintf(stderr, "%s: returning\n", __FUNCTION__);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static void *makeSyscallFromSighandler(void *ignored) {
|
||||
+ (void)ignored;
|
||||
+
|
||||
+ int result;
|
||||
+
|
||||
+ installNormalHandler(SIGSYSCALL, syscallingSighandler);
|
||||
+
|
||||
+ result = pthread_kill(pthread_self(), SIGSYSCALL);
|
||||
+ assert(result == 0);
|
||||
+
|
||||
+ fprintf(stderr, "%s: returning\n", __FUNCTION__);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static void *spinFromAltSighandler(void *ignored) {
|
||||
+ (void)ignored;
|
||||
+
|
||||
+ int result;
|
||||
+
|
||||
+ installAlthandler(SIGSPIN_ALT, spinningAltSighandler);
|
||||
+
|
||||
+ result = pthread_kill(pthread_self(), SIGSPIN_ALT);
|
||||
+ assert(result == 0);
|
||||
+
|
||||
+ fprintf(stderr, "%s: returning\n", __FUNCTION__);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static void *spinFromSighandler(void *ignored) {
|
||||
+ (void)ignored;
|
||||
+
|
||||
+ int result;
|
||||
+
|
||||
+ installNormalHandler(SIGSPIN, spinningSighandler);
|
||||
+
|
||||
+ result = pthread_kill(pthread_self(), SIGSPIN);
|
||||
+ assert(result == 0);
|
||||
+
|
||||
+ fprintf(stderr, "%s: returning\n", __FUNCTION__);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static void *spin(void *ignored) {
|
||||
+ (void)ignored;
|
||||
+
|
||||
+ while (1);
|
||||
+
|
||||
+ fprintf(stderr, "%s: returning\n", __FUNCTION__);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+int main(int argc, char *argv[]) {
|
||||
+ int result;
|
||||
+ pthread_t thread;
|
||||
+ volatile int bad;
|
||||
+
|
||||
+ result = pthread_create(&thread, NULL, makeSyscall, NULL);
|
||||
+ assert(result == 0);
|
||||
+ result = pthread_create(&thread, NULL, makeSyscallFromSighandler, NULL);
|
||||
+ assert(result == 0);
|
||||
+ result = pthread_create(&thread, NULL, makeSyscallFromAltSighandler, NULL);
|
||||
+ assert(result == 0);
|
||||
+ result = pthread_create(&thread, NULL, spin, NULL);
|
||||
+ assert(result == 0);
|
||||
+ result = pthread_create(&thread, NULL, spinFromSighandler, NULL);
|
||||
+ assert(result == 0);
|
||||
+ result = pthread_create(&thread, NULL, spinFromAltSighandler, NULL);
|
||||
+ assert(result == 0);
|
||||
+
|
||||
+ // Give threads some time to get going
|
||||
+ sleep(3);
|
||||
+
|
||||
+ // Crash
|
||||
+ bad = *(int*)7;
|
||||
+
|
||||
+ /* Workaround: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29628
|
||||
+ Simulate use to ensure `DW_AT_location' for them:
|
||||
+ readelf -a --debug threadcrash|grep -A5 -w argc
|
||||
+ --> DW_AT_location : 2 byte block: 71 0 (DW_OP_breg1: 0)
|
||||
+ This case verified on: gcc-4.1.1-30.i386
|
||||
+ Keep it late to ensure persistency in the registers. */
|
||||
+ bad = (int) argc;
|
||||
+ bad = (unsigned long) argv;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.threads/threadcrash.exp b/gdb/testsuite/gdb.threads/threadcrash.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/threadcrash.exp
|
||||
@@ -0,0 +1,37 @@
|
||||
+# threadcrash.exp - The point of this program is to crash in a multi-threaded app.
|
||||
+
|
||||
+
|
||||
+set testfile threadcrash
|
||||
+set srcfile ${testfile}.c
|
||||
+set shellfile ${srcdir}/${subdir}/${testfile}.sh
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+set GDB_abs ${GDB}
|
||||
+if [regexp "^\[^/\]" ${GDB_abs}] {
|
||||
+ set GDB_abs $env(PWD)/${GDB_abs}
|
||||
+}
|
||||
+
|
||||
+if [istarget "*-*-linux"] then {
|
||||
+ set target_cflags "-D_MIT_POSIX_THREADS"
|
||||
+} else {
|
||||
+ set target_cflags ""
|
||||
+}
|
||||
+
|
||||
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# ${shellfile} argument must not contain any directories.
|
||||
+set fd [open "|bash ${shellfile} ${binfile} $GDB $INTERNAL_GDBFLAGS $GDBFLAGS [host_info gdb_opts]" r]
|
||||
+while { [gets $fd line] >= 0 } {
|
||||
+ if [regexp " PASS: (.*)$" $line trash message] {
|
||||
+ pass $message
|
||||
+ } elseif [regexp " FAIL: (.*)$" $line trash message] {
|
||||
+ fail $message
|
||||
+ }
|
||||
+}
|
||||
+catch {
|
||||
+ close $fd
|
||||
+}
|
||||
+
|
||||
+return 0
|
||||
diff --git a/gdb/testsuite/gdb.threads/threadcrash.sh b/gdb/testsuite/gdb.threads/threadcrash.sh
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/threadcrash.sh
|
||||
@@ -0,0 +1,324 @@
|
||||
+#! /bin/bash
|
||||
+
|
||||
+# NOTE: threadcrash.c *must* be built with debugging symbols
|
||||
+#
|
||||
+# The point of this shell script is to crash treadcrash.c, load the
|
||||
+# resulting core file into gdb and verify that gdb can extract enough
|
||||
+# information from the core file.
|
||||
+#
|
||||
+# The return code from this script is the number of failed tests.
|
||||
+
|
||||
+LOG=gdbresult.log
|
||||
+
|
||||
+if [ $# = 0 ] ; then
|
||||
+ echo >&2 Syntax: $0 \<name of threadcrash binary\> [\<gdb binary\> \<args...\>]
|
||||
+ exit 1
|
||||
+fi
|
||||
+RUNME="$1"
|
||||
+shift
|
||||
+GDB="${*:-gdb}"
|
||||
+
|
||||
+
|
||||
+pf_prefix=""
|
||||
+function pf_prefix() {
|
||||
+ pf_prefix="$*"
|
||||
+}
|
||||
+
|
||||
+set_test=""
|
||||
+function set_test() {
|
||||
+ if [ -n "$set_test" ] ; then
|
||||
+ echo >&2 "DEJAGNU-BASH ERROR: set_test already set"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ set_test="$*"
|
||||
+ if [ -n "$pf_prefix" ] ; then
|
||||
+ set_test="$pf_prefix: $set_test"
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+# INTERNAL
|
||||
+function record_test {
|
||||
+ if [ -z "$set_test" ] ; then
|
||||
+ echo >&2 "DEJAGNU-BASH ERROR: set_test not set"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ # Provide the leading whitespace delimiter:
|
||||
+ echo " $1: $set_test"
|
||||
+ set_test=""
|
||||
+}
|
||||
+
|
||||
+function pass() {
|
||||
+ record_test PASS
|
||||
+}
|
||||
+function fail() {
|
||||
+ record_test FAIL
|
||||
+}
|
||||
+
|
||||
+
|
||||
+# Verify that the gdb output doesn't contain $1.
|
||||
+function mustNotHave() {
|
||||
+ local BADWORD=$1
|
||||
+ set_test gdb output contains "$BADWORD"
|
||||
+ if grep -q "$BADWORD" $LOG ; then
|
||||
+ fail
|
||||
+ return 1
|
||||
+ fi
|
||||
+ pass
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Verify that the gdb output contains exactly $1 $2s.
|
||||
+function mustHaveCorrectAmount() {
|
||||
+ local WANTEDNUMBER=$1
|
||||
+ local GOODWORD=$2
|
||||
+ local ACTUALNUMBER=$(grep "$GOODWORD" $LOG | wc -l)
|
||||
+ set_test gdb output contained $ACTUALNUMBER \""$GOODWORD"\", not $WANTEDNUMBER as expected
|
||||
+ if [ $ACTUALNUMBER != $WANTEDNUMBER ] ; then
|
||||
+ fail
|
||||
+ return 1
|
||||
+ fi
|
||||
+ pass
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Verify that the gdb output contains seven threads
|
||||
+function mustHaveSevenThreads() {
|
||||
+ NTHREADS=$(egrep "^Thread [1-7] \(" $LOG | wc -l)
|
||||
+ set_test gdb output contains $NTHREADS threads, not 7 as expected
|
||||
+ if [ $NTHREADS != 7 ] ; then
|
||||
+ fail
|
||||
+ return 1
|
||||
+ fi
|
||||
+ pass
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Verify that the gdb output has all parameters on consecutive lines
|
||||
+function mustHaveSequence() {
|
||||
+ SEQUENCE="$*"
|
||||
+ NPARTS=$#
|
||||
+ grep "$1" -A$((NPARTS - 1)) $LOG > matches.log
|
||||
+
|
||||
+ while [ $# -gt 1 ] ; do
|
||||
+ shift
|
||||
+ ((NPARTS--))
|
||||
+ grep "$1" -A$((NPARTS - 1)) matches.log > temp.log
|
||||
+ mv temp.log matches.log
|
||||
+ done
|
||||
+ LASTPART=$1
|
||||
+
|
||||
+ set_test gdb output does not contain the sequence: $SEQUENCE
|
||||
+ if ! grep -q "$LASTPART" matches.log ; then
|
||||
+ fail
|
||||
+ return 1
|
||||
+ fi
|
||||
+ pass
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Verify that $LOG contains all information we want
|
||||
+function verifyLog() {
|
||||
+ local FAILURES=0
|
||||
+
|
||||
+ mustNotHave '??' || ((FAILURES++))
|
||||
+ mustHaveCorrectAmount 11 threadcrash.c: || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSevenThreads || ((FAILURES++))
|
||||
+ mustHaveSequence sleep "makeSyscall (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence sleep "syscallingSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
|
||||
+ mustHaveSequence pthread_kill "makeSyscallFromSighandler (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence sleep "syscallingAltSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
|
||||
+ mustHaveSequence pthread_kill "makeSyscallFromAltSighandler (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence Thread "spin (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence "spinningSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
|
||||
+ mustHaveSequence pthread_kill "spinFromSighandler (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence "spinningAltSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
|
||||
+ mustHaveSequence pthread_kill "spinFromAltSighandler (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence Thread "main (argc=1, argv=" || ((FAILURES++))
|
||||
+
|
||||
+ return $FAILURES
|
||||
+}
|
||||
+
|
||||
+# Put result of debugging a core file in $LOG
|
||||
+function getLogFromCore() {
|
||||
+ # Make sure we get a core file
|
||||
+ set_test Make sure we get a core file
|
||||
+ if ! ulimit -c unlimited ; then
|
||||
+ fail
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ pass
|
||||
+
|
||||
+ # Run the crasher
|
||||
+ ./$(basename "$RUNME")
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ # Verify that we actually crashed
|
||||
+ set_test $RUNME should have been killed by a signal, got non-signal exit code $EXITCODE
|
||||
+ if [ $EXITCODE -lt 128 ] ; then
|
||||
+ fail
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ pass
|
||||
+
|
||||
+ # Verify that we got a core file
|
||||
+ set_test $RUNME did not create a core file
|
||||
+ if [ ! -r core* ] ; then
|
||||
+ fail
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ pass
|
||||
+
|
||||
+ # Run gdb
|
||||
+ cat > gdbscript.gdb <<EOF
|
||||
+set width 0
|
||||
+t a a bt 100
|
||||
+quit
|
||||
+EOF
|
||||
+ cat gdbscript.gdb /dev/zero | $GDB -nx "./$(basename "$RUNME")" core* > $LOG
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ set_test gdb exited with error code
|
||||
+ if [ $EXITCODE != 0 ] ; then
|
||||
+ ((FAILURES++))
|
||||
+ echo >&2 gdb exited with error code $EXITCODE
|
||||
+ fail
|
||||
+ fi
|
||||
+ pass
|
||||
+}
|
||||
+
|
||||
+# Put result of debugging a gcore file in $LOG
|
||||
+function getLogFromGcore() {
|
||||
+ # Create the core file
|
||||
+ rm -f core*
|
||||
+ cat > gdbscript.gdb <<EOF
|
||||
+handle SIGQUIT pass noprint nostop
|
||||
+handle SIGUSR1 pass noprint nostop
|
||||
+handle SIGUSR2 pass noprint nostop
|
||||
+handle SIGALRM pass noprint nostop
|
||||
+run
|
||||
+gcore
|
||||
+quit
|
||||
+EOF
|
||||
+ cat gdbscript.gdb /dev/zero | $GDB -nx "./$(basename "$RUNME")" > /dev/null
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ set_test gdb exited with error code when creating gcore file
|
||||
+ if [ $EXITCODE != 0 ] ; then
|
||||
+ ((FAILURES++))
|
||||
+ echo >&2 gdb exited with error code $EXITCODE when creating gcore file
|
||||
+ fail
|
||||
+ fi
|
||||
+ pass
|
||||
+
|
||||
+ # Verify that we got a core file from gcore
|
||||
+ set_test gdb gcore did not create a core file
|
||||
+ if [ ! -r core* ] ; then
|
||||
+ fail
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ pass
|
||||
+
|
||||
+ # Run gdb on the gcore file
|
||||
+ cat > gdbscript.gdb <<EOF
|
||||
+set width 0
|
||||
+t a a bt 100
|
||||
+quit
|
||||
+EOF
|
||||
+ cat gdbscript.gdb /dev/zero | $GDB -nx "./$(basename "$RUNME")" core* > $LOG
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ set_test gdb exited with error code when examining gcore file
|
||||
+ if [ $EXITCODE != 0 ] ; then
|
||||
+ ((FAILURES++))
|
||||
+ echo >&2 gdb exited with error code $EXITCODE when examining gcore file
|
||||
+ fail
|
||||
+ fi
|
||||
+ pass
|
||||
+}
|
||||
+
|
||||
+# Put result of debugging a core file in $LOG
|
||||
+function getLogFromLiveProcess() {
|
||||
+ # Run gdb
|
||||
+ cat > gdbscript.gdb <<EOF
|
||||
+handle SIGQUIT pass noprint nostop
|
||||
+handle SIGUSR1 pass noprint nostop
|
||||
+handle SIGUSR2 pass noprint nostop
|
||||
+handle SIGALRM pass noprint nostop
|
||||
+set width 0
|
||||
+run
|
||||
+t a a bt 100
|
||||
+quit
|
||||
+EOF
|
||||
+ cat gdbscript.gdb /dev/zero | $GDB -nx "./$(basename "$RUNME")" > $LOG
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ set_test gdb exited with error code
|
||||
+ if [ $EXITCODE != 0 ] ; then
|
||||
+ ((FAILURES++))
|
||||
+ echo >&2 gdb exited with error code $EXITCODE
|
||||
+ fail
|
||||
+ fi
|
||||
+ pass
|
||||
+}
|
||||
+
|
||||
+####### Main program follows #####################
|
||||
+
|
||||
+# Make sure we don't clobber anybody else's (core) file(s)
|
||||
+WORKDIR=/tmp/$PPID
|
||||
+mkdir -p $WORKDIR
|
||||
+cp "$RUNME" $WORKDIR
|
||||
+cd $WORKDIR
|
||||
+
|
||||
+# Count problems
|
||||
+FAILURES=0
|
||||
+
|
||||
+echo === Testing gdb vs core file...
|
||||
+pf_prefix core file
|
||||
+getLogFromCore
|
||||
+verifyLog
|
||||
+((FAILURES+=$?))
|
||||
+pf_prefix
|
||||
+echo === Core file tests done.
|
||||
+
|
||||
+echo
|
||||
+
|
||||
+echo === Testing gdb vs gcore file...
|
||||
+pf_prefix gcore file
|
||||
+getLogFromGcore
|
||||
+verifyLog
|
||||
+((FAILURES+=$?))
|
||||
+pf_prefix
|
||||
+echo === Gcore file tests done.
|
||||
+
|
||||
+echo
|
||||
+
|
||||
+echo === Testing gdb vs live process...
|
||||
+pf_prefix live process
|
||||
+getLogFromLiveProcess
|
||||
+verifyLog
|
||||
+((FAILURES+=$?))
|
||||
+pf_prefix
|
||||
+echo === Live process tests done.
|
||||
+
|
||||
+# Executive summary
|
||||
+echo
|
||||
+if [ $FAILURES == 0 ] ; then
|
||||
+ echo All tests passed!
|
||||
+else
|
||||
+ echo $FAILURES tests failed!
|
||||
+ echo
|
||||
+ echo Make sure the threadcrash binary contains debugging information \(build with \"gcc -g\"\).
|
||||
+fi
|
||||
+
|
||||
+# Clean up
|
||||
+cd /
|
||||
+rm -rf $WORKDIR
|
||||
+
|
||||
+exit $FAILURES
|
||||
diff --git a/gdb/testsuite/gdb.threads/threadcrash.sh-orig b/gdb/testsuite/gdb.threads/threadcrash.sh-orig
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/threadcrash.sh-orig
|
||||
@@ -0,0 +1,248 @@
|
||||
+#! /bin/bash
|
||||
+
|
||||
+# NOTE: threadcrash.c *must* be built with debugging symbols
|
||||
+#
|
||||
+# The point of this shell script is to crash treadcrash.c, load the
|
||||
+# resulting core file into gdb and verify that gdb can extract enough
|
||||
+# information from the core file.
|
||||
+#
|
||||
+# The return code from this script is the number of failed tests.
|
||||
+
|
||||
+LOG=gdbresult.log
|
||||
+
|
||||
+if [ $# != 1 ] ; then
|
||||
+ echo > /dev/stderr Syntax: $0 \<name of threadcrash binary\>
|
||||
+ exit 1
|
||||
+fi
|
||||
+RUNME="$1"
|
||||
+
|
||||
+# Verify that the gdb output doesn't contain $1.
|
||||
+function mustNotHave() {
|
||||
+ local BADWORD=$1
|
||||
+ if grep -q "$BADWORD" $LOG ; then
|
||||
+ echo >> /dev/stderr WARNING: gdb output contains "$BADWORD"
|
||||
+ return 1
|
||||
+ fi
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Verify that the gdb output contains exactly $1 $2s.
|
||||
+function mustHaveCorrectAmount() {
|
||||
+ local WANTEDNUMBER=$1
|
||||
+ local GOODWORD=$2
|
||||
+ local ACTUALNUMBER=$(grep "$GOODWORD" $LOG | wc -l)
|
||||
+ if [ $ACTUALNUMBER != $WANTEDNUMBER ] ; then
|
||||
+ echo >> /dev/stderr WARNING: gdb output contained $ACTUALNUMBER \""$GOODWORD"\", not $WANTEDNUMBER as expected
|
||||
+ return 1
|
||||
+ fi
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Verify that the gdb output contains seven threads
|
||||
+function mustHaveSevenThreads() {
|
||||
+ NTHREADS=$(egrep "^Thread [1-7] \(" $LOG | wc -l)
|
||||
+ if [ $NTHREADS != 7 ] ; then
|
||||
+ echo >> /dev/stderr WARNING: gdb output contains $NTHREADS threads, not 7 as expected
|
||||
+ return 1
|
||||
+ fi
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Verify that the gdb output has all parameters on consecutive lines
|
||||
+function mustHaveSequence() {
|
||||
+ SEQUENCE="$*"
|
||||
+ NPARTS=$#
|
||||
+ grep "$1" -A$((NPARTS - 1)) $LOG > matches.log
|
||||
+
|
||||
+ while [ $# -gt 1 ] ; do
|
||||
+ shift
|
||||
+ ((NPARTS--))
|
||||
+ grep "$1" -A$((NPARTS - 1)) matches.log > temp.log
|
||||
+ mv temp.log matches.log
|
||||
+ done
|
||||
+ LASTPART=$1
|
||||
+
|
||||
+ if ! grep -q "$LASTPART" matches.log ; then
|
||||
+ echo >> /dev/stderr WARNING: gdb output does not contain the sequence: $SEQUENCE
|
||||
+ return 1
|
||||
+ fi
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# Verify that $LOG contains all information we want
|
||||
+function verifyLog() {
|
||||
+ local FAILURES=0
|
||||
+
|
||||
+ mustNotHave '??' || ((FAILURES++))
|
||||
+ mustHaveCorrectAmount 12 threadcrash.c: || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSevenThreads || ((FAILURES++))
|
||||
+ mustHaveSequence sleep "makeSyscall (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence sleep "syscallingSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
|
||||
+ mustHaveSequence pthread_kill "makeSyscallFromSighandler (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence sleep "syscallingAltSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
|
||||
+ mustHaveSequence pthread_kill "makeSyscallFromAltSighandler (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence Thread "spin (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence "spinningSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
|
||||
+ mustHaveSequence pthread_kill "spinFromSighandler (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence "spinningAltSighandler (signo=" "signal handler called" 0x || ((FAILURES++))
|
||||
+ mustHaveSequence pthread_kill "spinFromAltSighandler (ignored=" || ((FAILURES++))
|
||||
+
|
||||
+ mustHaveSequence Thread "main (argc=1, argv=" || ((FAILURES++))
|
||||
+
|
||||
+ return $FAILURES
|
||||
+}
|
||||
+
|
||||
+# Put result of debugging a core file in $LOG
|
||||
+function getLogFromCore() {
|
||||
+ # Make sure we get a core file
|
||||
+ ulimit -c unlimited || exit 1
|
||||
+
|
||||
+ # Run the crasher
|
||||
+ ./$(basename "$RUNME")
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ # Verify that we actually crashed
|
||||
+ if [ $EXITCODE -lt 128 ] ; then
|
||||
+ echo >> /dev/stderr ERROR: $RUNME should have been killed by a signal, got non-signal exit code $EXITCODE
|
||||
+ exit 1
|
||||
+ fi
|
||||
+
|
||||
+ # Verify that we got a core file
|
||||
+ if [ ! -r core* ] ; then
|
||||
+ echo >> /dev/stderr ERROR: $RUNME did not create a core file
|
||||
+ exit 1
|
||||
+ fi
|
||||
+
|
||||
+ # Run gdb
|
||||
+ cat > gdbscript.gdb <<EOF
|
||||
+set width 0
|
||||
+t a a bt 100
|
||||
+quit
|
||||
+EOF
|
||||
+ cat gdbscript.gdb /dev/zero | gdb -nx "./$(basename "$RUNME")" core* > $LOG
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ if [ $EXITCODE != 0 ] ; then
|
||||
+ ((FAILURES++))
|
||||
+ echo >> /dev/stderr WARNING: gdb exited with error code $EXITCODE
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+# Put result of debugging a gcore file in $LOG
|
||||
+function getLogFromGcore() {
|
||||
+ # Create the core file
|
||||
+ rm -f core*
|
||||
+ cat > gdbscript.gdb <<EOF
|
||||
+handle SIGQUIT pass noprint nostop
|
||||
+handle SIGUSR1 pass noprint nostop
|
||||
+handle SIGUSR2 pass noprint nostop
|
||||
+handle SIGALRM pass noprint nostop
|
||||
+run
|
||||
+gcore
|
||||
+quit
|
||||
+EOF
|
||||
+ cat gdbscript.gdb /dev/zero | gdb -nx "./$(basename "$RUNME")" > /dev/null
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ if [ $EXITCODE != 0 ] ; then
|
||||
+ ((FAILURES++))
|
||||
+ echo >> /dev/stderr WARNING: gdb exited with error code $EXITCODE when creating gcore file
|
||||
+ fi
|
||||
+
|
||||
+ # Verify that we got a core file from gcore
|
||||
+ if [ ! -r core* ] ; then
|
||||
+ echo >> /dev/stderr ERROR: gdb gcore did not create a core file
|
||||
+ exit 1
|
||||
+ fi
|
||||
+
|
||||
+ # Run gdb on the gcore file
|
||||
+ cat > gdbscript.gdb <<EOF
|
||||
+set width 0
|
||||
+t a a bt 100
|
||||
+quit
|
||||
+EOF
|
||||
+ cat gdbscript.gdb /dev/zero | gdb -nx "./$(basename "$RUNME")" core* > $LOG
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ if [ $EXITCODE != 0 ] ; then
|
||||
+ ((FAILURES++))
|
||||
+ echo >> /dev/stderr WARNING: gdb exited with error code $EXITCODE when examining gcore file
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+# Put result of debugging a core file in $LOG
|
||||
+function getLogFromLiveProcess() {
|
||||
+ # Run gdb
|
||||
+ cat > gdbscript.gdb <<EOF
|
||||
+handle SIGQUIT pass noprint nostop
|
||||
+handle SIGUSR1 pass noprint nostop
|
||||
+handle SIGUSR2 pass noprint nostop
|
||||
+handle SIGALRM pass noprint nostop
|
||||
+set width 0
|
||||
+run
|
||||
+t a a bt 100
|
||||
+quit
|
||||
+EOF
|
||||
+ cat gdbscript.gdb /dev/zero | gdb -nx "./$(basename "$RUNME")" > $LOG
|
||||
+ EXITCODE=$?
|
||||
+
|
||||
+ if [ $EXITCODE != 0 ] ; then
|
||||
+ ((FAILURES++))
|
||||
+ echo >> /dev/stderr WARNING: gdb exited with error code $EXITCODE
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+####### Main program follows #####################
|
||||
+
|
||||
+# Make sure we don't clobber anybody else's (core) file(s)
|
||||
+WORKDIR=/tmp/$PPID
|
||||
+mkdir -p $WORKDIR
|
||||
+cp "$RUNME" $WORKDIR
|
||||
+cd $WORKDIR
|
||||
+
|
||||
+# Count problems
|
||||
+FAILURES=0
|
||||
+
|
||||
+echo === Testing gdb vs core file...
|
||||
+getLogFromCore
|
||||
+verifyLog
|
||||
+((FAILURES+=$?))
|
||||
+echo === Core file tests done.
|
||||
+
|
||||
+echo
|
||||
+
|
||||
+echo === Testing gdb vs gcore file...
|
||||
+getLogFromGcore
|
||||
+verifyLog
|
||||
+((FAILURES+=$?))
|
||||
+echo === Gcore file tests done.
|
||||
+
|
||||
+echo
|
||||
+
|
||||
+echo === Testing gdb vs live process...
|
||||
+getLogFromLiveProcess
|
||||
+verifyLog
|
||||
+((FAILURES+=$?))
|
||||
+echo === Live process tests done.
|
||||
+
|
||||
+# Executive summary
|
||||
+echo
|
||||
+if [ $FAILURES == 0 ] ; then
|
||||
+ echo All tests passed!
|
||||
+else
|
||||
+ echo $FAILURES tests failed!
|
||||
+ echo
|
||||
+ echo Make sure the threadcrash binary contains debugging information \(build with \"gcc -g\"\).
|
||||
+fi
|
||||
+
|
||||
+# Clean up
|
||||
+cd /
|
||||
+rm -rf $WORKDIR
|
||||
+
|
||||
+exit $FAILURES
|
134
gdb-6.5-bz109921-DW_AT_decl_file-test.patch
Normal file
134
gdb-6.5-bz109921-DW_AT_decl_file-test.patch
Normal file
@ -0,0 +1,134 @@
|
||||
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-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 <jan.kratochvil@redhat.com>
|
||||
Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* gdb.base/included.c, gdb.base/included.exp,
|
||||
gdb.base/included.h: New files.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
2007-01-09 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* 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;
|
264
gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
Normal file
264
gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch
Normal file
@ -0,0 +1,264 @@
|
||||
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.
|
||||
|
||||
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 <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
|
||||
|
||||
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
|
||||
--- a/gdb/printcmd.c
|
||||
+++ b/gdb/printcmd.c
|
||||
@@ -1306,6 +1306,10 @@ process_print_command_args (const char *args, value_print_options *print_opts,
|
||||
|
||||
if (exp != nullptr && *exp)
|
||||
{
|
||||
+ /* '*((int *(*) (void)) __errno_location) ()' is incompatible with
|
||||
+ function descriptors. */
|
||||
+ if (target_has_execution () && strcmp (exp, "errno") == 0)
|
||||
+ 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 <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 */
|
||||
+}
|
||||
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?
|
||||
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 <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 */
|
||||
+}
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+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?
|
107
gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
Normal file
107
gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
Normal file
@ -0,0 +1,107 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
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 <stdio.h>
|
||||
+
|
||||
+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"
|
||||
+ }
|
||||
+}
|
89
gdb-6.5-bz243845-stale-testing-zombie-test.patch
Normal file
89
gdb-6.5-bz243845-stale-testing-zombie-test.patch
Normal file
@ -0,0 +1,89 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
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
|
||||
+}
|
154
gdb-6.5-gcore-buffer-limit-test.patch
Normal file
154
gdb-6.5-gcore-buffer-limit-test.patch
Normal file
@ -0,0 +1,154 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Fedora GDB patches <invalid@email.com>
|
||||
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 <unistd.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+#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
|
Loading…
Reference in New Issue
Block a user