Rebase to FSF GDB 9.2 and fix a bunch of issues.

This commit is contained in:
Keith Seitz 2020-06-09 07:54:16 -07:00
parent 28b99d9981
commit b2003eae67
10 changed files with 166 additions and 15 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
/binutils-gdb
/gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz
/v2.0.1.tar.gz
/gdb-9.1.tar.xz
/gdb-9.2.tar.xz

View File

@ -404,3 +404,7 @@ Patch099: gdb-rhbz1822715-fix-python-deprecation.patch
# Kevin Buettner <kevinb@redhat.com> and Keith Seitz <keiths@redhat.com>
Patch100: gdb-rhbz1829702-fix-python39.patch
# Fix fput?_unfiltered functions
# RH BZ 1844458 (Sergio Durigan Junior and Tom Tromey)
Patch101: gdb-rhbz1844458-use-fputX_unfiltered.patch

View File

@ -98,3 +98,4 @@
%patch098 -p1
%patch099 -p1
%patch100 -p1
%patch101 -p1

View File

@ -1 +1 @@
899016d49d289757372459f72d642a4c6b3b7732
e7fe0803b6427d3906e991bbb3b7fd2f0fd05e00

View File

@ -98,3 +98,4 @@ gdb-rhbz1553104-s390x-arch12-test.patch
gdb-rhbz1818011-bfd-gcc10-error.patch
gdb-rhbz1822715-fix-python-deprecation.patch
gdb-rhbz1829702-fix-python39.patch
gdb-rhbz1844458-use-fputX_unfiltered.patch

View File

@ -262,7 +262,7 @@ new file mode 100644
+}
+
+set GDBFLAGS_orig $GDBFLAGS
+set GDBFLAGS "--pid=$testpid"
+set GDBFLAGS "-iex \"set height 0\" --pid=$testpid"
+gdb_start
+set GDBFLAGS $GDBFLAGS_orig
+
@ -284,7 +284,7 @@ new file mode 100644
+}
+
+set GDBFLAGS_orig $GDBFLAGS
+set GDBFLAGS "--pid=$testpid"
+set GDBFLAGS "-iex \"set height 0\" --pid=$testpid"
+gdb_start
+set GDBFLAGS $GDBFLAGS_orig
+

View File

