From f774761950008e9d9b0aab80044f135191b1e63c Mon Sep 17 00:00:00 2001 From: Sergio Durigan Junior Date: Wed, 8 Aug 2018 15:04:49 -0400 Subject: [PATCH] Reenable libipt. Rebuild due to new libipt release. Adjust bundled libipt; remove unnecessary patch. Sync IPv6 patch with F-28 GDB. --- .gitignore | 2 +- _gdb.spec.Patch.include | 9 ++- _gdb.spec.patch.include | 1 + _patch_order | 5 +- ...f2.patch => gdb-rhbz881849-ipv6-1of3.patch | 2 +- gdb-rhbz881849-ipv6-2of2.patch | 63 ---------------- gdb-rhbz881849-ipv6-2of3.patch | 54 ++++++++++++++ gdb-rhbz881849-ipv6-3of3.patch | 72 +++++++++++++++++++ gdb.spec | 18 ++--- sources | 2 +- v1.5-libipt-static.patch | 14 ++-- v1.6.1-implicit-fallthrough.patch | 23 ------ 12 files changed, 158 insertions(+), 107 deletions(-) rename gdb-rhbz881849-ipv6-1of2.patch => gdb-rhbz881849-ipv6-1of3.patch (99%) delete mode 100644 gdb-rhbz881849-ipv6-2of2.patch create mode 100644 gdb-rhbz881849-ipv6-2of3.patch create mode 100644 gdb-rhbz881849-ipv6-3of3.patch delete mode 100644 v1.6.1-implicit-fallthrough.patch diff --git a/.gitignore b/.gitignore index 0abe58a..949c204 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ /gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz -/v1.6.1.tar.gz /gdb-8.1.90.20180727.tar.xz +/v2.0.tar.gz diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include index 8ba0e48..946c4af 100644 --- a/_gdb.spec.Patch.include +++ b/_gdb.spec.Patch.include @@ -505,8 +505,11 @@ Patch120: gdb-vla-intel-fix-print-char-array.patch Patch121: gdb-rhbz1553104-s390x-arch12-test.patch # Implement IPv6 support for GDB/gdbserver (RH BZ 881849, Sergio Durigan Junior). -Patch122: gdb-rhbz881849-ipv6-1of2.patch +Patch122: gdb-rhbz881849-ipv6-1of3.patch -# Implement IPv6 support for GDB/gdbserver (RH BZ 881849, Sergio Durigan Junior). -Patch123: gdb-rhbz881849-ipv6-2of2.patch + +Patch123: gdb-rhbz881849-ipv6-2of3.patch + + +Patch124: gdb-rhbz881849-ipv6-3of3.patch diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include index 27a39b7..97f12c4 100644 --- a/_gdb.spec.patch.include +++ b/_gdb.spec.patch.include @@ -121,3 +121,4 @@ %patch121 -p1 %patch122 -p1 %patch123 -p1 +%patch124 -p1 diff --git a/_patch_order b/_patch_order index 11b4131..b10536c 100644 --- a/_patch_order +++ b/_patch_order @@ -119,5 +119,6 @@ gdb-testsuite-readline63-sigint.patch gdb-archer.patch gdb-vla-intel-fix-print-char-array.patch gdb-rhbz1553104-s390x-arch12-test.patch -gdb-rhbz881849-ipv6-1of2.patch -gdb-rhbz881849-ipv6-2of2.patch +gdb-rhbz881849-ipv6-1of3.patch +gdb-rhbz881849-ipv6-2of3.patch +gdb-rhbz881849-ipv6-3of3.patch diff --git a/gdb-rhbz881849-ipv6-1of2.patch b/gdb-rhbz881849-ipv6-1of3.patch similarity index 99% rename from gdb-rhbz881849-ipv6-1of2.patch rename to gdb-rhbz881849-ipv6-1of3.patch index 50510c8..7c3a664 100644 --- a/gdb-rhbz881849-ipv6-1of2.patch +++ b/gdb-rhbz881849-ipv6-1of3.patch @@ -1,7 +1,7 @@ From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 From: Sergio Durigan Junior Date: Fri, 18 May 2018 01:29:24 -0400 -Subject: gdb-rhbz881849-ipv6-1of2.patch +Subject: gdb-rhbz881849-ipv6-1of3.patch ;; Implement IPv6 support for GDB/gdbserver (RH BZ 881849, Sergio Durigan Junior). diff --git a/gdb-rhbz881849-ipv6-2of2.patch b/gdb-rhbz881849-ipv6-2of2.patch deleted file mode 100644 index 339c966..0000000 --- a/gdb-rhbz881849-ipv6-2of2.patch +++ /dev/null @@ -1,63 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Sergio Durigan Junior -Date: Fri, 13 Jul 2018 16:20:34 -0400 -Subject: gdb-rhbz881849-ipv6-2of2.patch - -;; Implement IPv6 support for GDB/gdbserver (RH BZ 881849, Sergio Durigan Junior). - -Expect for another variant of error message when gdbserver cannot resolve hostname - -I've noticed that on a few hosts, when given an invalid hostname, -gdbserver fails with: - - spawn /../../gdb/gdbserver/gdbserver --once tcp8:123:2353 /gdb/build/fedora-s390x/build/gdb/testsuite/outputs/gdb.server/server-connect/server-connect - tcp8:123:2353: cannot resolve name: No address associated with hostname - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Exiting - -Unfortunately, this causes a fail on the new -gdb.server/server-connect.exp test (introduced by the IPv6 patch): - - FAIL: gdb.server/server-connect.exp: tcp8: start gdbserver: gdbserver should fail but did not - -This happens because we're expecting for another variant of this error -message: - - cannot resolve name: Name or service not known - -Therefore, this patch extends the helper function 'gdbserver_start' to -also recognize the "No address associated with hostname" message. -This "fixes" the testcase on the hosts that use this variant. - -gdb/testsuite/ChangeLog: -2018-07-13 Sergio Durigan Junior - - * lib/gdbserver-support.exp (gdbserver_start): Expect for the - message "No address associated with hostname" when gdbserver - cannot resolve the hostname. - -diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog ---- a/gdb/testsuite/ChangeLog -+++ b/gdb/testsuite/ChangeLog -@@ -1,3 +1,9 @@ -+2018-07-13 Sergio Durigan Junior -+ -+ * lib/gdbserver-support.exp (gdbserver_start): Expect for the -+ message "No address associated with hostname" when gdbserver -+ cannot resolve the hostname. -+ - 2018-07-11 Sergio Durigan Junior - Jan Kratochvil - Paul Fertser -diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp ---- a/gdb/testsuite/lib/gdbserver-support.exp -+++ b/gdb/testsuite/lib/gdbserver-support.exp -@@ -326,7 +326,7 @@ proc gdbserver_start { options arguments } { - continue - } - } -- -re ".*: cannot resolve name: Name or service not known\r\n" { -+ -re ".*: cannot resolve name: \(No address associated with hostname|Name or service not known\)\r\n" { - error "gdbserver cannot resolve name." - } - timeout { diff --git a/gdb-rhbz881849-ipv6-2of3.patch b/gdb-rhbz881849-ipv6-2of3.patch new file mode 100644 index 0000000..390be0f --- /dev/null +++ b/gdb-rhbz881849-ipv6-2of3.patch @@ -0,0 +1,54 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Sergio Durigan Junior +Date: Mon, 30 Jul 2018 15:23:27 -0400 +Subject: gdb-rhbz881849-ipv6-2of3.patch + +Match any kind of error after "cannot resolve name" on lib/gdbserver-support.exp:gdbserver_start + +On commit: + +commit 7f1f7e23939adc7d71036a17fc6081e3af7ca585 +Author: Sergio Durigan Junior +Date: Fri Jul 13 16:20:34 2018 -0400 + + Expect for another variant of error message when gdbserver cannot resolve hostname + +I extended the regular expression being used to identify whether +gdbserver could not resolve a (host)name. This was needed because the +error message being printed had a different variation across some +systems. However, as it turns out, I've just noticed that the message +has yet another variation: + + target remote tcp8:123:2353 + tcp8:123:2353: cannot resolve name: System error + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + tcp8:123:2353: No such file or directory. + (gdb) FAIL: gdb.server/server-connect.exp: tcp8: connect to gdbserver using tcp8:123 + +which is causing FAILs on some systems (namely, Fedora-i686 on +BuildBot). + +So instead of trying to predict everything that can be printed, I +decided to just match anything after the "cannot resolve name: " part. +This patch implements that. + +Regression tested on the BuildBot. + +gdb/testsuite/ChangeLog: +2018-07-30 Sergio Durigan Junior + + * lib/gdbserver-support.exp (gdbserver_start): Match any kind of + error after "cannot resolve name" string. + +diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp +--- a/gdb/testsuite/lib/gdbserver-support.exp ++++ b/gdb/testsuite/lib/gdbserver-support.exp +@@ -326,7 +326,7 @@ proc gdbserver_start { options arguments } { + continue + } + } +- -re ".*: cannot resolve name: Name or service not known\r\n" { ++ -re ".*: cannot resolve name: .*\r\n" { + error "gdbserver cannot resolve name." + } + timeout { diff --git a/gdb-rhbz881849-ipv6-3of3.patch b/gdb-rhbz881849-ipv6-3of3.patch new file mode 100644 index 0000000..789cb18 --- /dev/null +++ b/gdb-rhbz881849-ipv6-3of3.patch @@ -0,0 +1,72 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Sergio Durigan Junior +Date: Fri, 3 Aug 2018 18:04:38 -0400 +Subject: gdb-rhbz881849-ipv6-3of3.patch + +Fix thinko when deciding whether to disable TCP's Nagle algorithm + +This patch fixes a thinko that happened when I was implementing the +IPv6 support on GDB/gdbserver. On certain situations, it is necessary +to disable TCP's Nagle algorithm (NODELAY). For obvious reasons, this +only applies when we are dealing with a TCP connection. + +While implementing the IPv6 patch, I noticed that the net_open +function (on gdb/ser-tcp.c) kept a flag indicating whether the +connection type was UDP or TCP. I eliminated that flag, and started +using the 'struct addrinfo *' related to the successful connection +directly. However, I made a mistake: + + if (success_ainfo->ai_socktype == IPPROTO_TCP) + ^^^^^^^^^^^ + { + /* Disable Nagle algorithm. Needed in some cases. */ + int tmp = 1; + + setsockopt (scb->fd, IPPROTO_TCP, TCP_NODELAY, + (char *) &tmp, sizeof (tmp)); + } + +The 'ai_socktype' field specifies the socket type (SOCK_STREAM or +SOCK_DGRAM), and not the protocol. This test was always failing, and +the Nagle algorithm was never being disabled. + +The obvious fix is to use the 'ai_protocol' field. This is what this +patch does. + +Huge "thank you" to Joel Brobecker who reported the regression (he was +experiencing an unusual delay while debugging a bare-metal program +running under QEMU) and helped me set up a proper reproducer for the +bug. + +gdb/ChangeLog: +2018-08-03 Sergio Durigan Junior + + * ser-tcp.c (net_open): Fix thinko when deciding whether to + disable TCP's Nagle algorithm (use "ai_protocol" instead of + "ai_socktype"). + +diff --git a/gdb/ChangeLog b/gdb/ChangeLog +--- a/gdb/ChangeLog ++++ b/gdb/ChangeLog +@@ -1,3 +1,9 @@ ++2018-08-03 Sergio Durigan Junior ++ ++ * ser-tcp.c (net_open): Fix thinko when deciding whether to ++ disable TCP's Nagle algorithm (use "ai_protocol" instead of ++ "ai_socktype"). ++ + 2018-07-25 Alan Hayward + + * target-descriptions.c (tdesc_register_bitsize): Rename. +diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c +--- a/gdb/ser-tcp.c ++++ b/gdb/ser-tcp.c +@@ -367,7 +367,7 @@ net_open (struct serial *scb, const char *name) + + ioctl (scb->fd, FIONBIO, &ioarg); + +- if (success_ainfo->ai_socktype == IPPROTO_TCP) ++ if (success_ainfo->ai_protocol == IPPROTO_TCP) + { + /* Disable Nagle algorithm. Needed in some cases. */ + int tmp = 1; diff --git a/gdb.spec b/gdb.spec index e03b7cf..1c6d868 100644 --- a/gdb.spec +++ b/gdb.spec @@ -26,7 +26,7 @@ Version: 8.1.90.%{snapsrc} # 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: 40%{?dist} +Release: 41%{?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 Group: Development/Debuggers @@ -169,14 +169,11 @@ Source5: %{libstdcxxpython}.tar.xz Source6: gdbtui # libipt: Intel Processor Trace Decoder Library -%global libipt_version 1.6.1 +%global libipt_version 2.0 #=fedora Source7: v%{libipt_version}.tar.gz #=fedora Patch1142: v1.5-libipt-static.patch -# [rhel dts libipt] Fix [-Werror=implicit-fallthrough=] with gcc-7.1.1. -#=push+jan -Patch1171: v1.6.1-implicit-fallthrough.patch ## [testsuite] Fix false selftest.exp FAIL from system readline-6.3+ (Patrick Palka). ##=fedoratest @@ -237,7 +234,7 @@ BuildRequires: guile-devel%{buildisa} %if 0%{?el7:1} && 0%{?scl:1} BuildRequires: cmake %else -#BuildRequires: libipt-devel%{buildisa} +BuildRequires: libipt-devel%{buildisa} %endif %endif %endif @@ -415,7 +412,6 @@ tar xzf %{SOURCE7} ( cd processor-trace-%{libipt_version} %patch1142 -p1 -%patch1171 -p1 ) %endif @@ -608,7 +604,7 @@ $(: ppc64 host build crashes on ppc variant of libexpat.so ) \ --disable-inprocess-agent \ %endif --with-system-zlib \ -%if 0 && %{have_libipt} +%if %{have_libipt} --with-intel-pt \ %else --without-intel-pt \ @@ -1026,6 +1022,12 @@ fi %endif %changelog +* Wed Aug 8 2018 Sergio Durigan Junior - 8.1.90.20180727-41.fc29 +- Reenable libipt. +- Rebuild due to new libipt release. +- Adjust bundled libipt; remove unnecessary patch. +- Sync IPv6 patch with F-28 GDB. + * Wed Aug 8 2018 Sergio Durigan Junior - 8.1.90.20180727-40.fc29 - Temporarily disable libipt (needed to upgrade libipt to 2.0). diff --git a/sources b/sources index 193c57d..5d8b853 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz) = a8b1c54dd348cfeb37da73f968742896be3dd13a4215f8d8519870c2abea915f5176c3fa6989ddd10f20020a16f0fab20cbae68ee8d58a82234d8778023520f8 -SHA512 (v1.6.1.tar.gz) = c7c9c8ba78021fff3fde12a216f5729c6031114e5a727f49b7ff1a31c53b5ddba24d1b3aee252d8278ecd1fafe78a44ed059c12b9eb29eca33093e0720673468 SHA512 (gdb-8.1.90.20180727.tar.xz) = 0f8e9cfaeaf9f22361b3b8d5d490d0a8bea3eeaaa0c6813d5df0a6d5267ff3f597747cc0e97d70c4196d78ee32e0e82d5893283d71b449d89703893bf1ae0014 +SHA512 (v2.0.tar.gz) = ec63151e842c81cc73ea11ba560b63e005cefbe19d98de24ae5c8caa4de7c9c1d71d1ec5b6214a347592eac675b75a3d2b26d4691ca86f91020ebfea8e912939 diff --git a/v1.5-libipt-static.patch b/v1.5-libipt-static.patch index 477b6c4..6599445 100644 --- a/v1.5-libipt-static.patch +++ b/v1.5-libipt-static.patch @@ -1,6 +1,8 @@ ---- processor-trace-1.5/libipt/CMakeLists.txt-orig 2016-04-07 08:52:14.000000000 +0200 -+++ processor-trace-1.5/libipt/CMakeLists.txt 2016-08-17 23:12:23.241109244 +0200 -@@ -81,7 +81,7 @@ endif (CMAKE_HOST_WIN32) +Index: processor-trace-2.0/libipt/CMakeLists.txt +=================================================================== +--- processor-trace-2.0.orig/libipt/CMakeLists.txt ++++ processor-trace-2.0/libipt/CMakeLists.txt +@@ -85,7 +85,7 @@ endif (CMAKE_HOST_WIN32) set(LIBIPT_FILES ${LIBIPT_FILES} ${LIBIPT_SECTION_FILES}) @@ -9,8 +11,10 @@ ${LIBIPT_FILES} ) ---- processor-trace-1.5/libipt/src/posix/init.c-orig 2016-04-07 08:52:14.000000000 +0200 -+++ processor-trace-1.5/libipt/src/posix/init.c 2016-08-23 09:04:11.540176668 +0200 +Index: processor-trace-2.0/libipt/src/posix/init.c +=================================================================== +--- processor-trace-2.0.orig/libipt/src/posix/init.c ++++ processor-trace-2.0/libipt/src/posix/init.c @@ -29,7 +29,7 @@ #include "pt_ild.h" diff --git a/v1.6.1-implicit-fallthrough.patch b/v1.6.1-implicit-fallthrough.patch deleted file mode 100644 index db844d3..0000000 --- a/v1.6.1-implicit-fallthrough.patch +++ /dev/null @@ -1,23 +0,0 @@ -gcc-7.1.1-1.fc27.x86_64 -/home/jkratoch/redhat/fedora/libipt/master/processor-trace-1.6.1/libipt/src/pt_block_decoder.c: In function ‘pt_blk_proceed_no_event_cached’: -/home/jkratoch/redhat/fedora/libipt/master/processor-trace-1.6.1/libipt/src/pt_block_decoder.c:2282:6: error: this statement may fall through [-Werror=implicit-fallthrough=] - if (bce.isize) { - ^ -/home/jkratoch/redhat/fedora/libipt/master/processor-trace-1.6.1/libipt/src/pt_block_decoder.c:2328:2: note: here - case ptbq_decode: { - ^~~~ - -diff --git a/libipt/src/pt_block_decoder.c b/libipt/src/pt_block_decoder.c -index 21783a6..91d5bb3 100644 ---- a/libipt/src/pt_block_decoder.c -+++ b/libipt/src/pt_block_decoder.c -@@ -2095,6 +2095,9 @@ static int pt_blk_proceed_no_event_cached(struct pt_block_decoder *decoder, - } - - /* Fall through to ptbq_decode. */ -+#if __GNUC__ >= 7 -+ __attribute__ ((fallthrough)); -+#endif - - case ptbq_decode: { - struct pt_insn_ext iext;