From 80d902f397d12577f9b5af4056b610e668c1dc14 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Fri, 9 Jun 2017 07:35:25 +0200 Subject: [PATCH 1/7] [rhel dts libipt] Fix [-Werror=implicit-fallthrough=] with gcc-7.1.1. --- gdb.spec | 10 +++++++++- v1.6.1-implicit-fallthrough.patch | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 v1.6.1-implicit-fallthrough.patch diff --git a/gdb.spec b/gdb.spec index 9d81f3c..6840772 100644 --- a/gdb.spec +++ b/gdb.spec @@ -26,7 +26,7 @@ Version: 8.0 # 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: 13%{?dist} +Release: 14%{?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 @@ -672,6 +672,10 @@ Patch1153: gdb-add-index-chmod.patch #=fedoratest Patch1155: gdb-rhbz1398387-tab-crash-test.patch +# [rhel dts libipt] Fix [-Werror=implicit-fallthrough=] with gcc-7.1.1. +#=push+jan +Patch1171: v1.6.1-implicit-fallthrough.patch + %if 0%{!?rhel:1} || 0%{?rhel} > 6 # RL_STATE_FEDORA_GDB would not be found for: # Patch642: gdb-readline62-ask-more-rh.patch @@ -889,6 +893,7 @@ tar xzf %{SOURCE7} ( cd processor-trace-%{libipt_version} %patch1142 -p1 +%patch1171 -p1 ) %endif @@ -1610,6 +1615,9 @@ then fi %changelog +* Fri Jun 9 2017 Jan Kratochvil - 8.0-14.fc26 +- [rhel dts libipt] Fix [-Werror=implicit-fallthrough=] with gcc-7.1.1. + * Fri Jun 9 2017 Jan Kratochvil - 8.0-13.fc26 - Rebase to FSF GDB 8.0 final. - [rhel7 dts] Rebase bundled libipt to 1.6.1. diff --git a/v1.6.1-implicit-fallthrough.patch b/v1.6.1-implicit-fallthrough.patch new file mode 100644 index 0000000..f2ddb4f --- /dev/null +++ b/v1.6.1-implicit-fallthrough.patch @@ -0,0 +1,19 @@ +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: { + ^~~~ + +--- processor-trace-1.6.1-orig/libipt/src/pt_block_decoder.c 2017-05-31 13:30:32.000000000 +0200 ++++ processor-trace-1.6.1/libipt/src/pt_block_decoder.c 2017-06-09 07:24:12.644587611 +0200 +@@ -2324,6 +2324,7 @@ static int pt_blk_proceed_no_event_cache + } + + /* Fall through to ptbq_decode. */ ++ __attribute__ ((fallthrough)); + + case ptbq_decode: { + struct pt_insn_ext iext; From 39868f2076745c7364e5a88f19091824c00c148b Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Fri, 9 Jun 2017 15:45:38 +0200 Subject: [PATCH 2/7] [rhel dts libipt] Fix#2 [-Werror=implicit-fallthrough=] with gcc-7.1.1. --- gdb.spec | 5 ++++- v1.6.1-implicit-fallthrough.patch | 10 +++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gdb.spec b/gdb.spec index 6840772..c15bfb9 100644 --- a/gdb.spec +++ b/gdb.spec @@ -26,7 +26,7 @@ Version: 8.0 # 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: 14%{?dist} +Release: 15%{?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 @@ -1615,6 +1615,9 @@ then fi %changelog +* Fri Jun 9 2017 Jan Kratochvil - 8.0-15.fc26 +- [rhel dts libipt] Fix#2 [-Werror=implicit-fallthrough=] with gcc-7.1.1. + * Fri Jun 9 2017 Jan Kratochvil - 8.0-14.fc26 - [rhel dts libipt] Fix [-Werror=implicit-fallthrough=] with gcc-7.1.1. diff --git a/v1.6.1-implicit-fallthrough.patch b/v1.6.1-implicit-fallthrough.patch index f2ddb4f..db844d3 100644 --- a/v1.6.1-implicit-fallthrough.patch +++ b/v1.6.1-implicit-fallthrough.patch @@ -7,13 +7,17 @@ gcc-7.1.1-1.fc27.x86_64 case ptbq_decode: { ^~~~ ---- processor-trace-1.6.1-orig/libipt/src/pt_block_decoder.c 2017-05-31 13:30:32.000000000 +0200 -+++ processor-trace-1.6.1/libipt/src/pt_block_decoder.c 2017-06-09 07:24:12.644587611 +0200 -@@ -2324,6 +2324,7 @@ static int pt_blk_proceed_no_event_cache +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; From c52da2003f2f6670fc02f03929271964d3505493 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Sat, 10 Jun 2017 08:25:34 +0200 Subject: [PATCH 3/7] [dts] Upgrade libstdc++-v3-python to 7.1.1-20170526. --- .gitignore | 2 +- gdb.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index dac7317..b4d804c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -/gdb-libstdc++-v3-python-6.3.1-20170212.tar.xz +/gdb-libstdc++-v3-python-7.1.1-20170526.tar.xz /v1.6.1.tar.gz /gdb-8.0.tar.xz diff --git a/gdb.spec b/gdb.spec index c15bfb9..366739b 100644 --- a/gdb.spec +++ b/gdb.spec @@ -26,7 +26,7 @@ Version: 8.0 # 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: 15%{?dist} +Release: 16%{?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 @@ -147,7 +147,7 @@ Source3: gdb-gstack.man Source4: gdbinit # libstdc++ pretty printers from GCC SVN. -%global libstdcxxpython gdb-libstdc++-v3-python-6.3.1-20170212 +%global libstdcxxpython gdb-libstdc++-v3-python-7.1.1-20170526 #=fedora Source5: %{libstdcxxpython}.tar.xz @@ -1615,6 +1615,9 @@ then fi %changelog +* Sat Jun 10 2017 Jan Kratochvil - 8.0-16.fc26 +- [dts] Upgrade libstdc++-v3-python to 7.1.1-20170526. + * Fri Jun 9 2017 Jan Kratochvil - 8.0-15.fc26 - [rhel dts libipt] Fix#2 [-Werror=implicit-fallthrough=] with gcc-7.1.1. diff --git a/sources b/sources index 28ec64a..3f3b18e 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (gdb-libstdc++-v3-python-6.3.1-20170212.tar.xz) = 22ad4187d6bb9851ecf389c3ff4c68f33ccf5602d8f51bc337215c700d56c9073b3fb40ece3f58901315161f76a4fd1d6463c623650317ad96fd9e3f4aba7252 +SHA512 (gdb-libstdc++-v3-python-7.1.1-20170526.tar.xz) = 3d540b99581ffa4cf2810bec979c9a01a1f8ce782b7c8efb46b40dd2421d60cdb0e52b53c5477c3e86a57957a2a14489f5c29dc53868738a1ef79e79cf76d0a1 SHA512 (v1.6.1.tar.gz) = c7c9c8ba78021fff3fde12a216f5729c6031114e5a727f49b7ff1a31c53b5ddba24d1b3aee252d8278ecd1fafe78a44ed059c12b9eb29eca33093e0720673468 SHA512 (gdb-8.0.tar.xz) = e4044bdd162cbf95044ec1eaa44d2fa62a33e051bdbbacbc97afd4dfb07bae1bea514381fc1966aede89d6796ef2377a15748a93d95e2ad494c8497db489e886 From 4d0140dca173e64e298b7c593dbdb0ee3a92a0b6 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Mon, 12 Jun 2017 21:57:44 +0200 Subject: [PATCH 4/7] [rhel6 dts] Use devtoolset gcc for GDB being now in C++11. --- gdb.spec | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/gdb.spec b/gdb.spec index 366739b..9450b42 100644 --- a/gdb.spec +++ b/gdb.spec @@ -26,7 +26,7 @@ Version: 8.0 # 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: 16%{?dist} +Release: 17%{?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 @@ -126,6 +126,11 @@ BuildRequires: %{librpmname} Recommends: %{librpmname} %endif +%if 0%{?el6:1} +# GDB C++11 requires devtoolset gcc. +BuildRequires: %{?scl_prefix}gcc-c++ +%endif + # GDB patches have the format `gdb--bz-.patch'. # They should be created using patch level 1: diff -up ./gdb (or gdb-6.3/gdb). @@ -1091,6 +1096,11 @@ rm -rf %{buildroot} test -e %{_root_libdir}/librpm.so.%{librpmver} +%if 0%{?el6:1} +# GDB C++11 requires devtoolset gcc. +%{?scl:PATH=%{_bindir}${PATH:+:${PATH}}} +%endif + # Identify the build directory with the version of gdb as well as the # architecture, to allow for mutliple versions to be installed and # built. @@ -1376,6 +1386,11 @@ echo ====================TESTING END===================== cd %{gdb_build} rm -rf $RPM_BUILD_ROOT +%if 0%{?el6:1} +# GDB C++11 requires devtoolset gcc. +%{?scl:PATH=%{_bindir}${PATH:+:${PATH}}} +%endif + make %{?_smp_mflags} install DESTDIR=$RPM_BUILD_ROOT %if 0%{!?scl:1} @@ -1524,7 +1539,12 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) +# File must begin with "/": {GFDL,COPYING3,COPYING,COPYING.LIB,COPYING3.LIB} +%if 0%{!?el6:1} %license COPYING3 COPYING COPYING.LIB COPYING3.LIB +%else +%doc COPYING3 COPYING COPYING.LIB COPYING3.LIB +%endif %doc README NEWS %{_bindir}/gdb %{_bindir}/gcore @@ -1615,6 +1635,9 @@ then fi %changelog +* Mon Jun 12 2017 Jan Kratochvil - 8.0-17.fc26 +- [rhel6 dts] Use devtoolset gcc for GDB being now in C++11. + * Sat Jun 10 2017 Jan Kratochvil - 8.0-16.fc26 - [dts] Upgrade libstdc++-v3-python to 7.1.1-20170526. From d1308d3e8bafba7617fe040d16bf4cfbec8f73b3 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 26 Jul 2017 09:11:20 +0000 Subject: [PATCH 5/7] - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild --- gdb.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdb.spec b/gdb.spec index 9450b42..cb345e1 100644 --- a/gdb.spec +++ b/gdb.spec @@ -26,7 +26,7 @@ Version: 8.0 # 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: 17%{?dist} +Release: 18%{?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 @@ -1635,6 +1635,9 @@ then fi %changelog +* Wed Jul 26 2017 Fedora Release Engineering - 8.0-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + * Mon Jun 12 2017 Jan Kratochvil - 8.0-17.fc26 - [rhel6 dts] Use devtoolset gcc for GDB being now in C++11. From 2d3d9675a793ad20b3e3769015e44130fe0ba414 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 2 Aug 2017 21:00:38 +0000 Subject: [PATCH 6/7] - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild --- gdb.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdb.spec b/gdb.spec index cb345e1..7d5c8b9 100644 --- a/gdb.spec +++ b/gdb.spec @@ -26,7 +26,7 @@ Version: 8.0 # 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: 18%{?dist} +Release: 19%{?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 @@ -1635,6 +1635,9 @@ then fi %changelog +* Wed Aug 02 2017 Fedora Release Engineering - 8.0-19 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + * Wed Jul 26 2017 Fedora Release Engineering - 8.0-18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild From 3bff4d98baff217f6a455b4c351f3a5149fb3eee Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Thu, 3 Aug 2017 19:00:20 +0200 Subject: [PATCH 7/7] Two fixes from upstream stable branch 8.0. --- gdb-upstream.patch | 471 +++++++++++++++++++++++++++++++++++++++++++++ gdb.spec | 13 +- 2 files changed, 479 insertions(+), 5 deletions(-) create mode 100644 gdb-upstream.patch diff --git a/gdb-upstream.patch b/gdb-upstream.patch new file mode 100644 index 0000000..28fda28 --- /dev/null +++ b/gdb-upstream.patch @@ -0,0 +1,471 @@ +commit 50e64da58e648ff8708935add5b2a87b4e590edf +Author: Yao Qi +Date: Tue Jul 25 10:15:25 2017 +0100 + + [ARM] Access FPSCR on vfpv2 + + GDB can fetch or store FPSCR on vfpv3, which has 32 VFP registers, but + fail to do so on vfpv2, which has 16 VFP registers. GDB code is incorrect + for vfpv2, + + else if (tdep->vfp_register_count > 0 + && regno >= ARM_D0_REGNUM + && regno <= ARM_D0_REGNUM + tdep->vfp_register_count) + + while FPSCR register number is defined as ARM_D0_REGNUM + 32. + + ARM_D0_REGNUM, /* VFP double-precision registers. */ + ARM_D31_REGNUM = ARM_D0_REGNUM + 31, + ARM_FPSCR_REGNUM, + + The code above uses "<=" rather than "<", in order to put FPSCR in the + range, but it is only correct when tdep->vfp_register_count is 32. On + vpfv2, it is 16, and FPSCR is out of the range, so fetch_vfp_regs or + store_vfp_regs are not called. + + gdb: + + 2017-07-25 Yao Qi + + PR tdep/21717 + * arm-linux-nat.c (arm_linux_fetch_inferior_registers): Update + condition for FPSCR. + (arm_linux_store_inferior_registers): Likewise. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,10 @@ ++2017-07-25 Yao Qi ++ ++ PR tdep/21717 ++ * arm-linux-nat.c (arm_linux_fetch_inferior_registers): Update ++ condition for FPSCR. ++ (arm_linux_store_inferior_registers): Likewise. ++ + 2017-06-04 Joel Brobecker + + * version.in: Set GDB version number to 8.0.0.DATE-git. +--- a/gdb/arm-linux-nat.c ++++ b/gdb/arm-linux-nat.c +@@ -402,7 +402,8 @@ arm_linux_fetch_inferior_registers (struct target_ops *ops, + fetch_wmmx_regs (regcache); + else if (tdep->vfp_register_count > 0 + && regno >= ARM_D0_REGNUM +- && regno <= ARM_D0_REGNUM + tdep->vfp_register_count) ++ && (regno < ARM_D0_REGNUM + tdep->vfp_register_count ++ || regno == ARM_FPSCR_REGNUM)) + fetch_vfp_regs (regcache); + } + } +@@ -439,7 +440,8 @@ arm_linux_store_inferior_registers (struct target_ops *ops, + store_wmmx_regs (regcache); + else if (tdep->vfp_register_count > 0 + && regno >= ARM_D0_REGNUM +- && regno <= ARM_D0_REGNUM + tdep->vfp_register_count) ++ && (regno < ARM_D0_REGNUM + tdep->vfp_register_count ++ || regno == ARM_FPSCR_REGNUM)) + store_vfp_regs (regcache); + } + } + + + +commit cd33a03d183a268b83ccbcae07f3788308e8d9f4 +Author: Yao Qi +Date: Tue Jul 25 11:38:50 2017 +0100 + + Catch exceptions thrown from gdbarch_skip_prologue + + PR 21555 is caused by the exception during the prologue analysis when re-set + a breakpoint. + + (gdb) bt + #0 memory_error_message (err=TARGET_XFER_E_IO, gdbarch=0x153db50, memaddr=93824992233232) at ../../binutils-gdb/gdb/corefile.c:192 + #1 0x00000000005718ed in memory_error (err=TARGET_XFER_E_IO, memaddr=memaddr@entry=93824992233232) at ../../binutils-gdb/gdb/corefile.c:220 + #2 0x00000000005719d6 in read_memory_object (object=object@entry=TARGET_OBJECT_CODE_MEMORY, memaddr=93824992233232, memaddr@entry=1, myaddr=myaddr@entry=0x7fffffffd0a0 "P\333S\001", len=len@entry=1) at ../../binutils-gdb/gdb/corefile.c:259 + #3 0x0000000000571c6e in read_code (len=1, myaddr=0x7fffffffd0a0 "P\333S\001", memaddr=) at ../../binutils-gdb/gdb/corefile.c:287 + #4 read_code_unsigned_integer (memaddr=memaddr@entry=93824992233232, len=len@entry=1, byte_order=byte_order@entry=BFD_ENDIAN_LITTLE) at ../../binutils-gdb/gdb/corefile.c:362 + #5 0x000000000041d4a0 in amd64_analyze_prologue (gdbarch=gdbarch@entry=0x153db50, pc=pc@entry=93824992233232, current_pc=current_pc@entry=18446744073709551615, cache=cache@entry=0x7fffffffd1e0) at ../../binutils-gdb/gdb/amd64-tdep.c:2310 + #6 0x000000000041e404 in amd64_skip_prologue (gdbarch=0x153db50, start_pc=93824992233232) at ../../binutils-gdb/gdb/amd64-tdep.c:2459 + #7 0x000000000067bfb0 in skip_prologue_sal (sal=sal@entry=0x7fffffffd4e0) at ../../binutils-gdb/gdb/symtab.c:3628 + #8 0x000000000067c4d8 in find_function_start_sal (sym=sym@entry=0x1549960, funfirstline=1) at ../../binutils-gdb/gdb/symtab.c:3501 + #9 0x000000000060999d in symbol_to_sal (result=result@entry=0x7fffffffd5f0, funfirstline=, sym=sym@entry=0x1549960) at ../../binutils-gdb/gdb/linespec.c:3860 + .... + #16 0x000000000054b733 in location_to_sals (b=b@entry=0x15792d0, location=0x157c230, search_pspace=search_pspace@entry=0x1148120, found=found@entry=0x7fffffffdc64) at ../../binutils-gdb/gdb/breakpoint.c:14211 + #17 0x000000000054c1f5 in breakpoint_re_set_default (b=0x15792d0) at ../../binutils-gdb/gdb/breakpoint.c:14301 + #18 0x00000000005412a9 in breakpoint_re_set_one (bint=bint@entry=0x15792d0) at ../../binutils-gdb/gdb/breakpoint.c:14412 + + This problem can be fixed by + + - either each prologue analyzer doesn't throw exception, + - or catch the exception thrown from gdbarch_skip_prologue, + + I choose the latter because the former needs to fix *every* prologue + analyzer to not throw exception. + + This error can be reproduced by changing reread.exp. The test reread.exp + has already test that breakpoint can be reset correctly after the + executable is re-read. This patch extends this test by compiling test c + file with and without -fPIE. + + (gdb) run ^M + The program being debugged has been started already.^M + Start it from the beginning? (y or n) y^M + x86_64/gdb/testsuite/outputs/gdb.base/reread/reread' has changed; re-reading symbols. + Error in re-setting breakpoint 1: Cannot access memory at address 0x555555554790^M + Error in re-setting breakpoint 2: Cannot access memory at address 0x555555554790^M + Starting program: /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.base/reread/reread ^M + This is foo^M + [Inferior 1 (process 27720) exited normally]^M + (gdb) FAIL: gdb.base/reread.exp: opts= "-fPIE" "ldflags=-pie" : run to foo() second time (the program exited) + + This patch doesn't re-indent the code, to keep the patch simple. + + gdb: + + 2017-07-25 Yao Qi + + PR gdb/21555 + * arch-utils.c (gdbarch_skip_prologue_noexcept): New function. + * arch-utils.h (gdbarch_skip_prologue_noexcept): Declare. + * infrun.c: Include arch-utils.h + (handle_step_into_function): Call gdbarch_skip_prologue_noexcept. + (handle_step_into_function_backward): Likewise. + * symtab.c (skip_prologue_sal): Likewise. + + gdb/testsuite: + + 2017-07-25 Yao Qi + + PR gdb/21555 + * gdb.base/reread.exp: Wrap the whole test with two kinds of + compilation flags, with -fPIE and without -fPIE. + +--- a/gdb/arch-utils.c ++++ b/gdb/arch-utils.c +@@ -964,6 +964,24 @@ default_guess_tracepoint_registers (struct gdbarch *gdbarch, + regcache_raw_supply (regcache, pc_regno, regs); + } + ++/* See arch-utils.h. */ ++ ++CORE_ADDR ++gdbarch_skip_prologue_noexcept (gdbarch *gdbarch, CORE_ADDR pc) noexcept ++{ ++ CORE_ADDR new_pc = pc; ++ ++ TRY ++ { ++ new_pc = gdbarch_skip_prologue (gdbarch, pc); ++ } ++ CATCH (ex, RETURN_MASK_ALL) ++ {} ++ END_CATCH ++ ++ return new_pc; ++} ++ + /* -Wmissing-prototypes */ + extern initialize_file_ftype _initialize_gdbarch_utils; + +--- a/gdb/arch-utils.h ++++ b/gdb/arch-utils.h +@@ -267,4 +267,10 @@ extern void default_guess_tracepoint_registers (struct gdbarch *gdbarch, + struct regcache *regcache, + CORE_ADDR addr); + ++/* Wrapper to gdbarch_skip_prologue, but doesn't throw exception. Catch ++ exception thrown from gdbarch_skip_prologue, and return PC. */ ++ ++extern CORE_ADDR gdbarch_skip_prologue_noexcept (gdbarch *gdbarch, ++ CORE_ADDR pc) noexcept; ++ + #endif +--- a/gdb/infrun.c ++++ b/gdb/infrun.c +@@ -64,6 +64,7 @@ + #include "event-loop.h" + #include "thread-fsm.h" + #include "common/enum-flags.h" ++#include "arch-utils.h" + + /* Prototypes for local functions */ + +@@ -7314,8 +7315,8 @@ handle_step_into_function (struct gdbarch *gdbarch, + + cust = find_pc_compunit_symtab (stop_pc); + if (cust != NULL && compunit_language (cust) != language_asm) +- ecs->stop_func_start = gdbarch_skip_prologue (gdbarch, +- ecs->stop_func_start); ++ ecs->stop_func_start ++ = gdbarch_skip_prologue_noexcept (gdbarch, ecs->stop_func_start); + + stop_func_sal = find_pc_line (ecs->stop_func_start, 0); + /* Use the step_resume_break to step until the end of the prologue, +@@ -7393,8 +7394,8 @@ handle_step_into_function_backward (struct gdbarch *gdbarch, + + cust = find_pc_compunit_symtab (stop_pc); + if (cust != NULL && compunit_language (cust) != language_asm) +- ecs->stop_func_start = gdbarch_skip_prologue (gdbarch, +- ecs->stop_func_start); ++ ecs->stop_func_start ++ = gdbarch_skip_prologue_noexcept (gdbarch, ecs->stop_func_start); + + stop_func_sal = find_pc_line (stop_pc, 0); + +--- a/gdb/symtab.c ++++ b/gdb/symtab.c +@@ -61,6 +61,7 @@ + + #include "parser-defs.h" + #include "completer.h" ++#include "arch-utils.h" + + /* Forward declarations for local functions. */ + +@@ -3626,7 +3627,7 @@ skip_prologue_sal (struct symtab_and_line *sal) + if (gdbarch_skip_entrypoint_p (gdbarch)) + pc = gdbarch_skip_entrypoint (gdbarch, pc); + if (skip) +- pc = gdbarch_skip_prologue (gdbarch, pc); ++ pc = gdbarch_skip_prologue_noexcept (gdbarch, pc); + + /* For overlays, map pc back into its mapped VMA range. */ + pc = overlay_mapped_address (pc, section); +--- a/gdb/testsuite/gdb.base/reread.exp ++++ b/gdb/testsuite/gdb.base/reread.exp +@@ -15,111 +15,131 @@ + + set prototypes 1 + +-# build the first test case ++# Build programs in PIE mode, to reproduce PR 21555. ++foreach_with_prefix opts { ++ { "" "" } ++ { "-fPIE" "ldflags=-pie" } } { + +-set testfile1 "reread1" +-set srcfile1 ${testfile1}.c +-# Cygwin needs $EXEEXT. +-set binfile1 [standard_output_file ${testfile1}$EXEEXT] +- +-if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile1}" executable {debug nowarnings}] != "" } { +- untested "failed to compile first testcase" +- return -1 +-} +- +-# build the second test case +- +-set testfile2 "reread2" +-set srcfile2 ${testfile2}.c +-set binfile2 [standard_output_file ${testfile2}$EXEEXT] +- +-if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug nowarnings}] != "" +- && [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug nowarnings additional_flags=-DNO_SECTIONS}] != ""} { +- untested "failed to compile second testcase" +- return -1 +-} +- +-# Start with a fresh gdb. +- +-set testfile "reread" +-set binfile [standard_output_file ${testfile}$EXEEXT] +- +-gdb_start +-gdb_reinitialize_dir $srcdir/$subdir +- +-# Load the first executable. +- +-gdb_rename_execfile ${binfile1} ${binfile} +-gdb_load ${binfile} +- +-# Set a breakpoint at foo +- +-gdb_test "break foo" \ +- "Breakpoint.*at.* file .*$srcfile1, line 14.*" \ +- "breakpoint foo in first file" +- +- +-# Run, should see "Breakpoint 1, foo () at hello1.c:14" +- +-gdb_run_cmd +-gdb_test "" "Breakpoint.* foo .* at .*$srcfile1:14.*" "run to foo()" +- +-# Restore first executable to its original name, and move +-# second executable into its place. Ensure that the new +-# executable is at least a second newer than the old. +- +-gdb_rename_execfile ${binfile} ${binfile1} +-gdb_rename_execfile ${binfile2} ${binfile} +-gdb_test "shell sleep 1" ".*" "" +-gdb_touch_execfile ${binfile} +- +-# Run a second time; GDB should detect that the executable has changed +-# and reset the breakpoints correctly. +-# Should see "Breakpoint 1, foo () at reread2.c:9" +- +-set test "run to foo() second time" +-if [is_remote target] { +- unsupported $test +-} else { +- gdb_run_cmd +- gdb_test "" "Breakpoint.* foo .* at .*:9.*" $test +-} +- +- +-### Second pass: verify that GDB checks the executable file's +-### timestamp when the program is *restarted*, not just when it exits. +- +-if [is_remote target] { +- unsupported "second pass: GDB should check for changes before running" +-} else { +- +- # Put the older executable back in place. +- gdb_rename_execfile ${binfile} ${binfile2} +- gdb_rename_execfile ${binfile1} ${binfile} +- +- # Restart GDB entirely. +- clean_restart ${binfile} +- +- # Set a breakpoint on foo and run to it. +- gdb_test "break foo" \ +- "Breakpoint.*at.* file .*$srcfile1, line 14.*" \ +- "second pass: breakpoint foo in first file" +- gdb_run_cmd +- gdb_test "" "Breakpoint.* foo .* at .*$srcfile1:14.*" "second pass: run to foo()" +- +- # This time, let the program run to completion. If GDB checks the +- # executable file's timestamp now, it won't notice any change. +- gdb_continue_to_end "second pass" +- +- # Now move the newer executable into place, and re-run. GDB +- # should still notice that the executable file has changed, +- # and still re-set the breakpoint appropriately. +- gdb_rename_execfile ${binfile} ${binfile1} +- gdb_rename_execfile ${binfile2} ${binfile} +- gdb_run_cmd +- gdb_test "" "Breakpoint.* foo .* at .*:9.*" "second pass: run to foo() second time" +-} ++ # build the first test case + ++ set testfile1 "reread1" ++ set srcfile1 ${testfile1}.c ++ # Cygwin needs $EXEEXT. ++ set binfile1 [standard_output_file ${testfile1}$EXEEXT] ++ ++ set testfile1_opt [list debug nowarnings \ ++ additional_flags=[lindex $opts 0] \ ++ [lindex $opts 1] ] ++ if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile1}" \ ++ executable ${testfile1_opt}] != "" } { ++ untested "failed to compile first testcase" ++ return -1 ++ } ++ ++ # build the second test case ++ ++ set testfile2 "reread2" ++ set srcfile2 ${testfile2}.c ++ set binfile2 [standard_output_file ${testfile2}$EXEEXT] ++ ++ set testfile2_opt1 [list debug nowarnings \ ++ additional_flags=[lindex $opts 0] \ ++ [lindex $opts 1]] ++ set testfile2_op2 [list debug nowarnings \ ++ "additional_flags=-DNO_SECTIONS [lindex $opts 0]" \ ++ [lindex $opts 1]] ++ if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" \ ++ executable ${testfile2_opt1}] != "" ++ && [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" \ ++ executable ${testfile2_opt2}] != ""} { ++ untested "failed to compile second testcase" ++ return -1 ++ } ++ ++ # Start with a fresh gdb. ++ ++ set testfile "reread" ++ set binfile [standard_output_file ${testfile}$EXEEXT] ++ ++ gdb_start ++ gdb_reinitialize_dir $srcdir/$subdir ++ ++ # Load the first executable. ++ ++ gdb_rename_execfile ${binfile1} ${binfile} ++ gdb_load ${binfile} ++ ++ # Set a breakpoint at foo ++ ++ gdb_test "break foo" \ ++ "Breakpoint.*at.* file .*$srcfile1, line 14.*" \ ++ "breakpoint foo in first file" ++ ++ ++ # Run, should see "Breakpoint 1, foo () at hello1.c:14" ++ ++ gdb_run_cmd ++ gdb_test "" "Breakpoint.* foo .* at .*$srcfile1:14.*" "run to foo()" ++ ++ # Restore first executable to its original name, and move ++ # second executable into its place. Ensure that the new ++ # executable is at least a second newer than the old. ++ ++ gdb_rename_execfile ${binfile} ${binfile1} ++ gdb_rename_execfile ${binfile2} ${binfile} ++ gdb_test "shell sleep 1" ".*" "" ++ gdb_touch_execfile ${binfile} ++ ++ # Run a second time; GDB should detect that the executable has changed ++ # and reset the breakpoints correctly. ++ # Should see "Breakpoint 1, foo () at reread2.c:9" ++ ++ set test "run to foo() second time" ++ if [is_remote target] { ++ unsupported $test ++ } else { ++ gdb_run_cmd ++ gdb_test "" "Breakpoint.* foo .* at .*:9.*" $test ++ } ++ ++ ++ ### Second pass: verify that GDB checks the executable file's ++ ### timestamp when the program is *restarted*, not just when it exits. ++ ++ if [is_remote target] { ++ unsupported "second pass: GDB should check for changes before running" ++ } else { ++ ++ # Put the older executable back in place. ++ gdb_rename_execfile ${binfile} ${binfile2} ++ gdb_rename_execfile ${binfile1} ${binfile} ++ ++ # Restart GDB entirely. ++ clean_restart ${binfile} ++ ++ # Set a breakpoint on foo and run to it. ++ gdb_test "break foo" \ ++ "Breakpoint.*at.* file .*$srcfile1, line 14.*" \ ++ "second pass: breakpoint foo in first file" ++ gdb_run_cmd ++ gdb_test "" "Breakpoint.* foo .* at .*$srcfile1:14.*" \ ++ "second pass: run to foo()" ++ ++ # This time, let the program run to completion. If GDB checks the ++ # executable file's timestamp now, it won't notice any change. ++ gdb_continue_to_end "second pass" ++ ++ # Now move the newer executable into place, and re-run. GDB ++ # should still notice that the executable file has changed, ++ # and still re-set the breakpoint appropriately. ++ gdb_rename_execfile ${binfile} ${binfile1} ++ gdb_rename_execfile ${binfile2} ${binfile} ++ gdb_run_cmd ++ gdb_test "" "Breakpoint.* foo .* at .*:9.*" \ ++ "second pass: run to foo() second time" ++ } ++ ++ } + # End of tests. + + return 0 diff --git a/gdb.spec b/gdb.spec index 7d5c8b9..26d95b9 100644 --- a/gdb.spec +++ b/gdb.spec @@ -26,7 +26,7 @@ Version: 8.0 # 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: 19%{?dist} +Release: 20%{?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 @@ -280,7 +280,7 @@ Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch # Backported fixups post the source tarball. #Xdrop: Just backports. -#Patch232: gdb-upstream.patch +Patch232: gdb-upstream.patch # Testcase for PPC Power6/DFP instructions disassembly (BZ 230000). #=fedoratest @@ -914,7 +914,7 @@ find -name "*.info*"|xargs rm -f # Match the Fedora's version info. %patch2 -p1 -#patch232 -p1 +%patch232 -p1 %patch349 -p1 %patch1058 -p1 %patch1132 -p1 @@ -1635,10 +1635,13 @@ then fi %changelog -* Wed Aug 02 2017 Fedora Release Engineering - 8.0-19 +* Thu Aug 3 2017 Jan Kratochvil - 8.0-20.fc26 +- Two fixes from upstream stable branch 8.0. + +* Wed Aug 2 2017 Fedora Release Engineering - 8.0-19.fc26 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild -* Wed Jul 26 2017 Fedora Release Engineering - 8.0-18 +* Wed Jul 26 2017 Fedora Release Engineering - 8.0-18.fc26 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild * Mon Jun 12 2017 Jan Kratochvil - 8.0-17.fc26