@ -0,0 +1,123 @@
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
From: Keith Seitz <keiths@redhat.com>
Date: Mon, 8 Jun 2020 11:33:47 -0700
Subject: gdb-rhbz1844458-use-fputX_unfiltered.patch
;; Fix fput?_unfiltered functions
;; RH BZ 1844458 (Sergio Durigan Junior and Tom Tromey)
From 9effb44ccbf50c16da66aaab5fd535fe17e38e32 Mon Sep 17 00:00:00 2001
From: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Wed, 19 Feb 2020 16:40:48 -0500
Subject: [PATCH] Make '{putchar,fputc}_unfiltered' use 'fputs_unfiltered'
There is currently a regression when using
'{putchar,fputc}_unfiltered' with 'puts_unfiltered' which was
introduced by one of the commits that reworked the unfiltered print
code.
The regression makes it impossible to use '{putchar,fputc}_unfiltered'
with 'puts_unfiltered', because the former writes directly to the
ui_file stream using 'stream->write', while the latter uses a buffered
mechanism (see 'wrap_buffer') and delays the printing.
If you do a quick & dirty hack on e.g. top.c:show_gdb_datadir:
@@ -2088,6 +2088,13 @@ static void
show_gdb_datadir (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
+ putchar_unfiltered ('\n');
+ puts_unfiltered ("TEST");
+ putchar_unfiltered ('>');
+ puts_unfiltered ("PUTS");
+ puts_unfiltered ("PUTS");
+ putchar_unfiltered ('\n');
rebuild GDB and invoke the "show data-directory" command, you will
see:
(gdb) show data-directory
>
TESTPUTSGDB's data directory is "/usr/local/share/gdb".
Note how the '>' was printed before the output, and "TEST" and "PUTS"
were printed together.
My first attempt to fix this was to always call 'flush_wrap_buffer' at
the end of 'fputs_maybe_filtered', since it seemed to me that the
function should always print what was requested. But I wasn't sure
this was the right thing to do, so I talked to Tom on IRC and he gave
me another, simpler idea: make '{putchar,fputc}_unfiltered' call into
the already existing 'fputs_unfiltered' function.
This patch implements the idea. I regtested it on the Buildbot, and
no regressions were detected.
gdb/ChangeLog:
2020-02-20 Sergio Durigan Junior <sergiodj@redhat.com>
Tom Tromey <tom@tromey.com>
* utils.c (fputs_maybe_filtered): Call 'stream->puts' instead
of 'fputc_unfiltered'.
(putchar_unfiltered): Call 'fputc_unfiltered'.
(fputc_unfiltered): Call 'fputs_unfiltered'.
diff --git a/gdb/utils.c b/gdb/utils.c
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1783,7 +1783,12 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream,
newline -- if chars_per_line is right, we
probably just overflowed anyway; if it's wrong,
let us keep going. */
- fputc_unfiltered ('\n', stream);
+ /* XXX: The ideal thing would be to call
+ 'stream->putc' here, but we can't because it
+ currently calls 'fputc_unfiltered', which ends up
+ calling us, which generates an infinite
+ recursion. */
+ stream->puts ("\n");
}
else
{
@@ -1828,7 +1833,12 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream,
wrap_here ((char *) 0); /* Spit out chars, cancel
further wraps. */
lines_printed++;
- fputc_unfiltered ('\n', stream);
+ /* XXX: The ideal thing would be to call
+ 'stream->putc' here, but we can't because it
+ currently calls 'fputc_unfiltered', which ends up
+ calling us, which generates an infinite
+ recursion. */
+ stream->puts ("\n");
lineptr++;
}
}
@@ -1923,10 +1933,7 @@ fputs_highlighted (const char *str, const compiled_regex &highlight,
int
putchar_unfiltered (int c)
{
- char buf = c;
-
- ui_file_write (gdb_stdout, &buf, 1);
- return c;
+ return fputc_unfiltered (c, gdb_stdout);
}
/* Write character C to gdb_stdout using GDB's paging mechanism and return C.
@@ -1941,9 +1948,11 @@ putchar_filtered (int c)
int
fputc_unfiltered (int c, struct ui_file *stream)
{
- char buf = c;
+ char buf[2];
- ui_file_write (stream, &buf, 1);
+ buf[0] = c;
+ buf[1] = 0;
+ fputs_unfiltered (buf, stream);
return c;
}

View File

@ -11,6 +11,9 @@
# workload gets run it decreases the general performance now.
# --define 'scl somepkgname': Independent packages by scl-utils-build.
# Turn off the brp-python-bytecompile automagic
%global _python_bytecompile_extra 0
%{?scl:%scl_package gdb}
%{!?scl:
%global pkg_name %{name}
@ -31,11 +34,11 @@ Name: %{?scl_prefix}gdb
# See timestamp of source gnulib installed into gnulib/ .
%global snapgnulib 20191216
%global tarname gdb-%{version}
Version: 9.1
Version: 9.2
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
Release: 8%{?dist}
Release: 1%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL
# Do not provide URL for snapshots as the file lasts there only for 2 days.
@ -199,9 +202,9 @@ Patch1119: gdb-testsuite-readline63-sigint-revert.patch
# Include the auto-generated file containing the "Patch:" directives.
# See README.local-patches for more details.
Source8: _gdb.spec.Patch.include
Source9: _gdb.spec.patch.include
%include %{SOURCE8}
Patch9998: _gdb.spec.Patch.include
Patch9999: _gdb.spec.patch.include
%include %{PATCH9998}
%if 0%{!?rhel:1} || 0%{?rhel} > 6
# RL_STATE_FEDORA_GDB would not be found for:
@ -463,7 +466,7 @@ find -name "*.info*"|xargs rm -f
# Include the auto-generated "%patch" directives.
# See README.local-patches for more details.
%include %{SOURCE9}
%include %{PATCH9999}
%if 0%{!?el6:1}
for i in \
@ -950,6 +953,11 @@ for pyo in "" "-O";do
done
%endif # 0%{?_enable_debug_packages:1} && 0%{!?_without_python:1}
# Compile python files
%if 0%{!?_without_python:1}
%py_byte_compile %{__python3} %{buildroot}%{_datadir}/gdb/python/gdb
%endif
%if 0%{!?_without_python:1}
%if 0%{!?rhel:1} || 0%{?rhel} > 6
# BZ 999645: /usr/share/gdb/auto-load/ needs filesystem symlinks
@ -1155,6 +1163,12 @@ fi
%endif
%changelog
* Tue Jun 9 2020 Keith Seitz <keiths@redhat.com> - 9.2-1
- Rebase to FSF GDB 9.2.
- Add explicit python bytecode compilation.
- Change included files to patches to quell error from rpminspect.
- Fix attach-32.exp from gdb-6.3-inferior-notification-20050721.patch.
* Fri Jun 5 2020 Keith Seitz <keiths@redhat.com> - 9.1-8
- Add patch for Python 3.9 and re-enable python.
- Update generate-*.sh to include stgit support.

View File

@ -55,11 +55,18 @@ 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; use the distro name in
# the name of this branch.
f=`cd .. && pwd`
name=devel-`basename $f`
git checkout -b $name $last_ancestor_commit
# 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 ../_patch_order` ; do
git am ../$p

View File

@ -1,3 +1,3 @@
SHA512 (gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz) = a8b1c54dd348cfeb37da73f968742896be3dd13a4215f8d8519870c2abea915f5176c3fa6989ddd10f20020a16f0fab20cbae68ee8d58a82234d8778023520f8
SHA512 (v2.0.1.tar.gz) = e38e93908c3fbf1f2384cfca381eaf4bf667033de678041bd440adac8bbce4757b77304868896256ed72c202ee22ba1646aada90125029f14f5bffaf828a7df4
SHA512 (gdb-9.1.tar.xz) = 84cdd408d80a3fc5779de459c5b26154d31b329ebde7e3aa78799fb1eb245d8b64b8c8ee7242382a1dbd95b4e6f9d84fef41d12a0646aa75d3dee4709ea1f6e7
SHA512 (gdb-9.2.tar.xz) = 73635f00f343117aa5e2436f1e1597099e2bfb31ef7bb162b273fa1ea282c3fa9b0f52762e70bfc7ad0334addb8d159e9ac7cbe5998ca4f755ea8cf90714d274