Initial import of sources
Resolves: RHEL-81744
This commit is contained in:
parent
7f87cf67aa
commit
d03dcd7d6c
1
.gitignore
vendored
1
.gitignore
vendored
@ -0,0 +1 @@
|
||||
/gdb-16.2.tar.xz
|
||||
104
README.local-patches.md
Normal file
104
README.local-patches.md
Normal file
@ -0,0 +1,104 @@
|
||||
# Fedora GDB local patches policy
|
||||
|
||||
In order to make things easier for the Fedora GDB maintainer, we
|
||||
choose to auto-generate the local patches by making use of an upstream
|
||||
git repository. Below you can find a few instructions on how to work
|
||||
using this method.
|
||||
|
||||
You need to run the following commands from the directory that
|
||||
contains the "gdb.spec" file.
|
||||
|
||||
## Importing the GDB patches into a git repository
|
||||
|
||||
1) The local patches (`*.patch`) need to be imported into an upstream
|
||||
git repository. For example, let's assume you cloned the repository
|
||||
by doing:
|
||||
|
||||
`$ git clone git://sourceware.org/git/binutils-gdb.git`
|
||||
|
||||
> TIP: if you already have the repository cloned somewhere in your
|
||||
> system, you can pass a "--reference <dir>" to the "git clone"
|
||||
> command and it will use your local repository as much as possible
|
||||
> to make the clone, speeding up things.
|
||||
|
||||
2) After cloning the upstream repository, you can import your patches
|
||||
by using the script "generate-git-repo-from-patches.sh":
|
||||
|
||||
`$ sh generate-git-repo-from-patches.sh <REPOSITORY_DIR>`
|
||||
|
||||
The script will basically cd into the repository, checkout the
|
||||
revision specified in the file `_git_upstream_commit`, iterate through
|
||||
the file `_patch_order` and "git-am" every patch *in that order*.
|
||||
This operation should complete without errors; if you find a problem
|
||||
with `git-am`, it probably means that the revision specified in the
|
||||
file `_git_upstream_commit` is wrong.
|
||||
|
||||
## Rebasing the patches against a newer version/release
|
||||
|
||||
1) First, cd into the upstream repository. All you have to do is
|
||||
choose the revision against which you plan to rebase the patches, and
|
||||
`git rebase <REVISION>`. git will do the rest, and you will be able
|
||||
to perform conflict resolution by git's algorithm, which is smarter.
|
||||
|
||||
## Creating new patches
|
||||
|
||||
1) Create the new patch on top of the the others, as usual. Note that
|
||||
you can use `git rebase` whenever you want to reorder patch order, or
|
||||
even to delete a patch.
|
||||
|
||||
2) When writing the commit log, you must obey a few rules. The
|
||||
subject line *must* be the filename of the patch. This line will be
|
||||
used when exporting the patches from the git repository, and
|
||||
(obviously) it gives the filename that should be used for this
|
||||
specific patch.
|
||||
|
||||
3) You can also add comments that will go into the auto-generated
|
||||
`Patch:` file (see below). To do that, use the special marker `;;` at
|
||||
the beginning of the line. This way, a commit log that says:
|
||||
|
||||
~~~~~~~~~~~
|
||||
test-patch.patch
|
||||
|
||||
;; This is a test patch
|
||||
;; Second line
|
||||
~~~~~~~~~~~
|
||||
|
||||
Will generate the following entry in the auto-generated `Patch:` file:
|
||||
|
||||
~~~~~~~~~~~
|
||||
# This is a test patch
|
||||
# Second line
|
||||
PatchXYZ: test-patch.patch
|
||||
~~~~~~~~~~~
|
||||
|
||||
## Exporting the GDB patches from the git repository
|
||||
|
||||
1) When you're done working with the patches, go back to the directory
|
||||
that contains the `gdb.spec` file, and from there you run:
|
||||
|
||||
`$ sh generate-patches-from-git-repo.sh <REPOSITORY_DIR>`
|
||||
|
||||
This will regenerate all of the `*.patch` files (excluding the ones that
|
||||
were also excluded from the git repository), and also regenerate a few
|
||||
control files. These control files are:
|
||||
|
||||
- `_gdb.spec.Patch.include`: This file contains the `Patch:` directives.
|
||||
|
||||
- `_gdb.spec.patch.include`: This file contains the `%patch` directives.
|
||||
|
||||
- `_patch_order`: This file contains the patches, in the exact order
|
||||
that they must be applied. It is used when importing the patches
|
||||
into the git repository.
|
||||
|
||||
- `_git_upstream_commit`: This file contains the last upstream commit
|
||||
against which the patches were rebased. It is used when importing
|
||||
the patches into the git repository.
|
||||
|
||||
NOTE: If you did a rebase against a newer upstream version, you need
|
||||
to specify the commit/tag/branch against which you rebased:
|
||||
|
||||
`$ sh generate-patches-from-git-repo.sh <REPOSITORY_DIR> <COMMIT_OR_TAG_OR_BRANCH>`
|
||||
|
||||
For example, if you rebased against `gdb-8.1-release`:
|
||||
|
||||
`$ sh generate-patches-from-git-repo.sh <REPOSITORY_DIR> gdb-8.1-release`
|
||||
103
_gdb.spec.Patch.include
Normal file
103
_gdb.spec.Patch.include
Normal file
@ -0,0 +1,103 @@
|
||||
# Check distro name is included in the version output.
|
||||
Patch001: gdb-6.3-rh-testversion-20041202.patch
|
||||
|
||||
# Test sideeffects of skipping ppc .so libs trampolines (BZ 218379).
|
||||
#=fedoratest
|
||||
Patch002: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
|
||||
|
||||
# Support for stepping over PPC atomic instruction sequences (BZ 237572).
|
||||
#=fedoratest
|
||||
Patch003: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
|
||||
|
||||
# Test leftover zombie process (BZ 243845).
|
||||
#=fedoratest
|
||||
Patch004: gdb-6.5-bz243845-stale-testing-zombie-test.patch
|
||||
|
||||
# Test gcore memory and time requirements for large inferiors.
|
||||
#=fedoratest
|
||||
Patch005: 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.
|
||||
Patch006: gdb-6.3-mapping-zero-inode-test.patch
|
||||
|
||||
# Test a crash on libraries missing the .text section.
|
||||
#=fedoratest
|
||||
Patch007: gdb-6.5-section-num-fixup-test.patch
|
||||
|
||||
# Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
|
||||
#=fedoratest
|
||||
Patch008: gdb-6.8-bz466901-backtrace-full-prelinked.patch
|
||||
|
||||
# New test for step-resume breakpoint placed in multiple threads at once.
|
||||
#=fedoratest
|
||||
Patch009: gdb-simultaneous-step-resume-breakpoint-test.patch
|
||||
|
||||
# Fix follow-exec for C++ programs (bugreported by Martin Stransky).
|
||||
#=fedoratest
|
||||
Patch010: gdb-archer-next-over-throw-cxx-exec.patch
|
||||
|
||||
# [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604).
|
||||
#=fedoratest
|
||||
Patch011: gdb-test-bt-cfi-without-die.patch
|
||||
|
||||
# Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343).
|
||||
#=fedoratest
|
||||
Patch012: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
|
||||
|
||||
# Fix 'memory leak in infpy_read_memory()' (RH BZ 1007614)
|
||||
#=fedoratest
|
||||
Patch013: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
|
||||
|
||||
# Testcase for '[SAP] Recursive dlopen causes SAP HANA installer to
|
||||
# crash.' (RH BZ 1156192).
|
||||
#=fedoratest
|
||||
Patch014: gdb-rhbz1156192-recursive-dlopen-test.patch
|
||||
|
||||
# Fix '`catch syscall' doesn't work for parent after `fork' is called'
|
||||
# (Philippe Waroquiers, RH BZ 1149205).
|
||||
#=fedoratest
|
||||
Patch015: gdb-rhbz1149205-catch-syscall-after-fork-test.patch
|
||||
|
||||
# Fix '[ppc64] and [s390x] wrong prologue skip on -O2 -g code' (Jan
|
||||
# Kratochvil, RH BZ 1084404).
|
||||
#=fedoratest
|
||||
Patch016: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
|
||||
|
||||
# [aarch64] Fix hardware watchpoints (RH BZ 1261564).
|
||||
#=fedoratest
|
||||
Patch017: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
|
||||
|
||||
# Update gdb-add-index.sh such that, when the GDB environment
|
||||
# variable is not set, the script is smarter than just looking for
|
||||
# 'gdb' in the $PATH.
|
||||
#
|
||||
# The actual search order is now: /usr/bin/gdb.minimal, gdb (in the
|
||||
# $PATH), then /usr/libexec/gdb.
|
||||
#
|
||||
# For the rationale of looking for gdb.minimal see:
|
||||
#
|
||||
# https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot
|
||||
#
|
||||
#=fedora
|
||||
Patch018: gdb-add-index.patch
|
||||
|
||||
# Not a backport. Add a new script which hooks into GDB and suggests
|
||||
# RPMs to install when GDB finds an objfile with no debug info.
|
||||
Patch019: gdb-add-rpm-suggestion-script.patch
|
||||
|
||||
# Backport "Fix gstack issues" from upstream
|
||||
# commit 43ac3df61492b94bf13c11bd98c9f9541e92d3b0.
|
||||
# (Keith Seitz, RH BZ 2354997)
|
||||
Patch020: gdb-rhbz2354997-gstack-drop-readnever.patch
|
||||
|
||||
# Backport upstream commit 2fc56106422 which fixes a possible
|
||||
# segfault when opening a core file. This will drop out when we
|
||||
# rebase to 16.3 or 17.1
|
||||
Patch021: core-target-open-segfault.patch
|
||||
|
||||
# Backport upstream commit 2b646bb8767, this fixes an issue where
|
||||
# TUI output was not flushed to the screen in some cases. This will
|
||||
# drop out when we rebase on 16.3 or 17.1.
|
||||
Patch022: tui-wrefresh-issue.patch
|
||||
|
||||
22
_gdb.spec.patch.include
Normal file
22
_gdb.spec.patch.include
Normal file
@ -0,0 +1,22 @@
|
||||
%patch -p1 -P001
|
||||
%patch -p1 -P002
|
||||
%patch -p1 -P003
|
||||
%patch -p1 -P004
|
||||
%patch -p1 -P005
|
||||
%patch -p1 -P006
|
||||
%patch -p1 -P007
|
||||
%patch -p1 -P008
|
||||
%patch -p1 -P009
|
||||
%patch -p1 -P010
|
||||
%patch -p1 -P011
|
||||
%patch -p1 -P012
|
||||
%patch -p1 -P013
|
||||
%patch -p1 -P014
|
||||
%patch -p1 -P015
|
||||
%patch -p1 -P016
|
||||
%patch -p1 -P017
|
||||
%patch -p1 -P018
|
||||
%patch -p1 -P019
|
||||
%patch -p1 -P020
|
||||
%patch -p1 -P021
|
||||
%patch -p1 -P022
|
||||
1
_git_upstream_commit
Normal file
1
_git_upstream_commit
Normal file
@ -0,0 +1 @@
|
||||
50b1dcab86c5fea753e0b15c4722bda4313b48e3
|
||||
22
_patch_order
Normal file
22
_patch_order
Normal file
@ -0,0 +1,22 @@
|
||||
gdb-6.3-rh-testversion-20041202.patch
|
||||
gdb-6.5-bz218379-ppc-solib-trampoline-test.patch
|
||||
gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
|
||||
gdb-6.5-bz243845-stale-testing-zombie-test.patch
|
||||
gdb-6.5-gcore-buffer-limit-test.patch
|
||||
gdb-6.3-mapping-zero-inode-test.patch
|
||||
gdb-6.5-section-num-fixup-test.patch
|
||||
gdb-6.8-bz466901-backtrace-full-prelinked.patch
|
||||
gdb-simultaneous-step-resume-breakpoint-test.patch
|
||||
gdb-archer-next-over-throw-cxx-exec.patch
|
||||
gdb-test-bt-cfi-without-die.patch
|
||||
gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
|
||||
gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
|
||||
gdb-rhbz1156192-recursive-dlopen-test.patch
|
||||
gdb-rhbz1149205-catch-syscall-after-fork-test.patch
|
||||
gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
|
||||
gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
|
||||
gdb-add-index.patch
|
||||
gdb-add-rpm-suggestion-script.patch
|
||||
gdb-rhbz2354997-gstack-drop-readnever.patch
|
||||
core-target-open-segfault.patch
|
||||
tui-wrefresh-issue.patch
|
||||
56
core-target-open-segfault.patch
Normal file
56
core-target-open-segfault.patch
Normal file
@ -0,0 +1,56 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Tom de Vries <tdevries@suse.de>
|
||||
Date: Fri, 7 Feb 2025 17:06:30 +0100
|
||||
Subject: core-target-open-segfault.patch
|
||||
|
||||
;; Backport upstream commit 2fc56106422 which fixes a possible
|
||||
;; segfault when opening a core file. This will drop out when we
|
||||
;; rebase to 16.3 or 17.1
|
||||
|
||||
[gdb/corefiles] Fix segfault in core_target_open
|
||||
|
||||
On x86_64-freebsd, with test-case gdb.arch/i386-biarch-core.exp I run into a
|
||||
segfault here in corelow.c:core_target_open:
|
||||
...
|
||||
{
|
||||
gdb::unique_xmalloc_ptr<char> failing_command = make_unique_xstrdup
|
||||
(bfd_core_file_failing_command (current_program_space->core_bfd ()));
|
||||
if (failing_command != nullptr)
|
||||
gdb_printf (_("Core was generated by `%s'.\n"),
|
||||
failing_command.get ());
|
||||
}
|
||||
...
|
||||
where bfd_core_file_failing_command returns nullptr, so the segfault happens
|
||||
somewhere during "strdup (nullptr)".
|
||||
|
||||
There doesn't seem to be a need to make a copy of the string, so fix this by
|
||||
dropping the make_unique_xstrdup.
|
||||
|
||||
Tested on x86_64-linux.
|
||||
Tested the test-case on x86_64-freebsd.
|
||||
|
||||
Approved-By: Tom Tromey <tom@tromey.com>
|
||||
|
||||
PR corefiles/32634
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32634
|
||||
|
||||
(cherry picked from commit 9dd3d66b79a2907726f407039234ad8677e9df16)
|
||||
|
||||
diff --git a/gdb/corelow.c b/gdb/corelow.c
|
||||
--- a/gdb/corelow.c
|
||||
+++ b/gdb/corelow.c
|
||||
@@ -1188,11 +1188,11 @@ core_target_open (const char *arg, int from_tty)
|
||||
}
|
||||
else
|
||||
{
|
||||
- gdb::unique_xmalloc_ptr<char> failing_command = make_unique_xstrdup
|
||||
- (bfd_core_file_failing_command (current_program_space->core_bfd ()));
|
||||
+ const char *failing_command
|
||||
+ = bfd_core_file_failing_command (current_program_space->core_bfd ());
|
||||
if (failing_command != nullptr)
|
||||
gdb_printf (_("Core was generated by `%s'.\n"),
|
||||
- failing_command.get ());
|
||||
+ failing_command);
|
||||
}
|
||||
|
||||
/* Clearing any previous state of convenience variables. */
|
||||
6
gating.yaml
Normal file
6
gating.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-8
|
||||
decision_context: osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}
|
||||
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
|
||||
+ }
|
||||
+}
|
||||
34
gdb-6.3-rh-testversion-20041202.patch
Normal file
34
gdb-6.3-rh-testversion-20041202.patch
Normal file
@ -0,0 +1,34 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Burgess <aburgess@redhat.com>
|
||||
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
||||
Subject: gdb-6.3-rh-testversion-20041202.patch
|
||||
|
||||
;; Check distro name is included in the version output.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/fedora-version.exp b/gdb/testsuite/gdb.base/fedora-version.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/fedora-version.exp
|
||||
@@ -0,0 +1,22 @@
|
||||
+# Copyright 2023 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# Start with a fresh gdb
|
||||
+clean_restart
|
||||
+
|
||||
+# Check the version string contains either the Fedora or RHEL distro
|
||||
+# name, and that the version number looks roughly correct in format.
|
||||
+gdb_test "show version" \
|
||||
+ "GNU gdb \\((Fedora Linux|Red Hat Enterprise Linux)\\) \[0-9\]+\\.\[0-9\]+-\[0-9\]+.*"
|
||||
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
|
||||
127
gdb-6.5-section-num-fixup-test.patch
Normal file
127
gdb-6.5-section-num-fixup-test.patch
Normal file
@ -0,0 +1,127 @@
|
||||
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-section-num-fixup-test.patch
|
||||
|
||||
;; Test a crash on libraries missing the .text section.
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/datalib-lib.c b/gdb/testsuite/gdb.base/datalib-lib.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/datalib-lib.c
|
||||
@@ -0,0 +1,22 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program; if not, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@prep.ai.mit.edu */
|
||||
+
|
||||
+int var;
|
||||
diff --git a/gdb/testsuite/gdb.base/datalib-main.c b/gdb/testsuite/gdb.base/datalib-main.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/datalib-main.c
|
||||
@@ -0,0 +1,26 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program; if not, write to the Free Software
|
||||
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+ Please email any bugs, comments, and/or additions to this file to:
|
||||
+ bug-gdb@prep.ai.mit.edu */
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/datalib.exp b/gdb/testsuite/gdb.base/datalib.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/datalib.exp
|
||||
@@ -0,0 +1,56 @@
|
||||
+# Copyright 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+if {[use_gdb_stub]} {
|
||||
+ untested "skipping test because of use_gdb_stub"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set testfile datalib
|
||||
+set srcfilemain ${testfile}-main.c
|
||||
+set srcfilelib ${testfile}-lib.c
|
||||
+set libfile [standard_output_file ${testfile}-lib.so]
|
||||
+set binfile [standard_output_file ${testfile}-main]
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfilelib}" "${libfile}" executable [list debug {additional_flags=-shared -nostdlib}]] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfilemain}" "${binfile} ${libfile}" executable {debug}] != "" } {
|
||||
+ untested "Couldn't compile test program"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Get things started.
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+# We must use a separate library as the main executable is compiled to the
|
||||
+# address 0 by default and it would get fixed up already at the end of
|
||||
+# INIT_OBJFILE_SECT_INDICES. We also cannot PRELINK it as PRELINK is missing
|
||||
+# on ia64. The library must be NOSTDLIB as otherwise some stub code would
|
||||
+# create the `.text' section there. Also DEBUG option is useful as some of
|
||||
+# the crashes occur in dwarf2read.c.
|
||||
+
|
||||
+# FAIL case:
|
||||
+# ../../gdb/ia64-tdep.c:2838: internal-error: sect_index_text not initialized
|
||||
+# A problem internal to GDB has been detected,
|
||||
+
|
||||
+gdb_test "start" \
|
||||
+ "main \\(\\) at .*${srcfilemain}.*" \
|
||||
+ "start"
|
||||
278
gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
Normal file
278
gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
Normal file
@ -0,0 +1,278 @@
|
||||
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.6-bz237572-ppc-atomic-sequence-test.patch
|
||||
|
||||
;; Support for stepping over PPC atomic instruction sequences (BZ 237572).
|
||||
;;=fedoratest
|
||||
|
||||
2007-06-25 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.threads/atomic-seq-threaded.c,
|
||||
gdb.threads/atomic-seq-threaded.exp: New files.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/atomic-seq-threaded.c b/gdb/testsuite/gdb.threads/atomic-seq-threaded.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/atomic-seq-threaded.c
|
||||
@@ -0,0 +1,171 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2007 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program; if not, write to the Free Software
|
||||
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
+ MA 02110-1301, USA. */
|
||||
+
|
||||
+/* Test stepping over RISC atomic sequences.
|
||||
+ This variant testcases the code for stepping another thread while skipping
|
||||
+ over the atomic sequence in the former thread
|
||||
+ (STEPPING_PAST_SINGLESTEP_BREAKPOINT).
|
||||
+ Code comes from gcc/testsuite/gcc.dg/sync-2.c */
|
||||
+
|
||||
+/* { dg-options "-march=i486" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
|
||||
+/* { dg-options "-mcpu=v9" { target sparc*-*-* } } */
|
||||
+
|
||||
+/* Test functionality of the intrinsics for 'short' and 'char'. */
|
||||
+
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <pthread.h>
|
||||
+#include <assert.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+#define LOOPS 2
|
||||
+
|
||||
+static int unused;
|
||||
+
|
||||
+static char AI[18];
|
||||
+static char init_qi[18] = { 3,5,7,9,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0 };
|
||||
+static char test_qi[18] = { 3,5,7,9,1,4,22,-12,7,8,9,7,1,-12,7,8,9,7 };
|
||||
+
|
||||
+static void
|
||||
+do_qi (void)
|
||||
+{
|
||||
+ if (__sync_fetch_and_add(AI+4, 1) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_add(AI+5, 4) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_add(AI+6, 22) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_sub(AI+7, 12) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_and(AI+8, 7) != (char)-1)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_or(AI+9, 8) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_xor(AI+10, 9) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_nand(AI+11, 7) != 0)
|
||||
+ abort ();
|
||||
+
|
||||
+ if (__sync_add_and_fetch(AI+12, 1) != 1)
|
||||
+ abort ();
|
||||
+ if (__sync_sub_and_fetch(AI+13, 12) != (char)-12)
|
||||
+ abort ();
|
||||
+ if (__sync_and_and_fetch(AI+14, 7) != 7)
|
||||
+ abort ();
|
||||
+ if (__sync_or_and_fetch(AI+15, 8) != 8)
|
||||
+ abort ();
|
||||
+ if (__sync_xor_and_fetch(AI+16, 9) != 9)
|
||||
+ abort ();
|
||||
+ if (__sync_nand_and_fetch(AI+17, 7) != 7)
|
||||
+ abort ();
|
||||
+}
|
||||
+
|
||||
+static short AL[18];
|
||||
+static short init_hi[18] = { 3,5,7,9,0,0,0,0,-1,0,0,0,0,0,-1,0,0,0 };
|
||||
+static short test_hi[18] = { 3,5,7,9,1,4,22,-12,7,8,9,7,1,-12,7,8,9,7 };
|
||||
+
|
||||
+static void
|
||||
+do_hi (void)
|
||||
+{
|
||||
+ if (__sync_fetch_and_add(AL+4, 1) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_add(AL+5, 4) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_add(AL+6, 22) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_sub(AL+7, 12) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_and(AL+8, 7) != -1)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_or(AL+9, 8) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_xor(AL+10, 9) != 0)
|
||||
+ abort ();
|
||||
+ if (__sync_fetch_and_nand(AL+11, 7) != 0)
|
||||
+ abort ();
|
||||
+
|
||||
+ if (__sync_add_and_fetch(AL+12, 1) != 1)
|
||||
+ abort ();
|
||||
+ if (__sync_sub_and_fetch(AL+13, 12) != -12)
|
||||
+ abort ();
|
||||
+ if (__sync_and_and_fetch(AL+14, 7) != 7)
|
||||
+ abort ();
|
||||
+ if (__sync_or_and_fetch(AL+15, 8) != 8)
|
||||
+ abort ();
|
||||
+ if (__sync_xor_and_fetch(AL+16, 9) != 9)
|
||||
+ abort ();
|
||||
+ if (__sync_nand_and_fetch(AL+17, 7) != 7)
|
||||
+ abort ();
|
||||
+}
|
||||
+
|
||||
+static void *
|
||||
+start1 (void *arg)
|
||||
+{
|
||||
+ unsigned loop;
|
||||
+ sleep(1);
|
||||
+
|
||||
+ for (loop = 0; loop < LOOPS; loop++)
|
||||
+ {
|
||||
+ memcpy(AI, init_qi, sizeof(init_qi));
|
||||
+
|
||||
+ do_qi ();
|
||||
+
|
||||
+ if (memcmp (AI, test_qi, sizeof(test_qi)))
|
||||
+ abort ();
|
||||
+ }
|
||||
+
|
||||
+ return arg; /* _delete1_ */
|
||||
+}
|
||||
+
|
||||
+static void *
|
||||
+start2 (void *arg)
|
||||
+{
|
||||
+ unsigned loop;
|
||||
+
|
||||
+ for (loop = 0; loop < LOOPS; loop++)
|
||||
+ {
|
||||
+ memcpy(AL, init_hi, sizeof(init_hi));
|
||||
+
|
||||
+ do_hi ();
|
||||
+
|
||||
+ if (memcmp (AL, test_hi, sizeof(test_hi)))
|
||||
+ abort ();
|
||||
+ }
|
||||
+
|
||||
+ return arg; /* _delete2_ */
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (int argc, char **argv)
|
||||
+{
|
||||
+ pthread_t thread;
|
||||
+ int i;
|
||||
+
|
||||
+ i = pthread_create (&thread, NULL, start1, NULL); /* _create_ */
|
||||
+ assert (i == 0); /* _create_after_ */
|
||||
+
|
||||
+ sleep (1);
|
||||
+
|
||||
+ start2 (NULL);
|
||||
+
|
||||
+ i = pthread_join (thread, NULL); /* _delete_ */
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ return 0; /* _exit_ */
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp b/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/atomic-seq-threaded.exp
|
||||
@@ -0,0 +1,84 @@
|
||||
+# atomic-seq-threaded.exp -- Test case for stepping over RISC atomic code seqs.
|
||||
+# This variant testcases the code for stepping another thread while skipping
|
||||
+# over the atomic sequence in the former thread
|
||||
+# (STEPPING_PAST_SINGLESTEP_BREAKPOINT).
|
||||
+# Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+# Please email any bugs, comments, and/or additions to this file to:
|
||||
+# bug-gdb@prep.ai.mit.edu
|
||||
+
|
||||
+set testfile atomic-seq-threaded
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+foreach opts {{} {compiler=gcc4} {FAIL}} {
|
||||
+ if {$opts eq "FAIL"} {
|
||||
+ return -1
|
||||
+ }
|
||||
+ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $opts]] eq "" } {
|
||||
+ break
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+
|
||||
+gdb_load ${binfile}
|
||||
+if ![runto_main] then {
|
||||
+ fail "Can't run to main"
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+# pthread_create () will not pass even on x86_64 with software watchpoint.
|
||||
+# Pass after pthread_create () without any watchpoint active.
|
||||
+set line [gdb_get_line_number "_create_after_"]
|
||||
+gdb_test "tbreak $line" \
|
||||
+ "reakpoint (\[0-9\]+) at .*$srcfile, line $line\..*" \
|
||||
+ "set breakpoint after pthread_create ()"
|
||||
+gdb_test "c" \
|
||||
+ ".*/\\* _create_after_ \\*/.*" \
|
||||
+ "run till after pthread_create ()"
|
||||
+
|
||||
+# Without a watchpoint being software no single-stepping would be used.
|
||||
+set test "Start (software) watchpoint"
|
||||
+gdb_test_multiple "watch unused" $test {
|
||||
+ -re "Watchpoint \[0-9\]+: unused.*$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "Hardware watchpoint \[0-9\]+: unused.*$gdb_prompt $" {
|
||||
+ # We do not test the goal but still the whole testcase should pass.
|
||||
+ unsupported $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# More thorough testing of the scheduling logic.
|
||||
+gdb_test "set scheduler-locking step" ""
|
||||
+
|
||||
+# Critical code path is stepped through at this point.
|
||||
+set line [gdb_get_line_number "_exit_"]
|
||||
+gdb_test "tbreak $line" \
|
||||
+ "reakpoint \[0-9\]+ at .*$srcfile, line $line\..*" \
|
||||
+ "set breakpoint at _exit_"
|
||||
+gdb_test "c" \
|
||||
+ ".*/\\* _exit_ \\*/.*" \
|
||||
+ "run till _exit_"
|
||||
+
|
||||
+# Just a nonproblematic program exit.
|
||||
+gdb_test "c" \
|
||||
+ ".*Program exited normally\\..*" \
|
||||
+ "run till program exit"
|
||||
481
gdb-6.8-bz466901-backtrace-full-prelinked.patch
Normal file
481
gdb-6.8-bz466901-backtrace-full-prelinked.patch
Normal file
@ -0,0 +1,481 @@
|
||||
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.8-bz466901-backtrace-full-prelinked.patch
|
||||
|
||||
;; Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
|
||||
;;=fedoratest
|
||||
|
||||
Fix resolving of variables at locations lists in prelinked libs (BZ 466901).
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S
|
||||
@@ -0,0 +1,328 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/*
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+void
|
||||
+func (void)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ abort ();
|
||||
+}
|
||||
+*/
|
||||
+ .file "dw2-loclist-prelinked.c"
|
||||
+ .section .debug_abbrev,"",@progbits
|
||||
+.Ldebug_abbrev0:
|
||||
+ .section .debug_info,"",@progbits
|
||||
+.Ldebug_info0:
|
||||
+ .section .debug_line,"",@progbits
|
||||
+.Ldebug_line0:
|
||||
+ .text
|
||||
+.Ltext0:
|
||||
+.globl func
|
||||
+ .type func, @function
|
||||
+func:
|
||||
+.LFB2:
|
||||
+ .file 1 "dw2-loclist-prelinked.c"
|
||||
+ .loc 1 5 0
|
||||
+ pushl %ebp
|
||||
+.LCFI0:
|
||||
+ movl %esp, %ebp
|
||||
+.LCFI1:
|
||||
+ subl $24, %esp
|
||||
+.LCFI2:
|
||||
+ .loc 1 8 0
|
||||
+ call abort
|
||||
+.LFE2:
|
||||
+ .size func, .-func
|
||||
+ .section .debug_frame,"",@progbits
|
||||
+.Lframe0:
|
||||
+ .long .LECIE0-.LSCIE0
|
||||
+.LSCIE0:
|
||||
+ .long 0xffffffff
|
||||
+ .byte 0x1
|
||||
+ .string ""
|
||||
+ .uleb128 0x1
|
||||
+ .sleb128 -4
|
||||
+ .byte 0x8
|
||||
+ .byte 0xc
|
||||
+ .uleb128 0x4
|
||||
+ .uleb128 0x4
|
||||
+ .byte 0x88
|
||||
+ .uleb128 0x1
|
||||
+ .align 4
|
||||
+.LECIE0:
|
||||
+.LSFDE0:
|
||||
+ .long .LEFDE0-.LASFDE0
|
||||
+.LASFDE0:
|
||||
+ .long .Lframe0
|
||||
+ .long .LFB2
|
||||
+ .long .LFE2-.LFB2
|
||||
+ .byte 0x4
|
||||
+ .long .LCFI0-.LFB2
|
||||
+ .byte 0xe
|
||||
+ .uleb128 0x8
|
||||
+ .byte 0x85
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x4
|
||||
+ .long .LCFI1-.LCFI0
|
||||
+ .byte 0xd
|
||||
+ .uleb128 0x5
|
||||
+ .align 4
|
||||
+.LEFDE0:
|
||||
+ .text
|
||||
+.Letext0:
|
||||
+ .section .debug_loc,"",@progbits
|
||||
+.Ldebug_loc0:
|
||||
+.LLST0:
|
||||
+ .long .LFB2-.Ltext0
|
||||
+ .long .LCFI0-.Ltext0
|
||||
+ .value 0x2
|
||||
+ .byte 0x74
|
||||
+ .sleb128 4
|
||||
+ .long .LCFI0-.Ltext0
|
||||
+ .long .LCFI1-.Ltext0
|
||||
+ .value 0x2
|
||||
+ .byte 0x74
|
||||
+ .sleb128 8
|
||||
+ .long .LCFI1-.Ltext0
|
||||
+ .long .LFE2-.Ltext0
|
||||
+ .value 0x2
|
||||
+ .byte 0x75
|
||||
+ .sleb128 8
|
||||
+ .long 0x0
|
||||
+ .long 0x0
|
||||
+ .section .debug_info
|
||||
+ .long 0x94
|
||||
+ .value 0x2
|
||||
+ .long .Ldebug_abbrev0
|
||||
+ .byte 0x4
|
||||
+ .uleb128 0x1
|
||||
+ .long .LASF10
|
||||
+ .byte 0x1
|
||||
+ .long .LASF11
|
||||
+ .long .LASF12
|
||||
+ .long .Ltext0
|
||||
+ .long .Letext0
|
||||
+ .long .Ldebug_line0
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x4
|
||||
+ .byte 0x7
|
||||
+ .long .LASF0
|
||||
+ .uleb128 0x3
|
||||
+ .byte 0x4
|
||||
+ .byte 0x5
|
||||
+ .string "int"
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x4
|
||||
+ .byte 0x5
|
||||
+ .long .LASF1
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x1
|
||||
+ .byte 0x8
|
||||
+ .long .LASF2
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x2
|
||||
+ .byte 0x7
|
||||
+ .long .LASF3
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x4
|
||||
+ .byte 0x7
|
||||
+ .long .LASF4
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x1
|
||||
+ .byte 0x6
|
||||
+ .long .LASF5
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x2
|
||||
+ .byte 0x5
|
||||
+ .long .LASF6
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x8
|
||||
+ .byte 0x5
|
||||
+ .long .LASF7
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x8
|
||||
+ .byte 0x7
|
||||
+ .long .LASF8
|
||||
+ .uleb128 0x4
|
||||
+ .byte 0x4
|
||||
+ .byte 0x7
|
||||
+ .uleb128 0x2
|
||||
+ .byte 0x1
|
||||
+ .byte 0x6
|
||||
+ .long .LASF9
|
||||
+ .uleb128 0x5
|
||||
+ .byte 0x1
|
||||
+ .long .LASF13
|
||||
+ .byte 0x1
|
||||
+ .byte 0x5
|
||||
+ .byte 0x1
|
||||
+ .long .LFB2
|
||||
+ .long .LFE2
|
||||
+ .long .LLST0
|
||||
+ .uleb128 0x6
|
||||
+ .string "i"
|
||||
+ .byte 0x1
|
||||
+ .byte 0x6
|
||||
+ .long 0x2c
|
||||
+ .byte 0x2
|
||||
+ .byte 0x91
|
||||
+ .sleb128 -12
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .section .debug_abbrev
|
||||
+ .uleb128 0x1
|
||||
+ .uleb128 0x11
|
||||
+ .byte 0x1
|
||||
+ .uleb128 0x25
|
||||
+ .uleb128 0xe
|
||||
+ .uleb128 0x13
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3
|
||||
+ .uleb128 0xe
|
||||
+ .uleb128 0x1b
|
||||
+ .uleb128 0xe
|
||||
+ .uleb128 0x11
|
||||
+ .uleb128 0x1
|
||||
+ .uleb128 0x12
|
||||
+ .uleb128 0x1
|
||||
+ .uleb128 0x10
|
||||
+ .uleb128 0x6
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x2
|
||||
+ .uleb128 0x24
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3e
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3
|
||||
+ .uleb128 0xe
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x3
|
||||
+ .uleb128 0x24
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3e
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3
|
||||
+ .uleb128 0x8
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x4
|
||||
+ .uleb128 0x24
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3e
|
||||
+ .uleb128 0xb
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x5
|
||||
+ .uleb128 0x2e
|
||||
+ .byte 0x1
|
||||
+ .uleb128 0x3f
|
||||
+ .uleb128 0xc
|
||||
+ .uleb128 0x3
|
||||
+ .uleb128 0xe
|
||||
+ .uleb128 0x3a
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3b
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x27
|
||||
+ .uleb128 0xc
|
||||
+ .uleb128 0x11
|
||||
+ .uleb128 0x1
|
||||
+ .uleb128 0x12
|
||||
+ .uleb128 0x1
|
||||
+ .uleb128 0x40
|
||||
+ .uleb128 0x6
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x6
|
||||
+ .uleb128 0x34
|
||||
+ .byte 0x0
|
||||
+ .uleb128 0x3
|
||||
+ .uleb128 0x8
|
||||
+ .uleb128 0x3a
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x3b
|
||||
+ .uleb128 0xb
|
||||
+ .uleb128 0x49
|
||||
+ .uleb128 0x13
|
||||
+ .uleb128 0x2
|
||||
+ .uleb128 0xa
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .byte 0x0
|
||||
+ .section .debug_pubnames,"",@progbits
|
||||
+ .long 0x17
|
||||
+ .value 0x2
|
||||
+ .long .Ldebug_info0
|
||||
+ .long 0x98
|
||||
+ .long 0x75
|
||||
+ .string "func"
|
||||
+ .long 0x0
|
||||
+ .section .debug_aranges,"",@progbits
|
||||
+ .long 0x1c
|
||||
+ .value 0x2
|
||||
+ .long .Ldebug_info0
|
||||
+ .byte 0x4
|
||||
+ .byte 0x0
|
||||
+ .value 0x0
|
||||
+ .value 0x0
|
||||
+ .long .Ltext0
|
||||
+ .long .Letext0-.Ltext0
|
||||
+ .long 0x0
|
||||
+ .long 0x0
|
||||
+ .section .debug_str,"MS",@progbits,1
|
||||
+.LASF7:
|
||||
+ .string "long long int"
|
||||
+.LASF0:
|
||||
+ .string "unsigned int"
|
||||
+.LASF11:
|
||||
+ .string "dw2-loclist-prelinked.c"
|
||||
+.LASF12:
|
||||
+ .string "gdb-6.8/gdb/testsuite/gdb.dwarf2"
|
||||
+.LASF4:
|
||||
+ .string "long unsigned int"
|
||||
+.LASF8:
|
||||
+ .string "long long unsigned int"
|
||||
+.LASF2:
|
||||
+ .string "unsigned char"
|
||||
+.LASF9:
|
||||
+ .string "char"
|
||||
+.LASF1:
|
||||
+ .string "long int"
|
||||
+.LASF3:
|
||||
+ .string "short unsigned int"
|
||||
+.LASF5:
|
||||
+ .string "signed char"
|
||||
+.LASF10:
|
||||
+ .string "GNU C 4.3.2 20081007 (Red Hat 4.3.2-6)"
|
||||
+.LASF13:
|
||||
+ .string "func"
|
||||
+.LASF6:
|
||||
+ .string "short int"
|
||||
+ .ident "GCC: (GNU) 4.3.2 20081007 (Red Hat 4.3.2-6)"
|
||||
+ .section .note.GNU-stack,"",@progbits
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c
|
||||
@@ -0,0 +1,26 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2008 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 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/>. */
|
||||
+
|
||||
+/* dw2-loclist-prelinked-func.S */
|
||||
+extern void func (void);
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ func ();
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked.exp
|
||||
@@ -0,0 +1,102 @@
|
||||
+# 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.
|
||||
+
|
||||
+# Minimal DWARF-2 unit test
|
||||
+
|
||||
+# This test can only be run on i386/x86_64 targets which support DWARF-2.
|
||||
+# For now pick a sampling of likely targets.
|
||||
+if {(![istarget *-*-linux*]
|
||||
+ && ![istarget *-*-gnu*]
|
||||
+ && ![istarget *-*-elf*]
|
||||
+ && ![istarget *-*-openbsd*])
|
||||
+ || (![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"])} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+set testfile "dw2-loclist-prelinked"
|
||||
+set srcfuncfile ${testfile}-func.S
|
||||
+set binsharedfuncfile [standard_output_file ${testfile}.so]
|
||||
+set srcmainfile ${testfile}-main.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+remote_exec build "rm -f ${binfile}"
|
||||
+
|
||||
+# get the value of gcc_compiled
|
||||
+if [get_compiler_info ${binfile}] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# This test can only be run on gcc as we use additional_flags=FIXME
|
||||
+if {$gcc_compiled == 0} {
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfuncfile}" "${binsharedfuncfile}" {debug additional_flags=-m32}] != "" } {
|
||||
+ untested "Couldn't compile test library"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# The new separate debug info file will be stored in the .debug subdirectory.
|
||||
+
|
||||
+if [gdb_gnu_strip_debug ${binsharedfuncfile}] {
|
||||
+ # check that you have a recent version of strip and objcopy installed
|
||||
+ unsupported "cannot produce separate debug info files"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if {[catch "system \"/usr/sbin/prelink -qNR --no-exec-shield ${binsharedfuncfile}\""] != 0} {
|
||||
+ # Maybe we don't have prelink.
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" \
|
||||
+ "${binfile}" executable [list debug additional_flags=-m32 shlib=${binsharedfuncfile}]] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load ${binfile}
|
||||
+
|
||||
+gdb_run_cmd
|
||||
+
|
||||
+gdb_test "" "Program received signal SIGABRT, Aborted..*" "Enter abort()"
|
||||
+
|
||||
+# Incorrect:
|
||||
+# #0 0x00110430 in __kernel_vsyscall ()
|
||||
+# No symbol table info available.
|
||||
+# #1 0x003d44c0 in raise () from /lib/libc.so.6
|
||||
+# No symbol table info available.
|
||||
+# #2 0x003d5e88 in abort () from /lib/libc.so.6
|
||||
+# No symbol table info available.
|
||||
+# #3 0x44f10437 in func () at dw2-loclist-prelinked.c:8
|
||||
+# i = Could not find the frame base for "func".
|
||||
+
|
||||
+# Correct:
|
||||
+# #0 0x00110430 in __kernel_vsyscall ()
|
||||
+# No symbol table info available.
|
||||
+# #1 0x003d44c0 in raise () from /lib/libc.so.6
|
||||
+# No symbol table info available.
|
||||
+# #2 0x003d5e88 in abort () from /lib/libc.so.6
|
||||
+# No symbol table info available.
|
||||
+# #3 0x4ae36437 in func () at dw2-loclist-prelinked.c:8
|
||||
+# i = 3827288
|
||||
+# #4 0x0804851a in main () at ../../../gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-main.c:24
|
||||
+# No locals.
|
||||
+
|
||||
+# `abort' can get expressed as `*__GI_abort'.
|
||||
+gdb_test "bt full" "in \[^ \]*abort \\(.*in func \\(.*\r\n\[\t \]+i = -?\[0-9\].*in main \\(.*" "Backtrace after abort()"
|
||||
77
gdb-add-index.patch
Normal file
77
gdb-add-index.patch
Normal file
@ -0,0 +1,77 @@
|
||||
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-add-index.patch
|
||||
|
||||
;; Update gdb-add-index.sh such that, when the GDB environment
|
||||
;; variable is not set, the script is smarter than just looking for
|
||||
;; 'gdb' in the $PATH.
|
||||
;;
|
||||
;; The actual search order is now: /usr/bin/gdb.minimal, gdb (in the
|
||||
;; $PATH), then /usr/libexec/gdb.
|
||||
;;
|
||||
;; For the rationale of looking for gdb.minimal see:
|
||||
;;
|
||||
;; https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot
|
||||
;;
|
||||
;;=fedora
|
||||
|
||||
diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh
|
||||
--- a/gdb/contrib/gdb-add-index.sh
|
||||
+++ b/gdb/contrib/gdb-add-index.sh
|
||||
@@ -16,14 +16,52 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-# This program assumes gdb and objcopy are in $PATH.
|
||||
-# If not, or you want others, pass the following in the environment
|
||||
-GDB=${GDB:=gdb}
|
||||
+# This program assumes objcopy and readelf are in $PATH. If not, or
|
||||
+# you want others, pass the following in the environment
|
||||
OBJCOPY=${OBJCOPY:=objcopy}
|
||||
READELF=${READELF:=readelf}
|
||||
|
||||
myname="${0##*/}"
|
||||
|
||||
+# For GDB itself we need to be a little smarter. If GDB is set in the
|
||||
+# environment then we will use that. But if GDB is not set in the
|
||||
+# environment then we have a couple of options that we need to check
|
||||
+# through.
|
||||
+#
|
||||
+# Our default choice is for /usr/bin/gdb.minimal. For an explanation
|
||||
+# of why this is chosen, check out:
|
||||
+# https://bugzilla.redhat.com/show_bug.cgi?id=1695015
|
||||
+# https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot
|
||||
+#
|
||||
+# If gdb.minimal is not found then we look for a 'gdb' executable on
|
||||
+# the path.
|
||||
+#
|
||||
+# And finally, we check for /usr/libexec/gdb.
|
||||
+#
|
||||
+# If none of those result in a useable GDB then we give an error and
|
||||
+# exit.
|
||||
+if test -z "$GDB"; then
|
||||
+ for possible_gdb in /usr/bin/gdb.minimal gdb /usr/libexec/gdb; do
|
||||
+ if ! command -v "$possible_gdb" >/dev/null 2>&1; then
|
||||
+ continue
|
||||
+ fi
|
||||
+
|
||||
+ possible_gdb=$(command -v "$possible_gdb")
|
||||
+
|
||||
+ if ! test -x "$possible_gdb"; then
|
||||
+ continue
|
||||
+ fi
|
||||
+
|
||||
+ GDB="$possible_gdb"
|
||||
+ break
|
||||
+ done
|
||||
+
|
||||
+ if test -z "$GDB"; then
|
||||
+ echo "$myname: Failed to find a useable GDB binary" 1>&2
|
||||
+ exit 1
|
||||
+ fi
|
||||
+fi
|
||||
+
|
||||
dwarf5=""
|
||||
if [ "$1" = "-dwarf-5" ]; then
|
||||
dwarf5="$1"
|
||||
1009
gdb-add-rpm-suggestion-script.patch
Normal file
1009
gdb-add-rpm-suggestion-script.patch
Normal file
File diff suppressed because it is too large
Load Diff
88
gdb-archer-next-over-throw-cxx-exec.patch
Normal file
88
gdb-archer-next-over-throw-cxx-exec.patch
Normal file
@ -0,0 +1,88 @@
|
||||
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-archer-next-over-throw-cxx-exec.patch
|
||||
|
||||
;; Fix follow-exec for C++ programs (bugreported by Martin Stransky).
|
||||
;;=fedoratest
|
||||
|
||||
Archer-upstreamed:
|
||||
http://sourceware.org/ml/archer/2010-q2/msg00031.html
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.cp/cxxexec.cc b/gdb/testsuite/gdb.cp/cxxexec.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/cxxexec.cc
|
||||
@@ -0,0 +1,25 @@
|
||||
+/* This test script is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+int
|
||||
+main()
|
||||
+{
|
||||
+ execlp ("true", "true", NULL);
|
||||
+ return 1;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.cp/cxxexec.exp b/gdb/testsuite/gdb.cp/cxxexec.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.cp/cxxexec.exp
|
||||
@@ -0,0 +1,42 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+require allow_cplus_tests
|
||||
+
|
||||
+set testfile cxxexec
|
||||
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.cc {c++ debug}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+runto_main
|
||||
+
|
||||
+# We could stop after `continue' again at `main'.
|
||||
+delete_breakpoints
|
||||
+
|
||||
+set test "p _Unwind_DebugHook"
|
||||
+gdb_test_multiple $test $test {
|
||||
+ -re " = .* 0x\[0-9a-f\].*\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "\r\nNo symbol .*\r\n$gdb_prompt $" {
|
||||
+ xfail $test
|
||||
+ untested ${testfile}.exp
|
||||
+ return -1
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# Run to end. The buggy GDB failed instead with:
|
||||
+# Cannot access memory at address ADDR.
|
||||
+gdb_continue_to_end "" "continue" 1
|
||||
48
gdb-gstack.man
Normal file
48
gdb-gstack.man
Normal file
@ -0,0 +1,48 @@
|
||||
.\"
|
||||
.\" gstack manual page.
|
||||
.\" Copyright (c) 1999 Ross Thompson
|
||||
.\" Copyright (c) 2001, 2002, 2004, 2008 Red Hat, Inc.
|
||||
.\"
|
||||
.\" Original author: Ross Thompson <ross@whatsis.com>
|
||||
.\"
|
||||
.\" This program is free software; you can redistribute it and/or modify
|
||||
.\" it under the terms of the GNU General Public License as published by
|
||||
.\" the Free Software Foundation; either version 2, or (at your option)
|
||||
.\" any later version.
|
||||
.\"
|
||||
.\" This program is distributed in the hope that it will be useful,
|
||||
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
.\" GNU General Public License for more details.
|
||||
.\"
|
||||
.\" You should have received a copy of the GNU General Public License
|
||||
.\" along with this program; see the file COPYING. If not, write to
|
||||
.\" the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
.\" Boston, MA 02111-1307, USA.
|
||||
.\"
|
||||
.TH GSTACK 1 "Feb 15 2008" "Red Hat Linux" "Linux Programmer's Manual"
|
||||
|
||||
.SH NAME
|
||||
gstack \- print a stack trace of a running process
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B gstack
|
||||
pid
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
\f3gstack\f1 attaches to the active process named by the \f3pid\f1 on
|
||||
the command line, and prints out an execution stack trace. If ELF
|
||||
symbols exist in the binary (usually the case unless you have run
|
||||
strip(1)), then symbolic addresses are printed as well.
|
||||
|
||||
If the process is part of a thread group, then \f3gstack\f1 will print
|
||||
out a stack trace for each of the threads in the group.
|
||||
|
||||
.SH SEE ALSO
|
||||
nm(1), ptrace(2), gdb(1)
|
||||
|
||||
.SH AUTHORS
|
||||
Ross Thompson <ross@whatsis.com>
|
||||
|
||||
Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
|
||||
752
gdb-orphanripper.c
Normal file
752
gdb-orphanripper.c
Normal file
@ -0,0 +1,752 @@
|
||||
/*
|
||||
* Copyright 2006-2007 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Reap any leftover children possibly holding file descriptors.
|
||||
* Children are identified by the stale file descriptor or PGID / SID.
|
||||
* Both can be missed but only the stale file descriptors are important for us.
|
||||
* PGID / SID may be set by the children on their own.
|
||||
* If we fine a candidate we kill it will all its process tree (grandchildren).
|
||||
* The child process is run with `2>&1' redirection (due to forkpty(3)).
|
||||
* 2007-07-10 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
*/
|
||||
|
||||
/* For getpgid(2). */
|
||||
#define _GNU_SOURCE 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <fcntl.h>
|
||||
#include <assert.h>
|
||||
#include <pty.h>
|
||||
#include <poll.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define LENGTH(x) (sizeof (x) / sizeof (*(x)))
|
||||
|
||||
static const char *progname;
|
||||
|
||||
static volatile pid_t child;
|
||||
|
||||
static void signal_chld (int signo)
|
||||
{
|
||||
}
|
||||
|
||||
static volatile int signal_alrm_hit = 0;
|
||||
|
||||
static void signal_alrm (int signo)
|
||||
{
|
||||
signal_alrm_hit = 1;
|
||||
}
|
||||
|
||||
static char childptyname[LINE_MAX];
|
||||
|
||||
static void print_child_error (const char *reason, char **argv)
|
||||
{
|
||||
char **sp;
|
||||
|
||||
fprintf (stderr, "%s: %d %s:", progname, (int) child, reason);
|
||||
for (sp = argv; *sp != NULL; sp++)
|
||||
{
|
||||
fputc (' ', stderr);
|
||||
fputs (*sp, stderr);
|
||||
}
|
||||
fputc ('\n', stderr);
|
||||
}
|
||||
|
||||
static int read_out (int amaster)
|
||||
{
|
||||
char buf[LINE_MAX];
|
||||
ssize_t buf_got;
|
||||
|
||||
buf_got = read (amaster, buf, sizeof buf);
|
||||
if (buf_got == 0)
|
||||
return 0;
|
||||
/* Weird but at least after POLLHUP we get EIO instead of just EOF. */
|
||||
if (buf_got == -1 && errno == EIO)
|
||||
return 0;
|
||||
if (buf_got == -1 && errno == EAGAIN)
|
||||
return 0;
|
||||
if (buf_got < 0)
|
||||
{
|
||||
perror ("read (amaster)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
if (write (STDOUT_FILENO, buf, buf_got) != buf_got)
|
||||
{
|
||||
perror ("write(2)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* kill (child, 0) == 0 sometimes even when CHILD's state is already "Z". */
|
||||
|
||||
static int child_exited (void)
|
||||
{
|
||||
char buf[200];
|
||||
int fd, i, retval;
|
||||
ssize_t got;
|
||||
char state[3];
|
||||
|
||||
snprintf (buf, sizeof (buf), "/proc/%ld/stat", (long) child);
|
||||
fd = open (buf, O_RDONLY);
|
||||
if (fd == -1)
|
||||
{
|
||||
perror ("open (/proc/CHILD/stat)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
got = read (fd, buf, sizeof(buf));
|
||||
if (got <= 0)
|
||||
{
|
||||
perror ("read (/proc/CHILD/stat)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
if (close (fd) != 0)
|
||||
{
|
||||
perror ("close (/proc/CHILD/stat)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
/* RHEL-5 does not support %ms. */
|
||||
i = sscanf (buf, "%*d%*s%2s", state);
|
||||
if (i != 1)
|
||||
{
|
||||
perror ("sscanf (/proc/CHILD/stat)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
retval = strcmp (state, "Z") == 0;
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int spawn (char **argv, int timeout)
|
||||
{
|
||||
pid_t child_got;
|
||||
int status, amaster, i, rc;
|
||||
struct sigaction act;
|
||||
sigset_t set;
|
||||
struct termios termios;
|
||||
unsigned alarm_orig;
|
||||
|
||||
/* We do not use signal(2) to be sure we do not have SA_RESTART. */
|
||||
memset (&act, 0, sizeof (act));
|
||||
act.sa_handler = signal_chld;
|
||||
i = sigemptyset (&act.sa_mask);
|
||||
assert (i == 0);
|
||||
act.sa_flags = 0; /* !SA_RESTART */
|
||||
i = sigaction (SIGCHLD, &act, NULL);
|
||||
assert (i == 0);
|
||||
|
||||
i = sigemptyset (&set);
|
||||
assert (i == 0);
|
||||
i = sigaddset (&set, SIGCHLD);
|
||||
assert (i == 0);
|
||||
i = sigprocmask (SIG_SETMASK, &set, NULL);
|
||||
assert (i == 0);
|
||||
|
||||
/* With TERMP passed as NULL we get "\n" -> "\r\n". */
|
||||
termios.c_iflag = IGNBRK | IGNPAR;
|
||||
termios.c_oflag = 0;
|
||||
termios.c_cflag = CS8 | CREAD | CLOCAL | HUPCL | B9600;
|
||||
termios.c_lflag = IEXTEN | NOFLSH;
|
||||
memset (termios.c_cc, _POSIX_VDISABLE, sizeof (termios.c_cc));
|
||||
termios.c_cc[VTIME] = 0;
|
||||
termios.c_cc[VMIN ] = 1;
|
||||
cfmakeraw (&termios);
|
||||
#ifdef FLUSHO
|
||||
/* Workaround a readline deadlock bug in _get_tty_settings(). */
|
||||
termios.c_lflag &= ~FLUSHO;
|
||||
#endif
|
||||
child = forkpty (&amaster, childptyname, &termios, NULL);
|
||||
switch (child)
|
||||
{
|
||||
case -1:
|
||||
perror ("forkpty(3)");
|
||||
exit (EXIT_FAILURE);
|
||||
case 0:
|
||||
/* Do not replace STDIN as inferiors query its termios. */
|
||||
#if 0
|
||||
i = close (STDIN_FILENO);
|
||||
assert (i == 0);
|
||||
i = open ("/dev/null", O_RDONLY);
|
||||
assert (i == STDIN_FILENO);
|
||||
#endif
|
||||
|
||||
i = sigemptyset (&set);
|
||||
assert (i == 0);
|
||||
i = sigprocmask (SIG_SETMASK, &set, NULL);
|
||||
assert (i == 0);
|
||||
|
||||
/* Do not setpgrp(2) in the parent process as the process-group
|
||||
is shared for the whole sh(1) pipeline we could be a part
|
||||
of. The process-group is set according to PID of the first
|
||||
command in the pipeline.
|
||||
We would rip even vi(1) in the case of:
|
||||
./orphanripper sh -c 'sleep 1&' | vi -
|
||||
*/
|
||||
/* Do not setpgrp(2) as our pty would not be ours and we would
|
||||
get `SIGSTOP' later, particularly after spawning gdb(1).
|
||||
setsid(3) was already executed by forkpty(3) and it would fail if
|
||||
executed again. */
|
||||
if (getpid() != getpgrp ())
|
||||
{
|
||||
perror ("getpgrp(2)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
execvp (argv[0], argv);
|
||||
perror ("execvp(2)");
|
||||
exit (EXIT_FAILURE);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
i = fcntl (amaster, F_SETFL, O_RDWR | O_NONBLOCK);
|
||||
if (i != 0)
|
||||
{
|
||||
perror ("fcntl (amaster, F_SETFL, O_NONBLOCK)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* We do not use signal(2) to be sure we do not have SA_RESTART. */
|
||||
act.sa_handler = signal_alrm;
|
||||
i = sigaction (SIGALRM, &act, NULL);
|
||||
assert (i == 0);
|
||||
|
||||
alarm_orig = alarm (timeout);
|
||||
assert (alarm_orig == 0);
|
||||
|
||||
i = sigemptyset (&set);
|
||||
assert (i == 0);
|
||||
|
||||
while (!signal_alrm_hit)
|
||||
{
|
||||
struct pollfd pollfd;
|
||||
|
||||
pollfd.fd = amaster;
|
||||
pollfd.events = POLLIN;
|
||||
i = ppoll (&pollfd, 1, NULL, &set);
|
||||
if (i == -1 && errno == EINTR)
|
||||
{
|
||||
if (child_exited ())
|
||||
break;
|
||||
/* Non-CHILD child may have exited. */
|
||||
continue;
|
||||
}
|
||||
assert (i == 1);
|
||||
/* Data available? Process it first. */
|
||||
if (pollfd.revents & POLLIN)
|
||||
{
|
||||
if (!read_out (amaster))
|
||||
{
|
||||
fprintf (stderr, "%s: Unexpected EOF\n", progname);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
if (pollfd.revents & POLLHUP)
|
||||
break;
|
||||
if ((pollfd.revents &= ~POLLIN) != 0)
|
||||
{
|
||||
fprintf (stderr, "%s: ppoll(2): revents 0x%x\n", progname,
|
||||
(unsigned) pollfd.revents);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
/* Child exited? */
|
||||
if (child_exited ())
|
||||
break;
|
||||
}
|
||||
|
||||
if (signal_alrm_hit)
|
||||
{
|
||||
i = kill (child, SIGKILL);
|
||||
assert (i == 0);
|
||||
}
|
||||
else
|
||||
alarm (0);
|
||||
|
||||
/* WNOHANG still could fail. */
|
||||
child_got = waitpid (child, &status, 0);
|
||||
if (child != child_got)
|
||||
{
|
||||
fprintf (stderr, "waitpid (%d) = %d: %m\n", (int) child, (int) child_got);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
if (signal_alrm_hit)
|
||||
{
|
||||
char *buf;
|
||||
|
||||
if (asprintf (&buf, "Timed out after %d seconds", timeout) != -1)
|
||||
{
|
||||
print_child_error (buf, argv);
|
||||
free (buf);
|
||||
}
|
||||
rc = 128 + SIGALRM;
|
||||
}
|
||||
else if (WIFEXITED (status))
|
||||
rc = WEXITSTATUS (status);
|
||||
else if (WIFSIGNALED (status))
|
||||
{
|
||||
print_child_error (strsignal (WTERMSIG (status)), argv);
|
||||
rc = 128 + WTERMSIG (status);
|
||||
}
|
||||
else if (WIFSTOPPED (status))
|
||||
{
|
||||
fprintf (stderr, "waitpid (%d): WIFSTOPPED - WSTOPSIG is %d\n",
|
||||
(int) child, WSTOPSIG (status));
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "waitpid (%d): !WIFEXITED (%d)\n", (int) child, status);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Not used in fact. */
|
||||
i = sigprocmask (SIG_SETMASK, &set, NULL);
|
||||
assert (i == 0);
|
||||
|
||||
/* Do not unset O_NONBLOCK as a stale child (the whole purpose of this
|
||||
program) having open its output pty would block us in read_out. */
|
||||
#if 0
|
||||
i = fcntl (amaster, F_SETFL, O_RDONLY /* !O_NONBLOCK */);
|
||||
if (i != 0)
|
||||
{
|
||||
perror ("fcntl (amaster, F_SETFL, O_RDONLY /* !O_NONBLOCK */)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
while (read_out (amaster));
|
||||
|
||||
/* Do not close the master FD as the child would have `/dev/pts/23 (deleted)'
|
||||
entries which are not expected (and expecting ` (deleted)' would be
|
||||
a race. */
|
||||
#if 0
|
||||
i = close (amaster);
|
||||
if (i != 0)
|
||||
{
|
||||
perror ("close (forkpty ()'s amaster)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Detected commandline may look weird due to a race:
|
||||
Original command:
|
||||
./orphanripper sh -c 'sleep 1&' &
|
||||
Correct output:
|
||||
[1] 29610
|
||||
./orphanripper: Killed -9 orphan PID 29612 (PGID 29611): sleep 1
|
||||
Raced output (sh(1) child still did not update its argv[]):
|
||||
[1] 29613
|
||||
./orphanripper: Killed -9 orphan PID 29615 (PGID 29614): sh -c sleep 1&
|
||||
We could delay a bit before ripping the children. */
|
||||
static const char *read_cmdline (pid_t pid)
|
||||
{
|
||||
char cmdline_fname[32];
|
||||
static char cmdline[LINE_MAX];
|
||||
int fd;
|
||||
ssize_t got;
|
||||
char *s;
|
||||
|
||||
if (snprintf (cmdline_fname, sizeof cmdline_fname, "/proc/%d/cmdline",
|
||||
(int) pid) < 0)
|
||||
return NULL;
|
||||
fd = open (cmdline_fname, O_RDONLY);
|
||||
if (fd == -1)
|
||||
{
|
||||
/* It may have already exited - ENOENT. */
|
||||
#if 0
|
||||
fprintf (stderr, "%s: open (\"%s\"): %m\n", progname, cmdline_fname);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
got = read (fd, cmdline, sizeof (cmdline) - 1);
|
||||
if (got == -1)
|
||||
fprintf (stderr, "%s: read (\"%s\"): %m\n", progname,
|
||||
cmdline_fname);
|
||||
if (close (fd) != 0)
|
||||
fprintf (stderr, "%s: close (\"%s\"): %m\n", progname,
|
||||
cmdline_fname);
|
||||
if (got < 0)
|
||||
return NULL;
|
||||
/* Convert '\0' argument delimiters to spaces. */
|
||||
for (s = cmdline; s < cmdline + got; s++)
|
||||
if (!*s)
|
||||
*s = ' ';
|
||||
/* Trim the trailing spaces (typically single '\0'->' '). */
|
||||
while (s > cmdline && isspace (s[-1]))
|
||||
s--;
|
||||
*s = 0;
|
||||
return cmdline;
|
||||
}
|
||||
|
||||
static int dir_scan (const char *dirname,
|
||||
int (*callback) (struct dirent *dirent, const char *pathname))
|
||||
{
|
||||
DIR *dir;
|
||||
struct dirent *dirent;
|
||||
int rc = 0;
|
||||
|
||||
dir = opendir (dirname);
|
||||
if (dir == NULL)
|
||||
{
|
||||
if (errno == EACCES || errno == ENOENT)
|
||||
return rc;
|
||||
fprintf (stderr, "%s: opendir (\"%s\"): %m\n", progname, dirname);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
while ((errno = 0, dirent = readdir (dir)))
|
||||
{
|
||||
char pathname[LINE_MAX];
|
||||
int pathname_len;
|
||||
|
||||
pathname_len = snprintf (pathname, sizeof pathname, "%s/%s",
|
||||
dirname, dirent->d_name);
|
||||
if (pathname_len <= 0 || pathname_len >= (int) sizeof pathname)
|
||||
{
|
||||
fprintf (stderr, "entry file name too long: `%s' / `%s'\n",
|
||||
dirname, dirent->d_name);
|
||||
continue;
|
||||
}
|
||||
/* RHEL-4.5 on s390x never fills in D_TYPE. */
|
||||
if (dirent->d_type == DT_UNKNOWN)
|
||||
{
|
||||
struct stat statbuf;
|
||||
int i;
|
||||
|
||||
/* We are not interested in the /proc/PID/fd/ links targets. */
|
||||
i = lstat (pathname, &statbuf);
|
||||
if (i == -1)
|
||||
{
|
||||
if (errno == EACCES || errno == ENOENT)
|
||||
continue;
|
||||
fprintf (stderr, "%s: stat (\"%s\"): %m\n", progname, pathname);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
if (S_ISDIR (statbuf.st_mode))
|
||||
dirent->d_type = DT_DIR;
|
||||
if (S_ISLNK (statbuf.st_mode))
|
||||
dirent->d_type = DT_LNK;
|
||||
/* No other D_TYPE types used in this code. */
|
||||
}
|
||||
rc = (*callback) (dirent, pathname);
|
||||
if (rc != 0)
|
||||
{
|
||||
errno = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (errno != 0)
|
||||
{
|
||||
fprintf (stderr, "%s: readdir (\"%s\"): %m\n", progname, dirname);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
if (closedir (dir) != 0)
|
||||
{
|
||||
fprintf (stderr, "%s: closedir (\"%s\"): %m\n", progname, dirname);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int fd_fs_scan (pid_t pid, int (*func) (pid_t pid, const char *link))
|
||||
{
|
||||
char dirname[64];
|
||||
|
||||
if (snprintf (dirname, sizeof dirname, "/proc/%d/fd", (int) pid) < 0)
|
||||
{
|
||||
perror ("snprintf(3)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int callback (struct dirent *dirent, const char *pathname)
|
||||
{
|
||||
char buf[LINE_MAX];
|
||||
ssize_t buf_len;
|
||||
|
||||
if ((dirent->d_type != DT_DIR && dirent->d_type != DT_LNK)
|
||||
|| (dirent->d_type == DT_DIR && strcmp (dirent->d_name, ".") != 0
|
||||
&& strcmp (dirent->d_name, "..") != 0)
|
||||
|| (dirent->d_type == DT_LNK && strspn (dirent->d_name, "0123456789")
|
||||
!= strlen (dirent->d_name)))
|
||||
{
|
||||
fprintf (stderr, "Unexpected entry \"%s\" (d_type %u)"
|
||||
" on readdir (\"%s\"): %m\n",
|
||||
dirent->d_name, (unsigned) dirent->d_type, dirname);
|
||||
return 0;
|
||||
}
|
||||
if (dirent->d_type == DT_DIR)
|
||||
return 0;
|
||||
buf_len = readlink (pathname, buf, sizeof buf - 1);
|
||||
if (buf_len <= 0 || buf_len >= (ssize_t) sizeof buf - 1)
|
||||
{
|
||||
if (errno != ENOENT && errno != EACCES)
|
||||
fprintf (stderr, "Error reading link \"%s\": %m\n", pathname);
|
||||
return 0;
|
||||
}
|
||||
buf[buf_len] = 0;
|
||||
return (*func) (pid, buf);
|
||||
}
|
||||
|
||||
return dir_scan (dirname, callback);
|
||||
}
|
||||
|
||||
static void pid_fs_scan (void (*func) (pid_t pid, void *data), void *data)
|
||||
{
|
||||
int callback (struct dirent *dirent, const char *pathname)
|
||||
{
|
||||
if (dirent->d_type != DT_DIR
|
||||
|| strspn (dirent->d_name, "0123456789") != strlen (dirent->d_name))
|
||||
return 0;
|
||||
(*func) (atoi (dirent->d_name), data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
dir_scan ("/proc", callback);
|
||||
}
|
||||
|
||||
static int rip_check_ptyname (pid_t pid, const char *link)
|
||||
{
|
||||
assert (pid != getpid ());
|
||||
|
||||
return strcmp (link, childptyname) == 0;
|
||||
}
|
||||
|
||||
struct pid
|
||||
{
|
||||
struct pid *next;
|
||||
pid_t pid;
|
||||
};
|
||||
static struct pid *pid_list;
|
||||
|
||||
static int pid_found (pid_t pid)
|
||||
{
|
||||
struct pid *entry;
|
||||
|
||||
for (entry = pid_list; entry != NULL; entry = entry->next)
|
||||
if (entry->pid == pid)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Single pass is not enough, a (multithreaded) process was seen to survive.
|
||||
Repeated killing of the same process is not enough, zombies can be killed.
|
||||
*/
|
||||
static int cleanup_acted;
|
||||
|
||||
static void pid_record (pid_t pid)
|
||||
{
|
||||
struct pid *entry;
|
||||
|
||||
if (pid_found (pid))
|
||||
return;
|
||||
cleanup_acted = 1;
|
||||
|
||||
entry = malloc (sizeof (*entry));
|
||||
if (entry == NULL)
|
||||
{
|
||||
fprintf (stderr, "%s: malloc: %m\n", progname);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
entry->pid = pid;
|
||||
entry->next = pid_list;
|
||||
pid_list = entry;
|
||||
}
|
||||
|
||||
static void pid_forall (void (*func) (pid_t pid))
|
||||
{
|
||||
struct pid *entry;
|
||||
|
||||
for (entry = pid_list; entry != NULL; entry = entry->next)
|
||||
(*func) (entry->pid);
|
||||
}
|
||||
|
||||
/* Returns 0 on failure. */
|
||||
static pid_t pid_get_parent (pid_t pid)
|
||||
{
|
||||
char fname[64];
|
||||
FILE *f;
|
||||
char line[LINE_MAX];
|
||||
pid_t retval = 0;
|
||||
|
||||
if (snprintf (fname, sizeof fname, "/proc/%d/status", (int) pid) < 0)
|
||||
{
|
||||
perror ("snprintf(3)");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
f = fopen (fname, "r");
|
||||
if (f == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
while (errno = 0, fgets (line, sizeof line, f) == line)
|
||||
{
|
||||
if (strncmp (line, "PPid:\t", sizeof "PPid:\t" - 1) != 0)
|
||||
continue;
|
||||
retval = atoi (line + sizeof "PPid:\t" - 1);
|
||||
errno = 0;
|
||||
break;
|
||||
}
|
||||
if (errno != 0)
|
||||
{
|
||||
fprintf (stderr, "%s: fgets (\"%s\"): %m\n", progname, fname);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
if (fclose (f) != 0)
|
||||
{
|
||||
fprintf (stderr, "%s: fclose (\"%s\"): %m\n", progname, fname);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void killtree (pid_t pid);
|
||||
|
||||
static void killtree_pid_fs_scan (pid_t pid, void *data)
|
||||
{
|
||||
pid_t parent_pid = *(pid_t *) data;
|
||||
|
||||
/* Do not optimize it as we could miss some newly spawned processes.
|
||||
Always traverse all the leaves. */
|
||||
#if 0
|
||||
/* Optimization. */
|
||||
if (pid_found (pid))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (pid_get_parent (pid) != parent_pid)
|
||||
return;
|
||||
|
||||
killtree (pid);
|
||||
}
|
||||
|
||||
static void killtree (pid_t pid)
|
||||
{
|
||||
pid_record (pid);
|
||||
pid_fs_scan (killtree_pid_fs_scan, &pid);
|
||||
}
|
||||
|
||||
static void rip_pid_fs_scan (pid_t pid, void *data)
|
||||
{
|
||||
pid_t pgid;
|
||||
|
||||
/* Shouldn't happen. */
|
||||
if (pid == getpid ())
|
||||
return;
|
||||
|
||||
/* Check both PGID and the stale file descriptors. */
|
||||
pgid = getpgid (pid);
|
||||
if (pgid == child
|
||||
|| fd_fs_scan (pid, rip_check_ptyname) != 0)
|
||||
killtree (pid);
|
||||
}
|
||||
|
||||
static void killproc (pid_t pid)
|
||||
{
|
||||
const char *cmdline;
|
||||
|
||||
cmdline = read_cmdline (pid);
|
||||
/* Avoid printing the message for already gone processes. */
|
||||
if (kill (pid, 0) != 0 && errno == ESRCH)
|
||||
return;
|
||||
if (cmdline == NULL)
|
||||
cmdline = "<error>";
|
||||
fprintf (stderr, "%s: Killed -9 orphan PID %d: %s\n", progname, (int) pid, cmdline);
|
||||
if (kill (pid, SIGKILL) == 0)
|
||||
cleanup_acted = 1;
|
||||
else if (errno != ESRCH)
|
||||
fprintf (stderr, "%s: kill (%d, SIGKILL): %m\n", progname, (int) pid);
|
||||
/* RHEL-3 kernels cannot SIGKILL a `T (stopped)' process. */
|
||||
kill (pid, SIGCONT);
|
||||
/* Do not waitpid(2) as it cannot be our direct descendant and it gets
|
||||
cleaned up by init(8). */
|
||||
#if 0
|
||||
pid_t pid_got;
|
||||
pid_got = waitpid (pid, NULL, 0);
|
||||
if (pid != pid_got)
|
||||
{
|
||||
fprintf (stderr, "%s: waitpid (%d) != %d: %m\n", progname,
|
||||
(int) pid, (int) pid_got);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void rip (void)
|
||||
{
|
||||
cleanup_acted = 0;
|
||||
do
|
||||
{
|
||||
if (cleanup_acted)
|
||||
usleep (1000000 / 10);
|
||||
cleanup_acted = 0;
|
||||
pid_fs_scan (rip_pid_fs_scan, NULL);
|
||||
pid_forall (killproc);
|
||||
}
|
||||
while (cleanup_acted);
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
int timeout = 0;
|
||||
int rc;
|
||||
|
||||
progname = *argv++;
|
||||
argc--;
|
||||
|
||||
if (argc < 1 || strcmp (*argv, "-h") == 0
|
||||
|| strcmp (*argv, "--help") == 0)
|
||||
{
|
||||
puts ("Syntax: orphanripper [-t <seconds>] <execvp(3) commandline>");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
if ((*argv)[0] == '-' && (*argv)[1] == 't')
|
||||
{
|
||||
char *timeout_s = NULL;
|
||||
|
||||
if ((*argv)[2] == 0)
|
||||
timeout_s = *++argv;
|
||||
else if (isdigit ((*argv)[2]))
|
||||
timeout_s = (*argv) + 2;
|
||||
if (timeout_s != NULL)
|
||||
{
|
||||
long l;
|
||||
char *endptr;
|
||||
|
||||
argv++;
|
||||
l = strtol (timeout_s, &endptr, 0);
|
||||
timeout = l;
|
||||
if ((endptr != NULL && *endptr != 0) || timeout < 0 || timeout != l)
|
||||
{
|
||||
fprintf (stderr, "%s: Invalid timeout value: %s\n", progname,
|
||||
timeout_s);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rc = spawn (argv, timeout);
|
||||
rip ();
|
||||
return rc;
|
||||
}
|
||||
83
gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
Normal file
83
gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch
Normal file
@ -0,0 +1,83 @@
|
||||
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-rhbz-818343-set-solib-absolute-prefix-testcase.patch
|
||||
|
||||
;; Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343).
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c
|
||||
@@ -0,0 +1,26 @@
|
||||
+/* Copyright (C) 2012 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+int
|
||||
+main (int argc, char *argv[])
|
||||
+{
|
||||
+ printf ("Hello, World.\n");
|
||||
+ abort ();
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp
|
||||
@@ -0,0 +1,39 @@
|
||||
+# Copyright 2012 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+set testfile "set-solib-absolute-prefix"
|
||||
+set srcfile ${testfile}.c
|
||||
+
|
||||
+# It is necessary to verify if the binary is 32-bit, so that the system
|
||||
+# call `__kernel_vsyscall' originates from vDSO.
|
||||
+
|
||||
+if { ![is_ilp32_target] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { ![runto_main] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "continue" "Program received signal SIGABRT, Aborted.*" \
|
||||
+ "continue until abort"
|
||||
+gdb_test "set solib-absolute-prefix /BOGUS_DIRECT" \
|
||||
+ ".*warning: Unable to find dynamic linker breakpoint function.*" \
|
||||
+ "set solib-absolute-prefix"
|
||||
+gdb_test "bt" "__kernel_vsyscall.*" "backtrace with __kernel_vsyscall"
|
||||
174
gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
Normal file
174
gdb-rhbz1007614-memleak-infpy_read_memory-test.patch
Normal file
@ -0,0 +1,174 @@
|
||||
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-rhbz1007614-memleak-infpy_read_memory-test.patch
|
||||
|
||||
;; Fix 'memory leak in infpy_read_memory()' (RH BZ 1007614)
|
||||
;;=fedoratest
|
||||
|
||||
Original message by Tom Tromey:
|
||||
|
||||
<https://sourceware.org/ml/gdb-patches/2012-03/msg00955.html>
|
||||
Message-ID: <871uoc1va3.fsf@fleche.redhat.com>
|
||||
|
||||
Comment from Sergio Durigan Junior:
|
||||
|
||||
In order to correctly test this patch, I wrote a testcase based on Jan
|
||||
Kratochvil's <gdb/testsuite/gdb.base/gcore-excessive-memory.exp>. The
|
||||
testcase, which can be seen below, tests GDB in order to see if the
|
||||
amount of memory being leaked is minimal, as requested in the bugzilla.
|
||||
It is hard to define what "minimum" is, so I ran the testcase on all
|
||||
supported RHEL architectures and came up with an average.
|
||||
|
||||
commit cc0265cdda9dc7e8665e8bfcf5b4477489daf27c
|
||||
Author: Tom Tromey <tromey@redhat.com>
|
||||
Date: Wed Mar 28 17:38:08 2012 +0000
|
||||
|
||||
* python/py-inferior.c (infpy_read_memory): Remove cleanups and
|
||||
explicitly free 'buffer' on exit paths. Decref 'membuf_object'
|
||||
before returning.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c
|
||||
@@ -0,0 +1,27 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2014 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+static struct x
|
||||
+ {
|
||||
+ char unsigned u[4096];
|
||||
+ } x, *px = &x;
|
||||
+
|
||||
+int
|
||||
+main (int argc, char *argv[])
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.exp b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.exp
|
||||
@@ -0,0 +1,72 @@
|
||||
+# Copyright 2014 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+load_lib gdb-python.exp
|
||||
+
|
||||
+require allow_python_tests
|
||||
+
|
||||
+set testfile py-gdb-rhbz1007614-memleak-infpy_read_memory
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set pid_of_gdb [exp_pid -i [board_info host fileid]]
|
||||
+
|
||||
+proc memory_v_pages_get {} {
|
||||
+ global pid_of_gdb
|
||||
+ set fd [open "/proc/$pid_of_gdb/statm"]
|
||||
+ gets $fd line
|
||||
+ close $fd
|
||||
+ # number of pages of virtual memory
|
||||
+ scan $line "%d" drs
|
||||
+ return $drs
|
||||
+}
|
||||
+
|
||||
+if { ![runto_main] } {
|
||||
+ untested $testfile.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
|
||||
+
|
||||
+gdb_test "source ${remote_python_file}" ""
|
||||
+
|
||||
+gdb_test "hello-world" "" \
|
||||
+ "first hello-world test"
|
||||
+
|
||||
+set kbytes_before [memory_v_pages_get]
|
||||
+verbose -log "kbytes_before = $kbytes_before"
|
||||
+
|
||||
+gdb_test "hello-world" "" \
|
||||
+ "second hello-world test"
|
||||
+
|
||||
+set kbytes_after [memory_v_pages_get]
|
||||
+verbose -log "kbytes_after = $kbytes_after"
|
||||
+
|
||||
+set kbytes_diff [expr $kbytes_after - $kbytes_before]
|
||||
+verbose -log "kbytes_diff = $kbytes_diff"
|
||||
+
|
||||
+# The value "1000" was calculated by running a few GDB sessions with this
|
||||
+# testcase, and seeing how much (in average) the memory consumption
|
||||
+# increased after the "hello-world" command issued above. The average
|
||||
+# was around 500 bytes, so I chose 1000 as a high estimate.
|
||||
+if { $kbytes_diff > 1000 } {
|
||||
+ fail "there is a memory leak on GDB (RHBZ 1007614)"
|
||||
+} else {
|
||||
+ pass "there is not a memory leak on GDB (RHBZ 1007614)"
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.py b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.py
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.py
|
||||
@@ -0,0 +1,30 @@
|
||||
+# Copyright (C) 2014 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+class HelloWorld (gdb.Command):
|
||||
+ """Greet the whole world."""
|
||||
+
|
||||
+ def __init__ (self):
|
||||
+ super (HelloWorld, self).__init__ ("hello-world",
|
||||
+ gdb.COMMAND_OBSCURE)
|
||||
+
|
||||
+ def invoke (self, arg, from_tty):
|
||||
+ px = gdb.parse_and_eval("px")
|
||||
+ core = gdb.inferiors()[0]
|
||||
+ for i in range(256 * 1024):
|
||||
+ chunk = core.read_memory(px, 4096)
|
||||
+ print "Hello, World!"
|
||||
+
|
||||
+HelloWorld ()
|
||||
235
gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
Normal file
235
gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
Normal file
@ -0,0 +1,235 @@
|
||||
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-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch
|
||||
|
||||
;; Fix '[ppc64] and [s390x] wrong prologue skip on -O2 -g code' (Jan
|
||||
;; Kratochvil, RH BZ 1084404).
|
||||
;;=fedoratest
|
||||
|
||||
These testcases have been created by compiling glibc-2.17-78 on
|
||||
RHEL-7.1 s390x/ppc64 boxes, and then taking the "select.o" file
|
||||
present at $builddir/misc/select.o.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp
|
||||
@@ -0,0 +1,34 @@
|
||||
+# Copyright 2015 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if { ![istarget powerpc64-*linux-*] || ![is_lp64_target] } {
|
||||
+ verbose "Skipping ppc64-prologue-skip.exp"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set testfile "ppc64-prologue-skip"
|
||||
+set uufile "${srcdir}/${subdir}/${testfile}.o.uu"
|
||||
+set ofile "${srcdir}/${subdir}/${testfile}.o"
|
||||
+
|
||||
+if { [catch "system \"uudecode -o ${ofile} ${uufile}\"" ] != 0 } {
|
||||
+ untested "failed uudecode"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_load $ofile
|
||||
+
|
||||
+gdb_test "break ___newselect_nocancel" "Breakpoint $decimal at 0xc: file ../sysdeps/unix/syscall-template.S, line 81." "breakpoint on ___newselect_nocancel"
|
||||
diff --git a/gdb/testsuite/gdb.arch/ppc64-prologue-skip.o.uu b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.o.uu
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.o.uu
|
||||
@@ -0,0 +1,70 @@
|
||||
+begin 644 ppc64-skip-prologue.o.uu
|
||||
+M?T5,1@("`0`````````````!`!4````!````````````````````````````
|
||||
+M``-(``````!```````!``!0`$8%-B-`L"@``0,(`-#@``(Y$```"3.,`('P(
|
||||
+M`J;X`0`0^"'_D4@```%@````Z`$`@#@A`'!\"`.F3H``(/@A_X%]*`*F^2$`
|
||||
+MD/CA`-#XP0#(^*$`P/B!`+CX80"P2````6````#X80!PZ.$`T.C!`,CHH0#`
|
||||
+MZ($`N.AA`+`X``".1````GP``";X80!X^`$`B.AA`'!(```!8````.DA`)#H
|
||||
+M`0"(Z&$`>'TH`Z9\#_$@."$`@$SC`"!+__]@```````,($``````````O``(
|
||||
+M7U]S96QE8W0```````````````````````````!6``(````Y!`'[#@T``0$!
|
||||
+M`0````$```$N+B]S>7-D97!S+W5N:7@``'-Y<V-A;&PM=&5M<&QA=&4N4P`!
|
||||
+M``````D"```````````#T``!`BT3`@D``0$```"/``(`````"`$`````````
|
||||
+M`````````````````"XN+W-Y<V1E<',O=6YI>"]S>7-C86QL+71E;7!L871E
|
||||
+M+E,`+W)O;W0O9VQI8F,O9VQI8F,M,BXQ-RTW."YE;#<N<W)C+V=L:6)C+3(N
|
||||
+M,3<M8S<U.&$V.#8O;6ES8P!'3E4@05,@,BXR,RXU,BXP+C$`@`$!$0`0!A$!
|
||||
+M$@$#"!L()0@3!0`````````````````L``(`````"```````````````````
|
||||
+M````````V``````````````````````````0``````%Z4@`$>$$!&PP!````
|
||||
+M`#`````8`````````+P`20YP$4%^1`X`009!0@Z``4(107Y2$49_20X`!D$&
|
||||
+M1@``````+G-Y;71A8@`N<W1R=&%B`"YS:'-T<G1A8@`N<F5L82YT97AT`"YD
|
||||
+M871A`"YB<W,`+G)E;&$N;W!D`"YN;W1E+D=.52US=&%C:P`N<F5L82YD96)U
|
||||
+M9U]L:6YE`"YR96QA+F1E8G5G7VEN9F\`+F1E8G5G7V%B8G)E=@`N<F5L82YD
|
||||
+M96)U9U]A<F%N9V5S`"YR96QA+F5H7V9R86UE````````````````````````
|
||||
+M````````````````````````````````````````````````````````````
|
||||
+M`````````"`````!``````````8```````````````````!``````````-@`
|
||||
+M```````````````````$```````````````;````!```````````````````
|
||||
+M```````````*>`````````!(````$@````$`````````"``````````8````
|
||||
+M)@````$``````````P```````````````````1@`````````````````````
|
||||
+M``````````$``````````````"P````(``````````,`````````````````
|
||||
+M``$8```````````````````````````````!```````````````V`````0``
|
||||
+M```````#```````````````````!&``````````0````````````````````
|
||||
+M"```````````````,0````0`````````````````````````````"L``````
|
||||
+M````,````!(````%``````````@`````````&````#L````!````````````
|
||||
+M``````````````````$H```````````````````````````````!````````
|
||||
+M``````!0`````0`````````````````````````````!*`````````!:````
|
||||
+M`````````````````0``````````````2P````0`````````````````````
|
||||
+M````````"O``````````&````!(````(``````````@`````````&````&$`
|
||||
+M```!``````````````````````````````&"`````````),`````````````
|
||||
+M```````!``````````````!<````!``````````````````````````````+
|
||||
+M"`````````!@````$@````H`````````"``````````8````;0````$`````
|
||||
+M`````````````````````````A4`````````%`````````````````````$`
|
||||
+M`````````````(`````!``````````````````````````````(P````````
|
||||
+M`#`````````````````````0``````````````![````!```````````````
|
||||
+M```````````````+:``````````P````$@````T`````````"``````````8
|
||||
+M````E`````$``````````@```````````````````F``````````2```````
|
||||
+M``````````````@``````````````(\````$````````````````````````
|
||||
+M``````N8`````````!@````2````#P`````````(`````````!@````1````
|
||||
+M`P`````````````````````````````"J`````````">````````````````
|
||||
+M`````0```````````````0````(`````````````````````````````"$@`
|
||||
+M```````!L````!,````+``````````@`````````&`````D````#````````
|
||||
+M``````````````````````GX`````````'H````````````````````!````
|
||||
+M`````````````````````````````````````````````P```0``````````
|
||||
+M`````````````````P```P```````````````````````````P``!```````
|
||||
+M`````````````````````P``!0```````````````````````````P``"@``
|
||||
+M`````````````````````````P``#````````````````````````````P``
|
||||
+M"````````````````````````````P``#0``````````````````````````
|
||||
+M`P``#P```````````````````````````P``!P``````````````````````
|
||||
+M```!$@``!0```````````````````-@````*$@```0`````````,````````
|
||||
+M`#`````@$``````````````````````````````P$```````````````````
|
||||
+M``````````!*$`````````````````````````````!E(@``!0``````````
|
||||
+M`````````-@```!S(@``!0```````````````````-@`7U]S96QE8W0`7U]?
|
||||
+M;F5W<V5L96-T7VYO8V%N8V5L`%]?<WES8V%L;%]E<G)O<@!?7VQI8F-?96YA
|
||||
+M8FQE7V%S>6YC8V%N8V5L`%]?;&EB8U]D:7-A8FQE7V%S>6YC8V%N8V5L`%]?
|
||||
+M;&EB8U]S96QE8W0`<V5L96-T```````````````````D````#0````H`````
|
||||
+M``````````````!<````#@````H```````````````````"4````#P````H`
|
||||
+M`````````````````````````0```"8````````````````````(````````
|
||||
+M`#,```````````````````!&`````0```"8````````````````````&````
|
||||
+M!@````$````````````````````,````!P````$````````````````````0
|
||||
+M`````0```"8````````````````````8`````0```"8`````````V```````
|
||||
+M```&````!0````$````````````````````0`````0```"8`````````````
|
||||
+6```````<`````0```!H`````````````
|
||||
+`
|
||||
+end
|
||||
diff --git a/gdb/testsuite/gdb.arch/s390x-prologue-skip.exp b/gdb/testsuite/gdb.arch/s390x-prologue-skip.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/s390x-prologue-skip.exp
|
||||
@@ -0,0 +1,34 @@
|
||||
+# Copyright 2015 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if { ![istarget s390x-*linux-*] || ![is_lp64_target] } {
|
||||
+ verbose "Skipping s390x-prologue-skip.exp"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+set testfile "s390x-prologue-skip"
|
||||
+set uufile "${srcdir}/${subdir}/${testfile}.o.uu"
|
||||
+set ofile "${srcdir}/${subdir}/${testfile}.o"
|
||||
+
|
||||
+if { [catch "system \"uudecode -o ${ofile} ${uufile}\"" ] != 0 } {
|
||||
+ untested "failed uudecode"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_load $ofile
|
||||
+
|
||||
+gdb_test "break select" "Breakpoint $decimal at 0x48: file ../sysdeps/unix/syscall-template.S, line 81." "breakpoint on select"
|
||||
diff --git a/gdb/testsuite/gdb.arch/s390x-prologue-skip.o.uu b/gdb/testsuite/gdb.arch/s390x-prologue-skip.o.uu
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.arch/s390x-prologue-skip.o.uu
|
||||
@@ -0,0 +1,64 @@
|
||||
+begin 644 s390x-prologue-skip.o.uu
|
||||
+M?T5,1@("`0`````````````!`!8````!````````````````````````````
|
||||
+M``+```````!```````!``!(`#^LE\!``).O?\&@`)+D$`.^G^_]@X^#P```D
|
||||
+MP.4`````N00``NLE\+``!`J.N00`TKD$`"#`Y0````"Y!``MZ]_Q"``$I_0`
|
||||
+M"L`0`````+\/$`"G=/_7"HZG2?`!N2$`),"T``````?^````5@`"````.0$!
|
||||
+M^PX-``$!`0$````!```!+BXO<WES9&5P<R]U;FEX``!S>7-C86QL+71E;7!L
|
||||
+M871E+E,``0`````)`@```````````]```0)F$P("``$!````CP`"``````@!
|
||||
+M```````````````````````````N+B]S>7-D97!S+W5N:7@O<WES8V%L;"UT
|
||||
+M96UP;&%T92Y3`"]R;V]T+V=L:6)C+V=L:6)C+3(N,3<M-S@N96PW+G-R8R]G
|
||||
+M;&EB8RTR+C$W+6,W-3AA-C@V+VUI<V,`1TY5($%3(#(N,C,N-3(N,"XQ`(`!
|
||||
+M`1$`$`81`1(!`P@;""4($P4`````````````````+``"``````@`````````
|
||||
+M`````````````````&@`````````````````````````%``````!>E(``7@.
|
||||
+M`1L,#Z`!````````&````!P`````````1`!,CP6.!HT'2`[``@```!`````X
|
||||
+M`````````"```````"YS>6UT86(`+G-T<G1A8@`N<VAS=')T86(`+G)E;&$N
|
||||
+M=&5X=``N9&%T80`N8G-S`"YN;W1E+D=.52US=&%C:P`N<F5L82YD96)U9U]L
|
||||
+M:6YE`"YR96QA+F1E8G5G7VEN9F\`+F1E8G5G7V%B8G)E=@`N<F5L82YD96)U
|
||||
+M9U]A<F%N9V5S`"YR96QA+F5H7V9R86UE````````````````````````````
|
||||
+M````````````````````````````````````````````````````````````
|
||||
+M````````(`````$`````````!@```````````````````$``````````:```
|
||||
+M``````````````````0``````````````!L````$````````````````````
|
||||
+M``````````F``````````&`````0`````0`````````(`````````!@````F
|
||||
+M`````0`````````#````````````````````J```````````````````````
|
||||
+M````````!```````````````+`````@``````````P``````````````````
|
||||
+M`*@```````````````````````````````0``````````````#$````!````
|
||||
+M``````````````````````````"H```````````````````````````````!
|
||||
+M``````````````!&`````0``````````````````````````````J```````
|
||||
+M``!:`````````````````````0``````````````00````0`````````````
|
||||
+M````````````````">``````````&````!`````&``````````@`````````
|
||||
+M&````%<````!``````````````````````````````$"`````````),`````
|
||||
+M```````````````!``````````````!2````!```````````````````````
|
||||
+M```````)^`````````!@````$`````@`````````"``````````8````8P``
|
||||
+M``$``````````````````````````````94`````````%```````````````
|
||||
+M``````$``````````````'8````!``````````````````````````````&P
|
||||
+M`````````#`````````````````````0``````````````!Q````!```````
|
||||
+M```````````````````````*6``````````P````$`````L`````````"```
|
||||
+M```````8````B@````$``````````@```````````````````>``````````
|
||||
+M2`````````````````````@``````````````(4````$````````````````
|
||||
+M``````````````J(`````````#`````0````#0`````````(`````````!@`
|
||||
+M```1`````P`````````````````````````````"*`````````"4````````
|
||||
+M`````````````0```````````````0````(`````````````````````````
|
||||
+M````!T`````````!L````!$````*``````````@`````````&`````D````#
|
||||
+M``````````````````````````````CP`````````(X`````````````````
|
||||
+M```!`````````````````````````````````````````````````P```0``
|
||||
+M`````````````````````````P```P```````````````````````````P``
|
||||
+M!````````````````````````````P``"```````````````````````````
|
||||
+M`P``"@```````````````````````````P``!@``````````````````````
|
||||
+M`````P``"P```````````````````````````P``#0``````````````````
|
||||
+M`````````P``!0`````````````````````````!$```````````````````
|
||||
+M```````````;$``````````````````````````````V$@```0````````!(
|
||||
+M`````````"`````_$`````````````````````````````!7$@```0``````
|
||||
+M``!6`````````!````!I$`````````````````````````````!Y(@```0``
|
||||
+M``````!(`````````"````"'(@```0````````!(`````````"``7U]L:6)C
|
||||
+M7V5N86)L95]A<WEN8V-A;F-E;`!?7VQI8F-?9&ES86)L95]A<WEN8V-A;F-E
|
||||
+M;`!?7W-E;&5C=`!?7VQI8F-?;75L=&EP;&5?=&AR96%D<P!?7W-E;&5C=%]N
|
||||
+M;V-A;F-E;`!?7W-Y<V-A;&Q?97)R;W(`7U]L:6)C7W-E;&5C=`!S96QE8W0`
|
||||
+M````````````'`````H````3``````````(`````````-@````L````3````
|
||||
+M``````(`````````2@````T````3``````````(`````````8@````\````3
|
||||
+M``````````(`````````1@````$````6````````````````````!@````4`
|
||||
+M```$````````````````````#`````8````$````````````````````$```
|
||||
+M``$````6````````````````````&`````$````6`````````&@`````````
|
||||
+M!@````0````$````````````````````$`````$````6````````````````
|
||||
+L````(`````$````%````````````````````/`````$````%`````````$@`
|
||||
+`
|
||||
+end
|
||||
123
gdb-rhbz1149205-catch-syscall-after-fork-test.patch
Normal file
123
gdb-rhbz1149205-catch-syscall-after-fork-test.patch
Normal file
@ -0,0 +1,123 @@
|
||||
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-rhbz1149205-catch-syscall-after-fork-test.patch
|
||||
|
||||
;; Fix '`catch syscall' doesn't work for parent after `fork' is called'
|
||||
;; (Philippe Waroquiers, RH BZ 1149205).
|
||||
;;=fedoratest
|
||||
|
||||
URL: <https://sourceware.org/ml/gdb-patches/2013-05/msg00364.html>
|
||||
Message-ID: <1368136582.30058.7.camel@soleil>
|
||||
|
||||
From: Philippe Waroquiers <philippe dot waroquiers at skynet dot be>
|
||||
To: gdb-patches at sourceware dot org
|
||||
Subject: RFA: fix gdb_assert caused by 'catch signal ...' and fork
|
||||
Date: Thu, 09 May 2013 23:56:22 +0200
|
||||
|
||||
The attached patch fixes a gdb_assert caused by the combination of catch
|
||||
signal and fork:
|
||||
break-catch-sig.c:152: internal-error: signal_catchpoint_remove_location: Assertion `signal_catch_counts[iter] > 0' failed.
|
||||
|
||||
The problem is that the signal_catch_counts is decremented by detach_breakpoints.
|
||||
The fix consists in not detaching breakpoint locations of type bp_loc_other.
|
||||
The patch introduces a new test.
|
||||
|
||||
Comments by Sergio Durigan Junior:
|
||||
|
||||
I addded a specific testcase for this patch, which tests exactly the
|
||||
issue that the customer is facing. This patch does not solve the
|
||||
whole problem of catching a syscall and forking (for more details,
|
||||
see <https://sourceware.org/bugzilla/show_bug.cgi?id=13457>,
|
||||
specifically comment #3), but it solves the issue reported by the
|
||||
customer.
|
||||
|
||||
I also removed the original testcase of this patch, because it
|
||||
relied on "catch signal", which is a command that is not implemented
|
||||
in this version of GDB.
|
||||
|
||||
commit bd9673a4ded96ea5c108601501c8e59003ea1be6
|
||||
Author: Philippe Waroquiers <philippe@sourceware.org>
|
||||
Date: Tue May 21 18:47:05 2013 +0000
|
||||
|
||||
Fix internal error caused by interaction between catch signal and fork
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c
|
||||
@@ -0,0 +1,11 @@
|
||||
+#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+int
|
||||
+main (int argc, char **argv)
|
||||
+{
|
||||
+ if (fork () == 0)
|
||||
+ sleep (1);
|
||||
+ chdir (".");
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.exp
|
||||
@@ -0,0 +1,58 @@
|
||||
+# Copyright 2015 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if { [is_remote target] || ![isnative] } then {
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+set testfile "gdb-rhbz1149205-catch-syscall-fork"
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+# Until "catch syscall" is implemented on other targets...
|
||||
+if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then {
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+# This shall be updated whenever 'catch syscall' is implemented
|
||||
+# on some architecture.
|
||||
+#if { ![istarget "i\[34567\]86-*-linux*"]
|
||||
+if { ![istarget "x86_64-*-linux*"] && ![istarget "i\[34567\]86-*-linux*"]
|
||||
+ && ![istarget "powerpc-*-linux*"] && ![istarget "powerpc64-*-linux*"]
|
||||
+ && ![istarget "sparc-*-linux*"] && ![istarget "sparc64-*-linux*"] } {
|
||||
+ continue
|
||||
+}
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ untested ${testfile}.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+gdb_load $binfile
|
||||
+
|
||||
+if { ![runto_main] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_test "catch syscall chdir" \
|
||||
+ "Catchpoint $decimal \\\(syscall (.)?chdir(.)? \\\[$decimal\\\]\\\)" \
|
||||
+ "catch syscall chdir"
|
||||
+
|
||||
+gdb_test "continue" \
|
||||
+ "Continuing\.\r\n.*\r\nCatchpoint $decimal \\\(call to syscall .?chdir.?.*" \
|
||||
+ "continue from catch syscall after fork"
|
||||
365
gdb-rhbz1156192-recursive-dlopen-test.patch
Normal file
365
gdb-rhbz1156192-recursive-dlopen-test.patch
Normal file
@ -0,0 +1,365 @@
|
||||
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-rhbz1156192-recursive-dlopen-test.patch
|
||||
|
||||
;; Testcase for '[SAP] Recursive dlopen causes SAP HANA installer to
|
||||
;; crash.' (RH BZ 1156192).
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c
|
||||
@@ -0,0 +1,30 @@
|
||||
+/* Testcase for recursive dlopen calls.
|
||||
+
|
||||
+ Copyright (C) 2014 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/* This test was copied from glibc's testcase called
|
||||
+ <dlfcn/tst-rec-dlopen.c> and related files. */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+void
|
||||
+bar (void)
|
||||
+{
|
||||
+ printf ("Called bar.\n");
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libfoo.c b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libfoo.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libfoo.c
|
||||
@@ -0,0 +1,30 @@
|
||||
+/* Testcase for recursive dlopen calls.
|
||||
+
|
||||
+ Copyright (C) 2014 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/* This test was copied from glibc's testcase called
|
||||
+ <dlfcn/tst-rec-dlopen.c> and related files. */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+void
|
||||
+foo (void)
|
||||
+{
|
||||
+ printf ("Called foo.\n");
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c
|
||||
@@ -0,0 +1,125 @@
|
||||
+/* Testcase for recursive dlopen calls.
|
||||
+
|
||||
+ Copyright (C) 2014 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/* This test was copied from glibc's testcase called
|
||||
+ <dlfcn/tst-rec-dlopen.c> and related files. */
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <malloc.h>
|
||||
+#include <dlfcn.h>
|
||||
+
|
||||
+#define DSO "gdb-rhbz1156192-recursive-dlopen-libfoo.so"
|
||||
+#define FUNC "foo"
|
||||
+
|
||||
+#define DSO1 "gdb-rhbz1156192-recursive-dlopen-libbar.so"
|
||||
+#define FUNC1 "bar"
|
||||
+
|
||||
+/* Prototype for my hook. */
|
||||
+void *custom_malloc_hook (size_t, const void *);
|
||||
+
|
||||
+/* Pointer to old malloc hooks. */
|
||||
+void *(*old_malloc_hook) (size_t, const void *);
|
||||
+
|
||||
+/* Call function func_name in DSO dso_name via dlopen. */
|
||||
+void
|
||||
+call_func (const char *dso_name, const char *func_name)
|
||||
+{
|
||||
+ int ret;
|
||||
+ void *dso;
|
||||
+ void (*func) (void);
|
||||
+ char *err;
|
||||
+
|
||||
+ /* Open the DSO. */
|
||||
+ dso = dlopen (dso_name, RTLD_NOW|RTLD_GLOBAL);
|
||||
+ if (dso == NULL)
|
||||
+ {
|
||||
+ err = dlerror ();
|
||||
+ fprintf (stderr, "%s\n", err);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ /* Clear any errors. */
|
||||
+ dlerror ();
|
||||
+
|
||||
+ /* Lookup func. */
|
||||
+ *(void **) (&func) = dlsym (dso, func_name);
|
||||
+ if (func == NULL)
|
||||
+ {
|
||||
+ err = dlerror ();
|
||||
+ if (err != NULL)
|
||||
+ {
|
||||
+ fprintf (stderr, "%s\n", err);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+ }
|
||||
+ /* Call func twice. */
|
||||
+ (*func) ();
|
||||
+
|
||||
+ /* Close the library and look for errors too. */
|
||||
+ ret = dlclose (dso);
|
||||
+ if (ret != 0)
|
||||
+ {
|
||||
+ err = dlerror ();
|
||||
+ fprintf (stderr, "%s\n", err);
|
||||
+ exit (1);
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
+
|
||||
+/* Empty hook that does nothing. */
|
||||
+void *
|
||||
+custom_malloc_hook (size_t size, const void *caller)
|
||||
+{
|
||||
+ void *result;
|
||||
+ /* Restore old hooks. */
|
||||
+ __malloc_hook = old_malloc_hook;
|
||||
+ /* First call a function in another library via dlopen. */
|
||||
+ call_func (DSO1, FUNC1);
|
||||
+ /* Called recursively. */
|
||||
+ result = malloc (size);
|
||||
+ /* Restore new hooks. */
|
||||
+ old_malloc_hook = __malloc_hook;
|
||||
+ __malloc_hook = custom_malloc_hook;
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+
|
||||
+ /* Save old hook. */
|
||||
+ old_malloc_hook = __malloc_hook;
|
||||
+ /* Install new hook. */
|
||||
+ __malloc_hook = custom_malloc_hook;
|
||||
+
|
||||
+ /* Attempt to dlopen a shared library. This dlopen will
|
||||
+ trigger an access to the ld.so.cache, and that in turn
|
||||
+ will require a malloc to duplicate data in the cache.
|
||||
+ The malloc will call our malloc hook which calls dlopen
|
||||
+ recursively, and upon return of this dlopen the non-ref
|
||||
+ counted ld.so.cache mapping will be unmapped. We will
|
||||
+ return to the original dlopen and crash trying to access
|
||||
+ dlopened data. */
|
||||
+ call_func (DSO, FUNC);
|
||||
+
|
||||
+ /* Restore old hook. */
|
||||
+ __malloc_hook = old_malloc_hook;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
|
||||
@@ -0,0 +1,151 @@
|
||||
+# Copyright 2014 Free Software Foundation, Inc.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+require allow_shlib_tests
|
||||
+require !use_gdb_stub
|
||||
+
|
||||
+# Library foo
|
||||
+set libname1 "gdb-rhbz1156192-recursive-dlopen-libfoo"
|
||||
+set srcfile_lib1 ${srcdir}/${subdir}/${libname1}.c
|
||||
+set binfile_lib1 [standard_output_file ${libname1}.so]
|
||||
+# Library bar
|
||||
+set libname2 "gdb-rhbz1156192-recursive-dlopen-libbar"
|
||||
+set srcfile_lib2 ${srcdir}/${subdir}/${libname2}.c
|
||||
+set binfile_lib2 [standard_output_file ${libname2}.so]
|
||||
+
|
||||
+set testfile "gdb-rhbz1156192-recursive-dlopen"
|
||||
+set srcfile ${testfile}.c
|
||||
+set executable ${testfile}
|
||||
+set binfile [standard_output_file ${executable}]
|
||||
+
|
||||
+if { [gdb_compile_shlib ${srcfile_lib1} ${binfile_lib1} \
|
||||
+ { debug "additional_flags=-fPIC" }] != "" } {
|
||||
+ untested "Could not compile ${binfile_lib1}"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { [gdb_compile_shlib ${srcfile_lib2} ${binfile_lib2} \
|
||||
+ { debug "additional_flags=-fPIC" }] != "" } {
|
||||
+ untested "Could not compile ${binfile_lib2}"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { [prepare_for_testing ${testfile}.exp ${executable} ${srcfile} \
|
||||
+ [ list debug shlib_load "additional_flags=-Wno-deprecated-declarations" ]] } {
|
||||
+ untested "Could not compile ${executable}"
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+set supported 0
|
||||
+gdb_test_multiple "run" "initial trial run" {
|
||||
+ -re "warning: Corrupted shared library list: \[^\r\n\]+\r\n" {
|
||||
+ exp_continue
|
||||
+ }
|
||||
+ -re -wrap "exited normally.*" {
|
||||
+ set supported 1
|
||||
+ pass $gdb_test_name
|
||||
+ }
|
||||
+ -re -wrap "exited with code.*" {
|
||||
+ untested "failed at $gdb_test_name"
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if { $supported == 0 } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+proc do_test { has_libfoo has_libbar } {
|
||||
+ global hex binfile_lib2 binfile_lib1 gdb_prompt
|
||||
+ set libbar_match "[string_to_regexp $binfile_lib2]"
|
||||
+ set libfoo_match "[string_to_regexp $binfile_lib1]"
|
||||
+
|
||||
+ gdb_test_multiple "info shared" "info shared" {
|
||||
+ -re ".*$libfoo_match\r\n.*$libbar_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
|
||||
+ if { $has_libfoo && $has_libbar } {
|
||||
+ pass "matched libfoo and libbar"
|
||||
+ } else {
|
||||
+ fail "matched libfoo and libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
|
||||
+ }
|
||||
+ }
|
||||
+ -re ".*$libfoo_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
|
||||
+ if { $has_libfoo && !$has_libbar } {
|
||||
+ pass "matched libfoo"
|
||||
+ } else {
|
||||
+ fail "matched libfoo (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
|
||||
+ }
|
||||
+ }
|
||||
+ -re ".*$libbar_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
|
||||
+ if { $has_libbar && !$has_libfoo } {
|
||||
+ pass "matched libbar"
|
||||
+ } else {
|
||||
+ fail "matched libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
|
||||
+ }
|
||||
+ }
|
||||
+ "\r\n${gdb_prompt} $" {
|
||||
+ if { !$has_libfoo && !$has_libbar } {
|
||||
+ pass "did not match libfoo nor libbar"
|
||||
+ } else {
|
||||
+ fail "did not match libfoo nor libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+proc test_stop_on_solib_events { } {
|
||||
+ set pass 0
|
||||
+ # This variable holds the information about whether libfoo and
|
||||
+ # libbar (respectively) are expected in the "info shared" output.
|
||||
+ set solib_event_order { { 0 0 } { 0 0 } { 0 0 } { 0 1 } \
|
||||
+ { 0 1 } { 0 0 } { 0 0 } { 0 1 } \
|
||||
+ { 0 1 } { 0 0 } { 0 0 } { 0 1 } \
|
||||
+ { 0 1 } { 0 0 } { 0 0 1 } { 1 1 } \
|
||||
+ { 1 1 } { 1 0 } { 1 0 } { 1 1 } \
|
||||
+ { 1 1 } { 1 0 1 } { 1 0 } { 1 0 } }
|
||||
+
|
||||
+ with_test_prefix "stop-on-solib-events" {
|
||||
+ gdb_test_no_output "set stop-on-solib-events 1" "setting stop-on-solib-events"
|
||||
+
|
||||
+ gdb_run_cmd
|
||||
+ gdb_test "" "Wait for first prompt"
|
||||
+ foreach l $solib_event_order {
|
||||
+ incr pass
|
||||
+ with_test_prefix "pass #$pass" {
|
||||
+ set should_be_corrupted [expr 0+0[lindex $l 2]]
|
||||
+ do_test [lindex $l 0] [lindex $l 1]
|
||||
+
|
||||
+ set corrupted 0
|
||||
+ gdb_test_multiple "continue" "" {
|
||||
+ -re "\r\nwarning: Corrupted shared library list:\[^\r\n\]+(?=\r\n)" {
|
||||
+ set corrupted 1
|
||||
+ }
|
||||
+ -re -wrap "\r\nStopped due to shared library event.*" {
|
||||
+ pass $gdb_test_name
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ gdb_assert {$corrupted == $should_be_corrupted} \
|
||||
+ "corrupted=$corrupted but should_be_corrupted=$should_be_corrupted"
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ # In the last pass we do not expect to see libfoo or libbar.
|
||||
+ incr pass
|
||||
+ with_test_prefix "pass #$pass" {
|
||||
+ do_test 0 0
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+test_stop_on_solib_events
|
||||
104
gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
Normal file
104
gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch
Normal file
@ -0,0 +1,104 @@
|
||||
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-rhbz1261564-aarch64-hw-watchpoint-test.patch
|
||||
|
||||
;; [aarch64] Fix hardware watchpoints (RH BZ 1261564).
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.c
|
||||
@@ -0,0 +1,33 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2016 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+__attribute__((aligned(16))) struct
|
||||
+{
|
||||
+ int var0, var4, var8;
|
||||
+} aligned;
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ aligned.var0 = 1;
|
||||
+ aligned.var4 = 2;
|
||||
+ aligned.var8 = 3;
|
||||
+
|
||||
+ aligned.var4 = aligned.var0;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/rhbz1261564-aarch64-watchpoint.exp
|
||||
@@ -0,0 +1,53 @@
|
||||
+# Copyright (C) 2016 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+if { [prepare_for_testing rhbz1261564-aarch64-watchpoint.exp "rhbz1261564-aarch64-watchpoint"] } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+if { ! [ runto main ] } then { return 0 }
|
||||
+
|
||||
+set test "rwatch aligned.var4"
|
||||
+if [istarget "s390*-*-*"] {
|
||||
+ gdb_test $test {Target does not support this type of hardware watchpoint\.}
|
||||
+ untested "s390* does not support hw read watchpoint"
|
||||
+ return
|
||||
+}
|
||||
+gdb_test $test "Hardware read watchpoint \[0-9\]+: aligned.var4"
|
||||
+
|
||||
+proc checkvar { address } {
|
||||
+ global gdb_prompt
|
||||
+
|
||||
+ set test "p &aligned.var$address"
|
||||
+ gdb_test_multiple $test $test {
|
||||
+ -re " = \\(int \\*\\) 0x\[0-9a-f\]+$address <aligned(\\+\[0-9\]+)?>\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re "\r\n$gdb_prompt $" {
|
||||
+ untested "$test (unexpected ELF layout)"
|
||||
+ return 0
|
||||
+ }
|
||||
+ }
|
||||
+ return 1
|
||||
+}
|
||||
+if ![checkvar "0"] { return }
|
||||
+if ![checkvar "4"] { return }
|
||||
+if ![checkvar "8"] { return }
|
||||
+
|
||||
+# Assumes: PPC_PTRACE_GETHWDBGINFO::data_bp_alignment == 8
|
||||
+# 'lwz' does read only 4 bytes but the hw watchpoint is 8 bytes wide.
|
||||
+setup_xfail "powerpc*-*-*"
|
||||
+
|
||||
+gdb_continue_to_end
|
||||
74
gdb-rhbz2354997-gstack-drop-readnever.patch
Normal file
74
gdb-rhbz2354997-gstack-drop-readnever.patch
Normal file
@ -0,0 +1,74 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Keith Seitz <keiths@redhat.com>
|
||||
Date: Thu, 27 Mar 2025 11:36:19 -0700
|
||||
Subject: gdb-rhbz2354997-gstack-drop-readnever.patch
|
||||
|
||||
;; Backport "Fix gstack issues" from upstream
|
||||
;; commit 43ac3df61492b94bf13c11bd98c9f9541e92d3b0.
|
||||
;; (Keith Seitz, RH BZ 2354997)
|
||||
|
||||
With commit fb2ded33c1e519659743047ed7817166545b6d91, I added
|
||||
Fedora's gstack script to gdb. Some issues have arisen since
|
||||
then, and this patch addresses those issues:
|
||||
|
||||
. As Sam James recently noted[1], PKGVERSION and VERSION
|
||||
need to be quoted.
|
||||
. A Fedora user reported the misuse of --readnever, which
|
||||
causes gstack to omit filename and line number information in the
|
||||
backtrace[Red Hat BZ 2354997].
|
||||
|
||||
[1] https://inbox.sourceware.org/gdb-patches/d19d6bc17e0a160ce27fc572079f11a587c0e168.1742424869.git.sam@gentoo.org/
|
||||
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=2354997
|
||||
|
||||
diff --git a/gdb/gstack-1.in b/gdb/gstack-1.in
|
||||
--- a/gdb/gstack-1.in
|
||||
+++ b/gdb/gstack-1.in
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
-# Copyright (C) 2024 Free Software Foundation, Inc.
|
||||
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -22,8 +22,8 @@
|
||||
GDB=${GDB:-$(command -v gdb)}
|
||||
GDBARGS=${GDBARGS:-}
|
||||
AWK=${AWK:-}
|
||||
-PKGVERSION=@PKGVERSION@
|
||||
-VERSION=@VERSION@
|
||||
+PKGVERSION="@PKGVERSION@"
|
||||
+VERSION="@VERSION@"
|
||||
|
||||
# Find an appropriate awk interpreter if one was not specified
|
||||
# via the environment.
|
||||
@@ -132,7 +132,7 @@ EOF
|
||||
)
|
||||
|
||||
# Run GDB and remove some unwanted noise.
|
||||
-"$GDB" --quiet -nx --readnever $GDBARGS <<EOF |
|
||||
+"$GDB" --quiet -nx $GDBARGS <<EOF |
|
||||
set width 0
|
||||
set height 0
|
||||
set pagination no
|
||||
diff --git a/gdb/testsuite/gdb.base/gstack.exp b/gdb/testsuite/gdb.base/gstack.exp
|
||||
--- a/gdb/testsuite/gdb.base/gstack.exp
|
||||
+++ b/gdb/testsuite/gdb.base/gstack.exp
|
||||
@@ -1,4 +1,4 @@
|
||||
-# Copyright (C) 2024 Free Software Foundation, Inc.
|
||||
+# Copyright (C) 2024-2025 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -60,8 +60,10 @@ if { ![gdb_assert { ![expr {$res < 0 || $res == ""}] } $test] } {
|
||||
set test "got backtrace"
|
||||
set saw_backtrace false
|
||||
set no_awk false
|
||||
+set location_re ${srcfile}:${decimal}
|
||||
+
|
||||
gdb_test_multiple "" $test {
|
||||
- -i "$res" -re "#0 +(0x\[0-9a-f\]+ in )?main \(\).*\r\nGSTACK-END\r\n\$" {
|
||||
+ -i "$res" -re "#0 +(0x\[0-9a-f\]+ in )?main \(\).*$location_re.*\r\nGSTACK-END\r\n\$" {
|
||||
set saw_backtrace true
|
||||
pass $test
|
||||
exp_continue
|
||||
162
gdb-simultaneous-step-resume-breakpoint-test.patch
Normal file
162
gdb-simultaneous-step-resume-breakpoint-test.patch
Normal file
@ -0,0 +1,162 @@
|
||||
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-simultaneous-step-resume-breakpoint-test.patch
|
||||
|
||||
;; New test for step-resume breakpoint placed in multiple threads at once.
|
||||
;;=fedoratest
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.c
|
||||
@@ -0,0 +1,79 @@
|
||||
+/* Copyright 2009 Free Software Foundation, Inc.
|
||||
+
|
||||
+ Written by Fred Fish of Cygnus Support
|
||||
+ Contributed by Cygnus Support
|
||||
+
|
||||
+ This file is part of GDB.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+/* Test multiple threads stepping into a .debug_line-less function with
|
||||
+ a breakpoint placed on its return-to-caller point. */
|
||||
+
|
||||
+#include <pthread.h>
|
||||
+#include <assert.h>
|
||||
+#include <unistd.h>
|
||||
+#include <errno.h>
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+#define THREADS 3
|
||||
+
|
||||
+static void *
|
||||
+func (void *unused)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ errno = 0;
|
||||
+ i = 0xdeadf00d;
|
||||
+ i = sleep (THREADS); /* sleep-call */
|
||||
+ if (errno != 0) /* sleep-after */
|
||||
+ perror ("sleep");
|
||||
+
|
||||
+ /* The GDB bug with forgotten step-resume breakpoint could leave stale
|
||||
+ breakpoint on the I assignment making it a nop. */
|
||||
+ if (i == 0xdeadf00d)
|
||||
+ assert (0);
|
||||
+
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ pthread_exit (NULL);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ pthread_t threads[THREADS];
|
||||
+ int threadi;
|
||||
+
|
||||
+ for (threadi = 0; threadi < THREADS; threadi++)
|
||||
+ {
|
||||
+ int i;
|
||||
+
|
||||
+ i = pthread_create (&threads[threadi], NULL, func, NULL);
|
||||
+ assert (i == 0);
|
||||
+
|
||||
+ i = sleep (1);
|
||||
+ assert (i == 0);
|
||||
+ }
|
||||
+
|
||||
+ for (threadi = 0; threadi < THREADS; threadi++)
|
||||
+ {
|
||||
+ int i;
|
||||
+
|
||||
+ i = pthread_join (threads[threadi], NULL);
|
||||
+ assert (i == 0);
|
||||
+ }
|
||||
+
|
||||
+ return 0; /* final-exit */
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.exp b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.threads/simultaneous-step-resume-breakpoint.exp
|
||||
@@ -0,0 +1,65 @@
|
||||
+# Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+# Test multiple threads stepping into a .debug_line-less function with
|
||||
+# a breakpoint placed on its return-to-caller point.
|
||||
+
|
||||
+set testfile simultaneous-step-resume-breakpoint
|
||||
+set srcfile ${testfile}.c
|
||||
+set binfile [standard_output_file ${testfile}]
|
||||
+
|
||||
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+gdb_exit
|
||||
+gdb_start
|
||||
+gdb_reinitialize_dir $srcdir/$subdir
|
||||
+
|
||||
+# Ensure we have no debuginfo for the `sleep' call itself (=for libc).
|
||||
+gdb_test "set debug-file-directory /DoesNotExist"
|
||||
+
|
||||
+gdb_load ${binfile}
|
||||
+if ![runto_main] {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+# Red Hat vendor patch does set it to "step" by default.
|
||||
+gdb_test "set scheduler-locking off"
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "final-exit"]
|
||||
+
|
||||
+gdb_breakpoint [gdb_get_line_number "sleep-call"]
|
||||
+gdb_continue_to_breakpoint "sleep-call"
|
||||
+
|
||||
+gdb_test "step" "sleep-call.*" "step thread 1"
|
||||
+gdb_test "step" "sleep-call.*" "step thread 2"
|
||||
+gdb_test "step" "sleep-after.*" "step thread 3"
|
||||
+
|
||||
+set test "first continue"
|
||||
+gdb_test_multiple "continue" $test {
|
||||
+ -re "final-exit.*$gdb_prompt $" {
|
||||
+ # gdb-7.0.
|
||||
+ pass $test
|
||||
+ return
|
||||
+ }
|
||||
+ -re "sleep-after.*$gdb_prompt $" {
|
||||
+ # Fedora/RHEL branch.
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+gdb_test "continue" "sleep-after.*" "second continue"
|
||||
+gdb_test "continue" "final-exit.*" "third continue"
|
||||
214
gdb-test-bt-cfi-without-die.patch
Normal file
214
gdb-test-bt-cfi-without-die.patch
Normal file
@ -0,0 +1,214 @@
|
||||
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-test-bt-cfi-without-die.patch
|
||||
|
||||
;; [delayed-symfile] Test a backtrace regression on CFIs without DIE (BZ 614604).
|
||||
;;=fedoratest
|
||||
|
||||
http://sourceware.org/ml/archer/2010-q3/msg00028.html
|
||||
|
||||
On Wed, 25 Feb 2009 00:14:29 +0100, Jan Kratochvil wrote:
|
||||
> commit 6a37c2b9962258ecf9299cc34a650e64a06acaa5
|
||||
>
|
||||
> There was a regression on gdb.base/savedregs.exp.
|
||||
>
|
||||
> quick_addrmap/require_partial_symbols should be used even for the unwind debug
|
||||
> info checking as its load has been also delayed by this branch.
|
||||
[...]
|
||||
> --- a/gdb/dwarf2-frame.c
|
||||
> +++ b/gdb/dwarf2-frame.c
|
||||
[...]
|
||||
> @@ -1499,6 +1500,14 @@ dwarf2_frame_find_fde (CORE_ADDR *pc)
|
||||
> struct dwarf2_fde *fde;
|
||||
> CORE_ADDR offset;
|
||||
>
|
||||
> + if (objfile->quick_addrmap)
|
||||
> + {
|
||||
> + if (!addrmap_find (objfile->quick_addrmap, *pc))
|
||||
> + continue;
|
||||
> + }
|
||||
> + /* FIXME: Read-in only .debug_frame/.eh_frame without .debug_info? */
|
||||
> + require_partial_symbols (objfile);
|
||||
> +
|
||||
|
||||
but this has caused a different regression (as discussed in the confcall).
|
||||
|
||||
QUICK_ADDRMAP is built only from .debug_aranges. But we can have existing
|
||||
built .debug_aranges for CUs in OBJFILE but still some CUs do not need to have
|
||||
DWARF at all while they can feature CFIs (.eh_frame or .debug_frame).
|
||||
It has been described by Daniel Jacobowitz at:
|
||||
Re: [2/4] RFC: check psymtabs_addrmap before reading FDEs
|
||||
http://sourceware.org/ml/gdb-patches/2010-07/msg00012.html
|
||||
|
||||
Sorry for this regression by me (in that fix of a different regression).
|
||||
|
||||
Fixed it the "slow way" as this branch is now obsoleted by .gdb-index.
|
||||
|
||||
No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu.
|
||||
|
||||
Checked-in.
|
||||
|
||||
Thanks,
|
||||
Jan
|
||||
|
||||
eb8df8566acc1ed963e3e9b77c13b9c2c3db03fb
|
||||
|
||||
Test CFI is parsed even for range (function) not described by any DIE.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=614028
|
||||
|
||||
gdb/
|
||||
* dwarf2-frame.c (dwarf2_frame_find_fde): Remove the
|
||||
OBJFILE->QUICK_ADDRMAP check. New comment why.
|
||||
|
||||
gdb/testsuite/
|
||||
* gdb.base/cfi-without-die.exp, gdb.base/cfi-without-die-main.c,
|
||||
gdb.base/cfi-without-die-caller.c: New files.
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.base/cfi-without-die-caller.c b/gdb/testsuite/gdb.base/cfi-without-die-caller.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/cfi-without-die-caller.c
|
||||
@@ -0,0 +1,28 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+typedef int (*callback_t) (void);
|
||||
+
|
||||
+int
|
||||
+caller (callback_t callback)
|
||||
+{
|
||||
+ /* Ensure some frame content to push away the return address. */
|
||||
+ volatile const long one = 1;
|
||||
+
|
||||
+ /* Modify the return value to prevent any tail-call optimization. */
|
||||
+ return (*callback) () - one;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/cfi-without-die-main.c b/gdb/testsuite/gdb.base/cfi-without-die-main.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/cfi-without-die-main.c
|
||||
@@ -0,0 +1,32 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 3 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License
|
||||
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+typedef int (*callback_t) (void);
|
||||
+
|
||||
+extern int caller (callback_t callback);
|
||||
+
|
||||
+int
|
||||
+callback (void)
|
||||
+{
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main (void)
|
||||
+{
|
||||
+ return caller (callback);
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.base/cfi-without-die.exp b/gdb/testsuite/gdb.base/cfi-without-die.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.base/cfi-without-die.exp
|
||||
@@ -0,0 +1,71 @@
|
||||
+# Copyright 2010 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+# Test CFI is parsed even for range (function) not described by any DIE.
|
||||
+
|
||||
+set testfile cfi-without-die
|
||||
+set srcmainfile ${testfile}-main.c
|
||||
+set srccallerfile ${testfile}-caller.c
|
||||
+set executable ${testfile}
|
||||
+set objmainfile [standard_output_file ${testfile}-main.o]
|
||||
+set objcallerfile [standard_output_file ${testfile}-caller.o]
|
||||
+set binfile [standard_output_file ${executable}]
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srccallerfile}" ${objcallerfile} \
|
||||
+ object [list {additional_flags=-fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables}]] != ""
|
||||
+ || [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" ${objmainfile} object {debug}] != ""
|
||||
+ || [gdb_compile "${objmainfile} ${objcallerfile}" ${binfile} executable {}] != "" } {
|
||||
+ untested ${testfile}.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart $executable
|
||||
+
|
||||
+if ![runto callback] then {
|
||||
+ fail "verify unwinding: Can't run to callback"
|
||||
+ return 0
|
||||
+}
|
||||
+set test "verify unwinding breaks without CFI"
|
||||
+gdb_test_multiple "bt" $test {
|
||||
+ -re " in \[?\]\[?\] .*\r\n$gdb_prompt $" {
|
||||
+ # It may backtrace through some random frames even to main().
|
||||
+ pass $test
|
||||
+ }
|
||||
+ -re " in main .*\r\n$gdb_prompt $" {
|
||||
+ fail $test
|
||||
+ }
|
||||
+ -re "\r\n$gdb_prompt $" {
|
||||
+ pass $test
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+if { [gdb_compile "${srcdir}/${subdir}/${srccallerfile}" ${objcallerfile} \
|
||||
+ object [list {additional_flags=-fomit-frame-pointer -funwind-tables -fasynchronous-unwind-tables}]] != ""
|
||||
+ || [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" ${objmainfile} object {debug}] != ""
|
||||
+ || [gdb_compile "${objmainfile} ${objcallerfile}" ${binfile} executable {}] != "" } {
|
||||
+ untested ${testfile}.exp
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+clean_restart $executable
|
||||
+
|
||||
+if ![runto callback] then {
|
||||
+ fail "test CFI without DIEs: Can't run to callback"
|
||||
+ return 0
|
||||
+}
|
||||
+# #0 callback () at ...
|
||||
+# #1 0x00000000004004e9 in caller ()
|
||||
+# #2 0x00000000004004cd in main () at ...
|
||||
+gdb_test "bt" "#0 +callback \[^\r\n\]+\r\n#1 \[^\r\n\]+ in caller \[^\r\n\]+\r\n#2 \[^\r\n\]+ in main \[^\r\n\]+" "verify unwindin works for CFI without DIEs"
|
||||
9
gdbinit
Normal file
9
gdbinit
Normal file
@ -0,0 +1,9 @@
|
||||
# System-wide GDB initialization file.
|
||||
python
|
||||
import glob
|
||||
# glob.iglob is not available in python-2.4 (RHEL-5).
|
||||
for f in glob.glob('%{_sysconfdir}/gdbinit.d/*.gdb'):
|
||||
gdb.execute('source %s' % f)
|
||||
for f in glob.glob('%{_sysconfdir}/gdbinit.d/*.py'):
|
||||
gdb.execute('source %s' % f)
|
||||
end
|
||||
81
generate-git-repo-from-patches.sh
Executable file
81
generate-git-repo-from-patches.sh
Executable file
@ -0,0 +1,81 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Generic function to print an error message and bail out.
|
||||
die ()
|
||||
{
|
||||
echo $1 > /dev/stderr
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Print usage
|
||||
usage ()
|
||||
{
|
||||
cat <<EOF
|
||||
$0 -- Generate a git repository from .patch files
|
||||
|
||||
Usage:
|
||||
$0 [-u] [-h] <REPOSITORY>
|
||||
|
||||
<REPOSITORY> is the directory where the rebase was performed. You
|
||||
need to clone the repository first.
|
||||
|
||||
Options are:
|
||||
|
||||
-h: Print this message
|
||||
-u: Uncommit all patches and initialize stgit repo
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
test -f gdb.spec || die "This script needs to run from the same directory as gdb.spec."
|
||||
|
||||
test -z $1 && die "You need to specify the repository."
|
||||
test "$1" = "-h" && usage
|
||||
|
||||
uncommit=0
|
||||
if [ "$1" = "-u" ]; then
|
||||
command -v stg > /dev/null 2>&1 \
|
||||
|| die "Cannot find stg. Is stgit installed?"
|
||||
uncommit=1
|
||||
shift
|
||||
fi
|
||||
|
||||
git_repo=$1
|
||||
if [ ! -e $git_repo ]; then
|
||||
echo "$0: repository \"$git_repo\" does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
test -f _git_upstream_commit || die "Cannot find _git_upstream_commit file."
|
||||
test -f _patch_order || die "Cannot find _patch_order file."
|
||||
|
||||
last_ancestor_commit=`cat _git_upstream_commit`
|
||||
|
||||
f=`pwd`
|
||||
cd $1
|
||||
|
||||
git name-rev $last_ancestor_commit
|
||||
test $? -eq 0 || die "Could not find $last_ancestor_commit in the repository $1. Did you run 'git fetch'?"
|
||||
|
||||
|
||||
# Create a branch for the checkout if using stgit; use the distro name in
|
||||
# the name of this branch.
|
||||
if (($uncommit)); then
|
||||
name=devel-`basename $f`
|
||||
branch="-b $name"
|
||||
else
|
||||
branch=""
|
||||
fi
|
||||
git checkout $branch $last_ancestor_commit
|
||||
|
||||
echo "Applying patches..."
|
||||
for p in `cat $f/_patch_order` ; do
|
||||
git am $f/$p
|
||||
test $? -eq 0 || die "Could not apply patch '$p'."
|
||||
done
|
||||
|
||||
if (($uncommit)); then
|
||||
echo "Uncommitting patches..."
|
||||
stg init
|
||||
stg uncommit -t $last_ancestor_commit -x
|
||||
fi
|
||||
112
generate-patches-from-git-repo.sh
Executable file
112
generate-patches-from-git-repo.sh
Executable file
@ -0,0 +1,112 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Generic function to print an error message and bail out.
|
||||
die ()
|
||||
{
|
||||
echo $1 > /dev/stderr
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Print usage
|
||||
usage ()
|
||||
{
|
||||
cat <<EOF
|
||||
$0 -- Generate .patch files for a RPM package from a git repository
|
||||
|
||||
Usage:
|
||||
$0 <REPOSITORY> [<COMMIT_OR_TAG_OR_BRANCH>]
|
||||
|
||||
<REPOSITORY> is the directory where the rebase was performed.
|
||||
|
||||
<COMMIT_OR_TAG_OR_BRANCH> is the commit or tag or branch against which
|
||||
the rebase was performed. It generally just needs to be provided if
|
||||
the file "_git_upstream_commit" doesn't exist, or if you are doing a
|
||||
rebase. This script will then use 'git merge-base' to find the most
|
||||
recent common ancestor between HEAD and COMMIT_OR_TAG_OR_BRANCH.
|
||||
|
||||
Options are:
|
||||
|
||||
-h: Print this message
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
test -f gdb.spec || die "This script needs to run from the same directory as gdb.spec."
|
||||
|
||||
test -z $1 && die "You need to specify the repository."
|
||||
test "$1" = "-h" && usage
|
||||
|
||||
commit_or_tag="`cat _git_upstream_commit`"
|
||||
if test ! -z "$2" ; then
|
||||
commit_or_tag="$2"
|
||||
fi
|
||||
|
||||
test -z $commit_or_tag && die "Because the '_git_upstream_commit' file doesn't exist, you need to specify a commit/tag/branch."
|
||||
|
||||
test -d $1 || die "$1 is not a directory."
|
||||
|
||||
# Remove all the current patches
|
||||
for f in `cat _patch_order` ; do
|
||||
git rm -f $f
|
||||
done
|
||||
|
||||
orig_dir=`pwd`
|
||||
cd $1
|
||||
|
||||
# If patches were uncommitted when the patches were applied,
|
||||
# make sure that we're sitting at the top-most patch. Otherwise
|
||||
# we'll only add patches up to the current top patch.
|
||||
# It's safe to just assume stgit was used -- the push will simply
|
||||
# fail.
|
||||
stg push --all > /dev/null 2>&1
|
||||
|
||||
git name-rev $commit_or_tag
|
||||
test $? -eq 0 || die "Could not find $commit_or_tag in the repository. Did you run 'git fetch'?"
|
||||
|
||||
idx=1
|
||||
common_ancestor=`git merge-base HEAD $commit_or_tag`
|
||||
|
||||
test -z "$common_ancestor" && die "Could not find common ancestor between HEAD and $commit_or_tag."
|
||||
|
||||
temp_PATCH_file=/tmp/_gdb.spec.Patch.include
|
||||
temp_patch_file=/tmp/_gdb.spec.patch.include
|
||||
temp_patch_order_file=/tmp/_patch_order
|
||||
|
||||
rm -f $temp_PATCH_file $temp_patch_file $temp_patch_order_file
|
||||
|
||||
for c in `git rev-list --reverse ${common_ancestor}..HEAD` ; do
|
||||
fname=`git log -1 --pretty='format:%s' $c`
|
||||
test -z $fname && die "Could not determine filename for commit $c."
|
||||
# Because git-format-patch generates patches with the first line
|
||||
# containing the commit hash, every time we do a git-format-patch
|
||||
# here we will have a different .patch file from what we had
|
||||
# before, even if nothing has changed. This is bad, so we replace
|
||||
# the commit hash by something constant (the string
|
||||
# "FEDORA_PATCHES").
|
||||
#
|
||||
# Also, different users, or systems, might configure git in
|
||||
# different ways (e.g. the diff.*.xfuncname setting), which can
|
||||
# mean the generated diff files will change from system to system.
|
||||
# Avoid this by disabling all config file reading, this relies on
|
||||
# git 2.32 or later.
|
||||
GIT_CONFIG_SYSTEM=/dev/null GIT_CONFIG_GLOBAL=/dev/null \
|
||||
git format-patch --no-base --no-thread --no-signature --no-stat \
|
||||
--keep-subject -1 --stdout $c \
|
||||
| sed -e '1 s/^From [0-9a-f]\+ \(.*\)/From FEDORA_PATCHES \1/' \
|
||||
-e '/^index [0-9a-f]\+\.\.[0-9a-f]\+.*$/d' > $orig_dir/$fname
|
||||
(cd $orig_dir && git add $fname)
|
||||
|
||||
cat >> $temp_PATCH_file <<EOF
|
||||
`git log -1 --pretty='format:%b' $c | sed -n 's/^;;/#/p'`
|
||||
EOF
|
||||
printf "Patch%03d: %s\n\n" $idx $fname >> $temp_PATCH_file
|
||||
printf "%%patch -p1 -P%03d\n" $idx >> $temp_patch_file
|
||||
echo $fname >> $temp_patch_order_file
|
||||
idx=`expr $idx + 1`
|
||||
done
|
||||
|
||||
cd $orig_dir
|
||||
mv $temp_PATCH_file _gdb.spec.Patch.include
|
||||
mv $temp_patch_file _gdb.spec.patch.include
|
||||
mv $temp_patch_order_file _patch_order
|
||||
echo "$common_ancestor" > _git_upstream_commit
|
||||
6
plans/ci.fmf
Normal file
6
plans/ci.fmf
Normal file
@ -0,0 +1,6 @@
|
||||
summary: CI Gating Plan
|
||||
discover:
|
||||
how: fmf
|
||||
directory: tests
|
||||
execute:
|
||||
how: tmt
|
||||
1
sources
Normal file
1
sources
Normal file
@ -0,0 +1 @@
|
||||
SHA512 (gdb-16.2.tar.xz) = f04a6335dbdee371edb7e3213294fcbb878ac39adedb73f7e17e621f54350488f5f5bea9bc742639239c122d590bed158771a74fc3aaeaa7fa0ae304232576a3
|
||||
68
tests/gdb-testsuite-sanity/Makefile
Normal file
68
tests/gdb-testsuite-sanity/Makefile
Normal file
@ -0,0 +1,68 @@
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Makefile of /tools/gdb/Sanity/gdb-testsuite-sanity
|
||||
# Description: gdb testing by upstream testsuite
|
||||
# Author: Michal Kolar <mkolar@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2021 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software: you can 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, see http://www.gnu.org/licenses/.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
export TEST=/tools/gdb/Sanity/gdb-testsuite-sanity
|
||||
export TESTVERSION=1.0
|
||||
|
||||
BUILT_FILES=
|
||||
|
||||
FILES=$(METADATA) runtest.sh Makefile PURPOSE ref
|
||||
|
||||
.PHONY: all install download clean
|
||||
|
||||
run: $(FILES) build
|
||||
./runtest.sh
|
||||
|
||||
build: $(BUILT_FILES)
|
||||
test -x runtest.sh || chmod a+x runtest.sh
|
||||
|
||||
.SILENT: ref_file
|
||||
ref_file: ./ref/gen.sh
|
||||
test -x ./ref/gen.sh || chmod a+x ./ref/gen.sh
|
||||
./ref/gen.sh
|
||||
|
||||
clean:
|
||||
rm -f *~ $(BUILT_FILES)
|
||||
|
||||
|
||||
include /usr/share/rhts/lib/rhts-make.include
|
||||
|
||||
$(METADATA): Makefile
|
||||
@echo "Owner: Michal Kolar <mkolar@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "Description: gdb testing by upstream testsuite" >> $(METADATA)
|
||||
@echo "Type: Sanity" >> $(METADATA)
|
||||
@echo "TestTime: 1h" >> $(METADATA)
|
||||
@echo "RunFor: gdb" >> $(METADATA)
|
||||
@echo "Requires: gdb rpm-build yum-utils dejagnu make gcc gcc-gfortran glibc" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "License: GPLv2+" >> $(METADATA)
|
||||
@echo "Confidential: no" >> $(METADATA)
|
||||
@echo "Destructive: no" >> $(METADATA)
|
||||
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHEL6 -RHEL7" >> $(METADATA)
|
||||
|
||||
rhts-lint $(METADATA)
|
||||
30
tests/gdb-testsuite-sanity/PURPOSE
Normal file
30
tests/gdb-testsuite-sanity/PURPOSE
Normal file
@ -0,0 +1,30 @@
|
||||
PURPOSE of /tools/gdb/Sanity/gdb-testsuite-sanity
|
||||
Description: gdb testing by upstream testsuite
|
||||
Author: Michal Kolar <mkolar@redhat.com>
|
||||
|
||||
By default, testsuite is executed with default options for the package that
|
||||
corresponds to the gdb command by newly created ordinary user. Before
|
||||
executing, the testsuite is reduced by the appropriate reference file that
|
||||
defines the allowed test range.
|
||||
|
||||
Executing can be modified by these variables:
|
||||
* BUILD_USER -- user which will be used for building and testing gdb
|
||||
* PACKAGE -- explicitly defines which rpm package should be tested
|
||||
* RUNTESTFLAGS -- variable which will be forwarded to 'make check' command
|
||||
and can be used to reduce the range of testing
|
||||
* TESTS_COUNT_MIN -- minimum number of cases that should be tested (does not
|
||||
affect the triggering of testcases, it only sets the
|
||||
value of the reference comparator)
|
||||
|
||||
Example:
|
||||
$ BUILD_USER=root \
|
||||
PACKAGE=gdb \
|
||||
RUNTESTFLAGS='GDB=/usr/bin/gdb gdb.base/break*.exp' \
|
||||
TESTS_COUNT_MIN=32 make run
|
||||
|
||||
Reference files instructions:
|
||||
* path of reference file for current package, distribution and architecture
|
||||
can be generated by:
|
||||
$ make ref_file
|
||||
or directly by:
|
||||
$ ./ref/gen.sh
|
||||
46
tests/gdb-testsuite-sanity/main.fmf
Normal file
46
tests/gdb-testsuite-sanity/main.fmf
Normal file
@ -0,0 +1,46 @@
|
||||
summary: gdb testing by upstream testsuite
|
||||
description: |
|
||||
By default, testsuite is executed with default options for the package that
|
||||
corresponds to the gdb command by newly created ordinary user. Before
|
||||
executing, the testsuite is reduced by the appropriate reference file that
|
||||
defines the allowed test range.
|
||||
|
||||
Executing can be modified by these variables:
|
||||
* BUILD_USER -- user which will be used for building and testing gdb
|
||||
* PACKAGE -- explicitly defines which rpm package should be tested
|
||||
* RUNTESTFLAGS -- variable which will be forwarded to 'make check' command
|
||||
and can be used to reduce the range of testing
|
||||
* TESTS_COUNT_MIN -- minimum number of cases that should be tested (does not
|
||||
affect the triggering of testcases, it only sets the
|
||||
value of the reference comparator)
|
||||
|
||||
Example:
|
||||
$ BUILD_USER=root \
|
||||
PACKAGE=gdb \
|
||||
RUNTESTFLAGS='GDB=/usr/bin/gdb gdb.base/break*.exp' \
|
||||
TESTS_COUNT_MIN=32 make run
|
||||
|
||||
Reference files instructions:
|
||||
* path of reference file for current package, distribution and architecture
|
||||
can be generated by:
|
||||
$ make ref_file
|
||||
or directly by:
|
||||
$ ./ref/gen.sh
|
||||
contact: Michal Kolar <mkolar@redhat.com>
|
||||
component:
|
||||
- gdb
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- gdb
|
||||
- rpm-build
|
||||
- yum-utils
|
||||
- dejagnu
|
||||
- make
|
||||
- gcc
|
||||
- gcc-gfortran
|
||||
- glibc
|
||||
- glibc-debuginfo
|
||||
duration: 1h
|
||||
extra-summary: /tools/gdb/Sanity/gdb-testsuite-sanity
|
||||
extra-task: /tools/gdb/Sanity/gdb-testsuite-sanity
|
||||
430
tests/gdb-testsuite-sanity/ref/default
Normal file
430
tests/gdb-testsuite-sanity/ref/default
Normal file
@ -0,0 +1,430 @@
|
||||
gdb.base/advance-until-multiple-locations.exp
|
||||
gdb.base/alias.exp
|
||||
gdb.base/align-c.exp
|
||||
gdb.base/annota-input-while-running.exp
|
||||
gdb.base/anon.exp
|
||||
gdb.base/args.exp
|
||||
gdb.base/arrayidx.exp
|
||||
gdb.base/attach-non-pgrp-leader.exp
|
||||
gdb.base/attach-pie-noexec.exp
|
||||
gdb.base/attach-twice.exp
|
||||
gdb.base/attach-wait-input.exp
|
||||
gdb.base/auto-load.exp
|
||||
gdb.base/bang.exp
|
||||
gdb.base/batch-exit-status.exp
|
||||
gdb.base/bfp-test.exp
|
||||
gdb.base/bg-execution-repeat.exp
|
||||
gdb.base/bitfields2.exp
|
||||
gdb.base/bitfields.exp
|
||||
gdb.base/bitops.exp
|
||||
gdb.base/bp-cmds-execution-x-script.exp
|
||||
gdb.base/branch-to-self.exp
|
||||
gdb.base/break-always.exp
|
||||
gdb.base/break-caller-line.exp
|
||||
gdb.base/break-include.exp
|
||||
gdb.base/break-inline.exp
|
||||
gdb.base/break-main-file-remove-fail.exp
|
||||
gdb.base/break-on-linker-gcd-function.exp
|
||||
gdb.base/breakpoint-shadow.exp
|
||||
gdb.base/break-probes.exp
|
||||
gdb.base/cached-source-file.exp
|
||||
gdb.base/callexit.exp
|
||||
gdb.base/call-strs.exp
|
||||
gdb.base/catch-follow-exec.exp
|
||||
gdb.base/catch-gdb-caused-signals.exp
|
||||
gdb.base/catch-signal-fork.exp
|
||||
gdb.base/catch-signal-siginfo-cond.exp
|
||||
gdb.base/check-psymtab.exp
|
||||
gdb.base/c-linkage-name.exp
|
||||
gdb.base/code_elim.exp
|
||||
gdb.base/command-line-input.exp
|
||||
gdb.base/compare-sections.exp
|
||||
gdb.base/complex.exp
|
||||
gdb.base/comprdebug.exp
|
||||
gdb.base/consecutive-step-over.exp
|
||||
gdb.base/continue-all-already-running.exp
|
||||
gdb.base/coredump-filter.exp
|
||||
gdb.base/corefile2.exp
|
||||
gdb.base/cursal.exp
|
||||
gdb.base/datalib.exp
|
||||
gdb.base/dcache-line-read-error.exp
|
||||
gdb.base/default-args.exp
|
||||
gdb.base/define.exp
|
||||
gdb.base/disabled-location.exp
|
||||
gdb.base/disasm-end-cu.exp
|
||||
gdb.base/disasm-optim.exp
|
||||
gdb.base/double-prompt-target-event-error.exp
|
||||
gdb.base/dprintf-detach.exp
|
||||
gdb.base/dprintf-next.exp
|
||||
gdb.base/dprintf-non-stop.exp
|
||||
gdb.base/dprintf-pending.exp
|
||||
gdb.base/dso2dso.exp
|
||||
gdb.base/dump.exp
|
||||
gdb.base/dup-sect.exp
|
||||
gdb.base/echo.exp
|
||||
gdb.base/empty_exe.exp
|
||||
gdb.base/endian.exp
|
||||
gdb.base/endianity.exp
|
||||
gdb.base/enumval.exp
|
||||
gdb.base/environ.exp
|
||||
gdb.base/eu-strip-infcall.exp
|
||||
gdb.base/eval.exp
|
||||
gdb.base/examine-backward.exp
|
||||
gdb.base/exec-invalid-sysroot.exp
|
||||
gdb.base/execution-termios.exp
|
||||
gdb.base/exe-lock.exp
|
||||
gdb.base/exitsignal.exp
|
||||
gdb.base/expand-psymtabs.exp
|
||||
gdb.base/filesym.exp
|
||||
gdb.base/find-unmapped.exp
|
||||
gdb.base/fixsection.exp
|
||||
gdb.base/flexible-array-member.exp
|
||||
gdb.base/float.exp
|
||||
gdb.base/floatn.exp
|
||||
gdb.base/focus-cmd-prev.exp
|
||||
gdb.base/foll-exec.exp
|
||||
gdb.base/foll-exec-mode.exp
|
||||
gdb.base/fortran-sym-case.exp
|
||||
gdb.base/frame-selection.exp
|
||||
gdb.base/freebpcmd.exp
|
||||
gdb.base/fullname.exp
|
||||
gdb.base/fullpath-expand.exp
|
||||
gdb.base/func-ptr.exp
|
||||
gdb.base/gcore-buffer-overflow.exp
|
||||
gdb.base/gcore-relro.exp
|
||||
gdb.base/gdb1056.exp
|
||||
gdb.base/gdb1090.exp
|
||||
gdb.base/gdb11530.exp
|
||||
gdb.base/gdb11531.exp
|
||||
gdb.base/gdb1250.exp
|
||||
gdb.base/gdb1555.exp
|
||||
gdb.base/gdb1821.exp
|
||||
gdb.base/gdbhistsize-history.exp
|
||||
gdb.base/gdb-sigterm-2.exp
|
||||
gdb.base/hashline2.exp
|
||||
gdb.base/hashline3.exp
|
||||
gdb.base/hbreak.exp
|
||||
gdb.base/hbreak-unmapped.exp
|
||||
gdb.base/help.exp
|
||||
gdb.base/history-duplicates.exp
|
||||
gdb.base/hook-stop.exp
|
||||
gdb.base/huge.exp
|
||||
gdb.base/hw-sw-break-same-address.exp
|
||||
gdb.base/ifelse.exp
|
||||
gdb.base/index-cache.exp
|
||||
gdb.base/infcall-input.exp
|
||||
gdb.base/infcall-nested-structs-c++.exp
|
||||
gdb.base/infcall-nested-structs-c.exp
|
||||
gdb.base/infnan.exp
|
||||
gdb.base/infoline.exp
|
||||
gdb.base/info-locals-unused-static-var.exp
|
||||
gdb.base/info_minsym.exp
|
||||
gdb.base/info-proc.exp
|
||||
gdb.base/info-program.exp
|
||||
gdb.base/info_qt.exp
|
||||
gdb.base/info-shared.exp
|
||||
gdb.base/info_sources.exp
|
||||
gdb.base/info-target.exp
|
||||
gdb.base/info-types-c++.exp
|
||||
gdb.base/info-types-c.exp
|
||||
gdb.base/info-var.exp
|
||||
gdb.base/interact.exp
|
||||
gdb.base/interrupt-daemon-attach.exp
|
||||
gdb.base/interrupt-daemon.exp
|
||||
gdb.base/interrupt-noterm.exp
|
||||
gdb.base/jit-attach-pie.exp
|
||||
gdb.base/jit-reader-exec.exp
|
||||
gdb.base/jit-reader-simple.exp
|
||||
gdb.base/jump.exp
|
||||
gdb.base/kill-detach-inferiors-cmd.exp
|
||||
gdb.base/killed-outside.exp
|
||||
gdb.base/label.exp
|
||||
gdb.base/label-without-address.exp
|
||||
gdb.base/largecore-last-address-lock.exp
|
||||
gdb.base/lineinc.exp
|
||||
gdb.base/lineno-makeup.exp
|
||||
gdb.base/linespecs.exp
|
||||
gdb.base/line-symtabs.exp
|
||||
gdb.base/list-ambiguous.exp
|
||||
gdb.base/list-missing-source.exp
|
||||
gdb.base/logical.exp
|
||||
gdb.base/longest-types.exp
|
||||
gdb.base/longjmp.exp
|
||||
gdb.base/long_long.exp
|
||||
gdb.base/maint-expand-symbols-header-file.exp
|
||||
gdb.base/maint-target-async-off.exp
|
||||
gdb.base/many-completions.exp
|
||||
gdb.base/many-headers.exp
|
||||
gdb.base/max-depth-c++.exp
|
||||
gdb.base/max-depth-c.exp
|
||||
gdb.base/max-value-size.exp
|
||||
gdb.base/memattr.exp
|
||||
gdb.base/mips_pro.exp
|
||||
gdb.base/move-dir.exp
|
||||
gdb.base/msym-lang.exp
|
||||
gdb.base/nested-addr.exp
|
||||
gdb.base/nextoverexit.exp
|
||||
gdb.base/nodebug.exp
|
||||
gdb.base/noreturn-finish.exp
|
||||
gdb.base/noreturn-return.exp
|
||||
gdb.base/offsets.exp
|
||||
gdb.base/osabi.exp
|
||||
gdb.base/overlays.exp
|
||||
gdb.base/page.exp
|
||||
gdb.base/paginate-after-ctrl-c-running.exp
|
||||
gdb.base/paginate-bg-execution.exp
|
||||
gdb.base/paginate-execution-startup.exp
|
||||
gdb.base/paginate-inferior-exit.exp
|
||||
gdb.base/pc-fp.exp
|
||||
gdb.base/permissions.exp
|
||||
gdb.base/pr10179.exp
|
||||
gdb.base/pretty-print.exp
|
||||
gdb.base/prologue.exp
|
||||
gdb.base/prologue-include.exp
|
||||
gdb.base/psym-external-decl.exp
|
||||
gdb.base/psymtab.exp
|
||||
gdb.base/ptr-typedef.exp
|
||||
gdb.base/quit.exp
|
||||
gdb.base/quit-live.exp
|
||||
gdb.base/randomize.exp
|
||||
gdb.base/random-signal.exp
|
||||
gdb.base/readline-overflow.exp
|
||||
gdb.base/reggroups.exp
|
||||
gdb.base/remote-exec-file.exp
|
||||
gdb.base/remote.exp
|
||||
gdb.base/remotetimeout.exp
|
||||
gdb.base/reread-readsym.exp
|
||||
gdb.base/return.exp
|
||||
gdb.base/return-nodebug.exp
|
||||
gdb.base/run-after-attach.exp
|
||||
gdb.base/save-bp.exp
|
||||
gdb.base/sect-cmd.exp
|
||||
gdb.base/sep.exp
|
||||
gdb.base/sepsymtab.exp
|
||||
gdb.base/server-del-break.exp
|
||||
gdb.base/set-inferior-tty.exp
|
||||
gdb.base/set-lang-auto.exp
|
||||
gdb.base/set-noassign.exp
|
||||
gdb.base/set-solib-absolute-prefix.exp
|
||||
gdb.base/shell.exp
|
||||
gdb.base/shreloc.exp
|
||||
gdb.base/sigall.exp
|
||||
gdb.base/sigchld.exp
|
||||
gdb.base/signest.exp
|
||||
gdb.base/sigrepeat.exp
|
||||
gdb.base/skip-inline.exp
|
||||
gdb.base/solib-disc.exp
|
||||
gdb.base/solib-nodir.exp
|
||||
gdb.base/solib-probes-nosharedlibrary.exp
|
||||
gdb.base/solib-vanish.exp
|
||||
gdb.base/source-execution.exp
|
||||
gdb.base/source.exp
|
||||
gdb.base/sss-bp-on-user-bp.exp
|
||||
gdb.base/stale-infcall.exp
|
||||
gdb.base/start.exp
|
||||
gdb.base/startup-with-shell.exp
|
||||
gdb.base/statistics.exp
|
||||
gdb.base/step-resume-infcall.exp
|
||||
gdb.base/step-sw-breakpoint-adjust-pc.exp
|
||||
gdb.base/step-symless.exp
|
||||
gdb.base/step-test.exp
|
||||
gdb.base/structs2.exp
|
||||
gdb.base/structs3.exp
|
||||
gdb.base/style.exp
|
||||
gdb.base/style-logging.exp
|
||||
gdb.base/symbol-alias.exp
|
||||
gdb.base/sym-file.exp
|
||||
gdb.base/symfile-warn.exp
|
||||
gdb.base/symlink-sourcefile.exp
|
||||
gdb.base/symtab-search-order.exp
|
||||
gdb.base/tab-crash.exp
|
||||
gdb.base/term.exp
|
||||
gdb.base/testenv.exp
|
||||
gdb.base/trace-commands.exp
|
||||
gdb.base/tracefork-zombie.exp
|
||||
gdb.base/twice.exp
|
||||
gdb.base/type-opaque.exp
|
||||
gdb.base/until.exp
|
||||
gdb.base/value-double-free.exp
|
||||
gdb.base/vdso-warning.exp
|
||||
gdb.base/vla-ptr.exp
|
||||
gdb.base/warning.exp
|
||||
gdb.base/watch-cond-infcall.exp
|
||||
gdb.base/watch-non-mem.exp
|
||||
gdb.base/watchpoint-cond-gone.exp
|
||||
gdb.base/watchpoint-delete.exp
|
||||
gdb.base/watchpoint-during-step.exp
|
||||
gdb.base/watch-vfork.exp
|
||||
gdb.base/wchar.exp
|
||||
gdb.base/with.exp
|
||||
gdb.base/with-mf.exp
|
||||
gdb.cp/abstract-origin.exp
|
||||
gdb.cp/ambiguous.exp
|
||||
gdb.cp/anon-ns.exp
|
||||
gdb.cp/anon-struct.exp
|
||||
gdb.cp/anon-union.exp
|
||||
gdb.cp/arg-reference.exp
|
||||
gdb.cp/b146835.exp
|
||||
gdb.cp/baseenum.exp
|
||||
gdb.cp/bool.exp
|
||||
gdb.cp/breakpoint-locs.exp
|
||||
gdb.cp/bs15503.exp
|
||||
gdb.cp/call-c.exp
|
||||
gdb.cp/chained-calls.exp
|
||||
gdb.cp/class2.exp
|
||||
gdb.cp/cmpd-minsyms.exp
|
||||
gdb.cp/converts.exp
|
||||
gdb.cp/cpcompletion.exp
|
||||
gdb.cp/cpexprs-debug-types.exp
|
||||
gdb.cp/cplabel.exp
|
||||
gdb.cp/cpsizeof.exp
|
||||
gdb.cp/ctti.exp
|
||||
gdb.cp/debug-expr.exp
|
||||
gdb.cp/demangle.exp
|
||||
gdb.cp/derivation.exp
|
||||
gdb.cp/destrprint.exp
|
||||
gdb.cp/disasm-func-name.exp
|
||||
gdb.cp/dispcxx.exp
|
||||
gdb.cp/ena-dis-br-range.exp
|
||||
gdb.cp/enum-class.exp
|
||||
gdb.cp/exception.exp
|
||||
gdb.cp/exceptprint.exp
|
||||
gdb.cp/expand-psymtabs-cxx.exp
|
||||
gdb.cp/expand-sals.exp
|
||||
gdb.cp/extern-c.exp
|
||||
gdb.cp/formatted-ref.exp
|
||||
gdb.cp/fpointer.exp
|
||||
gdb.cp/gdb1355.exp
|
||||
gdb.cp/hang.exp
|
||||
gdb.cp/impl-this.exp
|
||||
gdb.cp/infcall-dlopen.exp
|
||||
gdb.cp/infcall-nodebug-c++-d0.exp
|
||||
gdb.cp/infcall-nodebug-c-d0.exp
|
||||
gdb.cp/infcall-nodebug-c++-d1.exp
|
||||
gdb.cp/infcall-nodebug-c-d1.exp
|
||||
gdb.cp/iostream.exp
|
||||
gdb.cp/local-static.exp
|
||||
gdb.cp/mb-inline.exp
|
||||
gdb.cp/mb-templates.exp
|
||||
gdb.cp/m-data.exp
|
||||
gdb.cp/member-name.exp
|
||||
gdb.cp/member-ptr.exp
|
||||
gdb.cp/method2.exp
|
||||
gdb.cp/method.exp
|
||||
gdb.cp/meth-typedefs.exp
|
||||
gdb.cp/namelessclass.exp
|
||||
gdb.cp/namespace-enum.exp
|
||||
gdb.cp/namespace.exp
|
||||
gdb.cp/namespace-nested-import.exp
|
||||
gdb.cp/nested-types.exp
|
||||
gdb.cp/nextoverthrow.exp
|
||||
gdb.cp/non-trivial-retval.exp
|
||||
gdb.cp/noparam.exp
|
||||
gdb.cp/nsalias.exp
|
||||
gdb.cp/nsdecl.exp
|
||||
gdb.cp/nsimport.exp
|
||||
gdb.cp/nsnoimports.exp
|
||||
gdb.cp/nsrecurs.exp
|
||||
gdb.cp/nsstress.exp
|
||||
gdb.cp/operator.exp
|
||||
gdb.cp/overload-const.exp
|
||||
gdb.cp/overload.exp
|
||||
gdb.cp/ovsrch.exp
|
||||
gdb.cp/paren-type.exp
|
||||
gdb.cp/parse-lang.exp
|
||||
gdb.cp/pass-by-ref-2.exp
|
||||
gdb.cp/pass-by-ref.exp
|
||||
gdb.cp/pr-1023.exp
|
||||
gdb.cp/pr10687.exp
|
||||
gdb.cp/pr10728.exp
|
||||
gdb.cp/pr11734.exp
|
||||
gdb.cp/pr12028.exp
|
||||
gdb.cp/pr-1210.exp
|
||||
gdb.cp/pr12273.exp
|
||||
gdb.cp/pr17132.exp
|
||||
gdb.cp/pr9067.exp
|
||||
gdb.cp/pr9631.exp
|
||||
gdb.cp/print-demangle.exp
|
||||
gdb.cp/printmethod.exp
|
||||
gdb.cp/psmang.exp
|
||||
gdb.cp/psymtab-parameter.exp
|
||||
gdb.cp/ptype-cv-cp.exp
|
||||
gdb.cp/ptype-flags.exp
|
||||
gdb.cp/punctuator.exp
|
||||
gdb.cp/readnow-language.exp
|
||||
gdb.cp/ref-params.exp
|
||||
gdb.cp/re-set-overloaded.exp
|
||||
gdb.cp/rtti.exp
|
||||
gdb.cp/rvalue-ref-casts.exp
|
||||
gdb.cp/rvalue-ref-params.exp
|
||||
gdb.cp/rvalue-ref-sizeof.exp
|
||||
gdb.cp/rvalue-ref-types.exp
|
||||
gdb.cp/save-bp-qualified.exp
|
||||
gdb.cp/scope-err.exp
|
||||
gdb.cp/shadow.exp
|
||||
gdb.cp/smartp.exp
|
||||
gdb.cp/static-method.exp
|
||||
gdb.cp/static-print-quit.exp
|
||||
gdb.cp/static-typedef-print.exp
|
||||
gdb.cp/stub-array-size.exp
|
||||
gdb.cp/subtypes.exp
|
||||
gdb.cp/try_catch.exp
|
||||
gdb.cp/typedef-base.exp
|
||||
gdb.cp/typedef-operator.exp
|
||||
gdb.cp/typed-enum.exp
|
||||
gdb.cp/userdef.exp
|
||||
gdb.cp/using-crash.exp
|
||||
gdb.cp/virtbase2.exp
|
||||
gdb.cp/virtbase.exp
|
||||
gdb.cp/virtfunc2.exp
|
||||
gdb.cp/wide_char_types.exp
|
||||
gdb.fortran/array-bounds.exp
|
||||
gdb.fortran/array-bounds-high.exp
|
||||
gdb.fortran/array-element.exp
|
||||
gdb.fortran/array-slices-bad.exp
|
||||
gdb.fortran/array-slices-sub-slices.exp
|
||||
gdb.fortran/block-data.exp
|
||||
gdb.fortran/charset.exp
|
||||
gdb.fortran/class-allocatable-array.exp
|
||||
gdb.fortran/common-block.exp
|
||||
gdb.fortran/complex.exp
|
||||
gdb.fortran/derived-type.exp
|
||||
gdb.fortran/derived-type-function.exp
|
||||
gdb.fortran/derived-type-striding.exp
|
||||
gdb.fortran/dot-ops.exp
|
||||
gdb.fortran/exprs.exp
|
||||
gdb.fortran/info-modules.exp
|
||||
gdb.fortran/info-types.exp
|
||||
gdb.fortran/intrinsics.exp
|
||||
gdb.fortran/library-module.exp
|
||||
gdb.fortran/logical.exp
|
||||
gdb.fortran/max-depth.exp
|
||||
gdb.fortran/mixed-lang-stack.exp
|
||||
gdb.fortran/module.exp
|
||||
gdb.fortran/multi-dim.exp
|
||||
gdb.fortran/nested-funcs-2.exp
|
||||
gdb.fortran/nested-funcs.exp
|
||||
gdb.fortran/pointer-to-pointer.exp
|
||||
gdb.fortran/print-formatted.exp
|
||||
gdb.fortran/printing-types.exp
|
||||
gdb.fortran/print_type.exp
|
||||
gdb.fortran/ptr-indentation.exp
|
||||
gdb.fortran/ptype-on-functions.exp
|
||||
gdb.fortran/short-circuit-argument-list.exp
|
||||
gdb.fortran/subarray.exp
|
||||
gdb.fortran/type-kinds.exp
|
||||
gdb.fortran/types.exp
|
||||
gdb.fortran/vla-alloc-assoc.exp
|
||||
gdb.fortran/vla-datatypes.exp
|
||||
gdb.fortran/vla-history.exp
|
||||
gdb.fortran/vla-ptr-info.exp
|
||||
gdb.fortran/vla-ptype.exp
|
||||
gdb.fortran/vla-ptype-sub.exp
|
||||
gdb.fortran/vla-sizeof.exp
|
||||
gdb.fortran/vla-type.exp
|
||||
gdb.fortran/vla-value.exp
|
||||
gdb.fortran/vla-value-sub-arbitrary.exp
|
||||
gdb.fortran/vla-value-sub.exp
|
||||
gdb.fortran/vla-value-sub-finish.exp
|
||||
gdb.fortran/whatis_type.exp
|
||||
gdb.fortran/xlf-variable.exp
|
||||
11
tests/gdb-testsuite-sanity/ref/gen.sh
Executable file
11
tests/gdb-testsuite-sanity/ref/gen.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
BIN=`which gdb` &&
|
||||
PACKAGE=`rpm -qf --qf='%{name}\n' ${BIN}` &&
|
||||
SYSTEM=`uname -r | grep -o -E 'el[0-9]+a?|fc[0-9]+'` &&
|
||||
ARCH=`arch` &&
|
||||
echo "./ref/${PACKAGE}/${SYSTEM}.${ARCH}" &&
|
||||
exit 0
|
||||
|
||||
echo "ERROR" >&2
|
||||
exit 1
|
||||
137
tests/gdb-testsuite-sanity/runtest.sh
Executable file
137
tests/gdb-testsuite-sanity/runtest.sh
Executable file
@ -0,0 +1,137 @@
|
||||
#!/bin/bash
|
||||
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /tools/gdb/Sanity/gdb-testsuite-sanity
|
||||
# Description: gdb testing by upstream testsuite
|
||||
# Author: Michal Kolar <mkolar@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2021 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software: you can 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, see http://www.gnu.org/licenses/.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
BUILD_USER=${BUILD_USER:-gdbbld}
|
||||
export PACKAGE="${PACKAGE:-$(rpm -qf --qf='%{name}\n' `which gdb`)}"
|
||||
RUNTESTFLAGS=${RUNTESTFLAGS:-GDB=`rpm -ql $PACKAGE | grep -E 'bin/gdb$'`}
|
||||
TESTS_COUNT_MIN=${TESTS_COUNT_MIN:-4000}
|
||||
REQUIRES="$PACKAGE rpm-build dejagnu make gcc glibc"
|
||||
if rlIsFedora; then
|
||||
REQUIRES="$REQUIRES dnf-utils"
|
||||
else
|
||||
REQUIRES="$REQUIRES yum-utils"
|
||||
fi
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlShowRunningKernel
|
||||
rlAssertRpm --all
|
||||
rlRun "TmpDir=\$(mktemp -d)"
|
||||
rlRun "cp -r ./ref $TmpDir"
|
||||
rlRun "pushd $TmpDir"
|
||||
rlFetchSrcForInstalled $PACKAGE
|
||||
rlRun "useradd -M -N $BUILD_USER" 0,9
|
||||
[ $? -eq 0 ] && rlRun "del=yes"
|
||||
rlRun "chown -R $BUILD_USER:users $TmpDir"
|
||||
rlRun "cp /proc/sys/kernel/core_pattern $TmpDir/core_pattern.bckp"
|
||||
rlRun "echo 'core.%p' >/proc/sys/kernel/core_pattern"
|
||||
rlRun "ulimit -c unlimited"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartSetup "build gdb"
|
||||
rlRun "su -c 'rpm -D \"_topdir $TmpDir\" -U *.src.rpm &>rpm.log' $BUILD_USER"
|
||||
rlRun "rlFileSubmit $TmpDir/rpm.log rpm.log"
|
||||
rlRun "su -c 'rpmbuild -D \"_topdir $TmpDir\" -bs --with testsuite $TmpDir/SPECS/*.spec &>rpmbuild-bs.log' $BUILD_USER"
|
||||
rlRun "rlFileSubmit $TmpDir/rpmbuild-bs.log rpmbuild-bs.log"
|
||||
rlRun "yum-builddep -y -D \"_topdir $TmpDir\" $TmpDir/SRPMS/*.src.rpm &>$TmpDir/yum-builddep.log" 0,1; ret=$?
|
||||
rlRun "rlFileSubmit $TmpDir/yum-builddep.log yum-builddep.log"
|
||||
if [ $ret -ne 0 ]; then
|
||||
rlLogWarning "Dependencies was not successfully installed"
|
||||
rlLogInfo "Trying to install dependencies of bare SPEC file ..."
|
||||
rlRun "yum-builddep -y -D \"_topdir $TmpDir\" $TmpDir/SPECS/*.spec &>$TmpDir/yum-builddep-spec.log"
|
||||
rlRun "rlFileSubmit $TmpDir/yum-builddep-spec.log yum-builddep-spec.log"
|
||||
fi
|
||||
rlRun "su -c 'rpmbuild -D \"_topdir $TmpDir\" -bp $TmpDir/SPECS/*.spec &>$TmpDir/rpmbuild-bp.log' $BUILD_USER"
|
||||
rlRun "rlFileSubmit $TmpDir/rpmbuild-bp.log rpmbuild-bp.log"
|
||||
rlRun "BUILD_DIR=`find $TmpDir -type f -name README | awk '{ print length, \$0 }' | sort -n -s | head -n 1 | cut -d ' ' -f 2- | sed 's|/README||'`"
|
||||
if test -e $BUILD_DIR/gnulib/configure; then
|
||||
rlRun "cd $BUILD_DIR/gnulib"
|
||||
rlRun "su -c 'bash ./configure &>$TmpDir/configure-gnulib.log' $BUILD_USER"
|
||||
rlRun "rlFileSubmit $TmpDir/configure-gnulib.log configure-gnulib.log"
|
||||
fi
|
||||
rlRun "configure_flags=\$(rpmspec -D \"_topdir $TmpDir\" -P $TmpDir/SPECS/*.spec | grep -o -E '\-\-(prefix|with\-gdb\-datadir|with\-separate\-debug\-dir|with\-python)=\S+' | tr '\n' ' ')"
|
||||
rlRun "cd $BUILD_DIR/gdb"
|
||||
rlRun "su -c './configure $configure_flags &>$TmpDir/configure.log' $BUILD_USER"
|
||||
rlRun "rlFileSubmit $TmpDir/configure.log configure.log"
|
||||
rlRun "DATADIR=`gdb -ex 'show data-directory' -batch | grep -o -E '/[^\"]+'`"
|
||||
rlRun "mv data-directory data-directory.orig"
|
||||
rlRun "ln -s $DATADIR ./data-directory"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartSetup "filter testsuite"
|
||||
rlRun "system=`uname -r | grep -o -E 'el[0-9]+a?|fc[0-9]+'` && [[ ! -z \$system ]]"
|
||||
rlRun "ref_file=$TmpDir/ref/$PACKAGE/$system.`arch`"
|
||||
if ! test -e $ref_file; then
|
||||
rlLogWarning "Reference file $ref_file not found"
|
||||
rlLogInfo "Using default reference file ..."
|
||||
rlRun "ref_file=$TmpDir/ref/default"
|
||||
fi
|
||||
rlRun "test -e $ref_file"
|
||||
rlRun "cd testsuite"
|
||||
rlRun "find . -regex '^./gdb\..+\.exp$' -type f -printf '%P\n' | sort >$TmpDir/test_list"
|
||||
rlRun "comm -23 $TmpDir/test_list $ref_file >$TmpDir/disable_list" # disable tests that are not included in the reference file
|
||||
rlLogInfo "Testcase disabling ..."
|
||||
while read file; do
|
||||
mv "$file" "$file.disabled"
|
||||
done <$TmpDir/disable_list
|
||||
rlRun "cd $BUILD_DIR/gdb"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "run testsuite"
|
||||
rlRun "su -c 'make check RUNTESTFLAGS=\"${RUNTESTFLAGS}\" |& tee $TmpDir/testsuite.log | grep -E \"^Running.+\.exp ...$\"; test \${PIPESTATUS[0]} -eq 0' $BUILD_USER"
|
||||
rlRun "rlFileSubmit $TmpDir/testsuite.log testsuite.log"
|
||||
rlRun "rlFileSubmit testsuite/gdb.sum gdb.sum"
|
||||
rlRun "rlFileSubmit testsuite/gdb.log gdb.log"
|
||||
rlLogInfo "`awk '/=== gdb Summary ===/,0' testsuite/gdb.sum`"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "evaluate results"
|
||||
rlRun "tests_count=\$(grep -E '^PASS:' testsuite/gdb.sum | wc -l)"
|
||||
[ "$tests_count" -ge "$TESTS_COUNT_MIN" ] && rlLogInfo "Test counter: $tests_count" || rlFail "Test counter $tests_count should be greater than or equal to $TESTS_COUNT_MIN"
|
||||
rlRun "awk 'BEGIN { RS=\"Running $BUILD_DIR/gdb/testsuite/\" } /\sERROR:|\sFAIL:|\sKPASS:|\sUNRESOLVED:|\sXPASS:/ { print \$0 }' testsuite/gdb.sum >$TmpDir/error.log" # check for errors, unresolved testcases, unexpected failures and unexpected successes
|
||||
if [ -s $TmpDir/error.log ]; then
|
||||
rlFail "Errors observed";
|
||||
rlRun "rlFileSubmit $TmpDir/error.log error.log"
|
||||
rlRun "awk 'BEGIN { RS=\"Running $BUILD_DIR/gdb/testsuite/\" } /\sERROR:|\sFAIL:|\sKPASS:|\sUNRESOLVED:|\sXPASS:/ { print \$1 }' testsuite/gdb.sum >$TmpDir/affected_testcases.log"
|
||||
rlLogInfo "`echo 'Affected testcases:';cat $TmpDir/affected_testcases.log`"
|
||||
rlRun "rlFileSubmit $TmpDir/affected_testcases.log affected_testcases.log"
|
||||
else
|
||||
rlPass "No errors observed"
|
||||
fi
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "cat $TmpDir/core_pattern.bckp >/proc/sys/kernel/core_pattern"
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir"
|
||||
[ "$del" = "yes" ] && rlRun "userdel -f $BUILD_USER"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
||||
220
tui-wrefresh-issue.patch
Normal file
220
tui-wrefresh-issue.patch
Normal file
@ -0,0 +1,220 @@
|
||||
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Burgess <aburgess@redhat.com>
|
||||
Date: Wed, 5 Feb 2025 20:12:03 +0000
|
||||
Subject: tui-wrefresh-issue.patch
|
||||
|
||||
;; Backport upstream commit 2b646bb8767, this fixes an issue where
|
||||
;; TUI output was not flushed to the screen in some cases. This will
|
||||
;; drop out when we rebase on 16.3 or 17.1.
|
||||
|
||||
gdb/tui: use wrefresh if output is not surpressed
|
||||
|
||||
Recent work in the TUI has improved GDB's use of the curses
|
||||
wnoutrefresh and doupdate mechanism, which improves performance by
|
||||
batching together updates and then doing a single set of writes to the
|
||||
screen when doupdate is finally called.
|
||||
|
||||
The tui_batch_rendering type is a RAII class which, in its destructor,
|
||||
calls doupdate to send the batched updates to the screen.
|
||||
|
||||
However, if there is no tui_batch_rendering active on the call stack
|
||||
then any wnoutrefresh calls will remain batched but undisplayed until
|
||||
the next time doupdate happens to be called.
|
||||
|
||||
This problem can be seen in PR gdb/32623. When an inferior is started
|
||||
the 'Starting program' message is not immediately displayed to the
|
||||
user.
|
||||
|
||||
The 'Starting program' message originates from run_command_1 in
|
||||
infcmd.c, the message is sent to the current_uiout, which will be the
|
||||
TUI ui_out. After the message is sent, ui_out::flush() is called,
|
||||
here's the backtrace when that happens:
|
||||
|
||||
#0 tui_file::flush (this=0x36e4ab0) at ../../src/gdb/tui/tui-file.c:42
|
||||
#1 0x0000000001004f4b in pager_file::flush (this=0x36d35f0) at ../../src/gdb/utils.c:1531
|
||||
#2 0x0000000001004f71 in gdb_flush (stream=0x36d35f0) at ../../src/gdb/utils.c:1539
|
||||
#3 0x00000000006975ab in cli_ui_out::do_flush (this=0x35a50b0) at ../../src/gdb/cli-out.c:250
|
||||
#4 0x00000000009fd1f9 in ui_out::flush (this=0x35a50b0) at ../../src/gdb/ui-out.h:263
|
||||
#5 0x00000000009f56ad in run_command_1 (args=0x0, from_tty=1, run_how=RUN_NORMAL) at ../../src/gdb/infcmd.c:449
|
||||
#6 0x00000000009f599a in run_command (args=0x0, from_tty=1) at ../../src/gdb/infcmd.c:511
|
||||
|
||||
And if we check out tui_file::flush (tui-file.c) we can see that this
|
||||
just calls tui_win_info::refresh_window(), which in turn, just uses
|
||||
wnoutrefresh to batch any pending output.
|
||||
|
||||
The problem is that, in the above backtrace, there is no
|
||||
tui_batch_rendering active, and so there will be no doupdate call to
|
||||
flush the output to the screen.
|
||||
|
||||
We could add a tui_batch_rendering into tui_file::flush. And
|
||||
tui_file::write. And tui_file::puts .....
|
||||
|
||||
... but that all seems a bit unnecessary. Instead, I propose that
|
||||
tui_win_info::refresh_window() should be changed. If suppress_output
|
||||
is true (i.e. a tui_batch_rendering is active) then we should continue
|
||||
to call wnoutrefresh(). But if suppress_output is false, meaning that
|
||||
no tui_batch_rendering is in place, then we should call wrefresh(),
|
||||
which immediately writes the output to the screen.
|
||||
|
||||
Testing but PR gdb/32623 was a little involved. We need to 'run' the
|
||||
inferior and check for the 'Starting program' message. But DejaGNUU
|
||||
can only check for the message once it knows the message should have
|
||||
appeared. But, as the bug is that output is not displayed, we don't
|
||||
have any output hints that the inferior is started yet...
|
||||
|
||||
In the end, I have the inferior create a file in the test's output
|
||||
directory. Now DejaGNU can send the 'run' command, and wait for the
|
||||
file to appear. Once that happens, we know that the 'Starting
|
||||
program' message should have appeared.
|
||||
|
||||
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32623
|
||||
|
||||
Approved-By: Tom Tromey <tom@tromey.com>
|
||||
|
||||
diff --git a/gdb/testsuite/gdb.tui/flush-after-run.c b/gdb/testsuite/gdb.tui/flush-after-run.c
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.tui/flush-after-run.c
|
||||
@@ -0,0 +1,54 @@
|
||||
+/* This testcase is part of GDB, the GNU debugger.
|
||||
+
|
||||
+ Copyright 2025 Free Software Foundation, Inc.
|
||||
+
|
||||
+ This program is free software; you can 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 <unistd.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <sys/stat.h>
|
||||
+#include <errno.h>
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+int
|
||||
+main (int argc, char *argv[])
|
||||
+{
|
||||
+ /* Don't let this test stay alive forever. */
|
||||
+ alarm (300);
|
||||
+
|
||||
+ if (argc != 2)
|
||||
+ abort ();
|
||||
+
|
||||
+ /* Check the file doesn't already exist. */
|
||||
+ const char *filename = argv[1];
|
||||
+ struct stat buf;
|
||||
+ if (stat (filename, &buf) == 0 || errno != ENOENT)
|
||||
+ abort ();
|
||||
+
|
||||
+ /* Create the file, and write something into it. */
|
||||
+ FILE *out = fopen (filename, "w");
|
||||
+ if (out == NULL)
|
||||
+ abort ();
|
||||
+
|
||||
+ fprintf (out, "Hello World\n");
|
||||
+
|
||||
+ if (fclose (out) != 0)
|
||||
+ abort ();
|
||||
+
|
||||
+ /* Spin until the marker file is deleted. */
|
||||
+ while (stat (filename, &buf) == 0)
|
||||
+ sleep (1);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/gdb/testsuite/gdb.tui/flush-after-run.exp b/gdb/testsuite/gdb.tui/flush-after-run.exp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/gdb/testsuite/gdb.tui/flush-after-run.exp
|
||||
@@ -0,0 +1,66 @@
|
||||
+# Copyright 2025 Free Software Foundation, Inc.
|
||||
+
|
||||
+# This program is free software; you can 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/>.
|
||||
+
|
||||
+# Check that the 'Starting program' message is correctly flushed to
|
||||
+# the TUI terminal as soon as it is available.
|
||||
+
|
||||
+require allow_tui_tests
|
||||
+require target_can_use_run_cmd
|
||||
+
|
||||
+tuiterm_env
|
||||
+
|
||||
+standard_testfile
|
||||
+
|
||||
+if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
|
||||
+ return -1
|
||||
+}
|
||||
+
|
||||
+Term::clean_restart 24 80 $testfile
|
||||
+
|
||||
+if {![Term::enter_tui]} {
|
||||
+ unsupported "TUI not supported"
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+# Pick a name for a marker file, and ensure it doesn't exist.
|
||||
+set marker_file [standard_output_file "marker"]
|
||||
+file delete $marker_file
|
||||
+
|
||||
+# Run the inferior, which will create MARKER_FILE.
|
||||
+send_gdb "run \"$marker_file\"\n"
|
||||
+
|
||||
+# Spin until MARKER_FILE appears.
|
||||
+while { ! [file exists $marker_file] } {
|
||||
+ sleep 1
|
||||
+}
|
||||
+
|
||||
+# We now know that the inferior has started, and that the 'Starting
|
||||
+# program: ' string should have been printed to the terminal. Don't
|
||||
+# use Term::wait_for here as there will be no prompt after the
|
||||
+# 'Starting program' message.
|
||||
+gdb_assert {[Term::wait_for_region_contents 0 16 80 7 "Starting program: "]} \
|
||||
+ "starting program message has appeared"
|
||||
+
|
||||
+# Delete MARKER_FILE. This will cause the inferior to exit.
|
||||
+file delete $marker_file
|
||||
+
|
||||
+# Now wait for the prompt, and check that the inferior exited message
|
||||
+# appeared.
|
||||
+gdb_assert {[Term::wait_for ""]} \
|
||||
+ "wait for prompt after inferior exits"
|
||||
+Term::check_region_contents \
|
||||
+ "check for inferior exited message" \
|
||||
+ 0 16 80 8 \
|
||||
+ "\\\[Inferior $decimal \[^\r\n\]+ exited normally\\\]"
|
||||
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
|
||||
--- a/gdb/tui/tui-wingeneral.c
|
||||
+++ b/gdb/tui/tui-wingeneral.c
|
||||
@@ -56,7 +56,12 @@ void
|
||||
tui_win_info::refresh_window ()
|
||||
{
|
||||
if (handle != NULL)
|
||||
- wnoutrefresh (handle.get ());
|
||||
+ {
|
||||
+ if (suppress_output)
|
||||
+ wnoutrefresh (handle.get ());
|
||||
+ else
|
||||
+ wrefresh (handle.get ());
|
||||
+ }
|
||||
}
|
||||
|
||||
/* Draw a border around the window. */
|
||||
Loading…
Reference in New Issue
Block a user