- Link gdb against a bundled libipt (processor trace

library) on x86_64 and i686 for improved tracing support
  on Intel CPUs.  [bnc#985550]

OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=168
This commit is contained in:
Michael Matz 2017-10-04 11:22:40 +00:00 committed by Git OBS Bridge
parent 0ffa8e959b
commit a49b30a4fc
5 changed files with 106 additions and 0 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Oct 4 11:20:39 UTC 2017 - matz@suse.com
- Link gdb against a bundled libipt (processor trace
library) on x86_64 and i686 for improved tracing support
on Intel CPUs. [bnc#985550]
-------------------------------------------------------------------
Mon Oct 2 14:49:04 UTC 2017 - matz@suse.com

View File

@ -81,6 +81,10 @@ Source5: %{libstdcxxpython}.tar.bz2
# Provide gdbtui for RHEL-5 and RHEL-6 as it is removed upstream (BZ 797664).
Source6: gdbtui
# libipt: Intel Processor Trace Decoder Library
%global libipt_version 1.6.1
Source7: v%{libipt_version}.tar.gz
# Infrastructure to sync patches from the Fedora rpm
Source10: patchlist.pl
Source11: patchname_get.sh
@ -255,6 +259,10 @@ Patch164: gdb-rhbz1398387-tab-crash-test.patch
Patch165: gdb-testsuite-readline63-sigint.patch
#Fedora Packages end
# libipt support
Patch500: v1.5-libipt-static.patch
Patch501: v1.6.1-implicit-fallthrough.patch
# Upstream patch to fix gcc -Werror
Patch1002: gdb-6.6-buildid-locate-rpm-suse.patch
Patch1003: gdb-pahole-python2.patch
@ -300,6 +308,14 @@ Requires: python-base
BuildRequires: python-devel
%endif # 0%{!?_without_python:1}
%global have_libipt 0
%if 0%{suse_version} > 1000
%ifarch %{ix86} x86_64
%global have_libipt 1
BuildRequires: cmake
%endif
%endif
# BuildArch would break RHEL-5 by overriding arch and not building noarch.
%if 0%{?el5:1}
ExclusiveArch: noarch i386 x86_64 ppc ppc64 ia64 s390 s390x
@ -607,6 +623,16 @@ find -name "*.info*"|xargs rm -f
%patch2003 -p1
%patch2004 -p1
#unpack libipt
%if 0%{have_libipt}
tar xzf %{SOURCE7}
(
cd processor-trace-%{libipt_version}
%patch500 -p1
%patch501 -p1
)
%endif
find -name "*.orig" | xargs rm -f
! find -name "*.rej" # Should not happen.
@ -647,6 +673,26 @@ export CFLAGS="$RPM_OPT_FLAGS"
if echo "" | $CC -x c -c - -o /dev/null -Wno-implicit-fallthrough >/dev/null 2>&1; then
CFLAGS="$CFLAGS -Wno-implicit-fallthrough"
fi
%if %{have_libipt}
CFLAGS="$CFLAGS -DPERF_ATTR_SIZE_VER5_BUNDLE"
(
mkdir processor-trace-%{libipt_version}-root
mkdir processor-trace-%{libipt_version}-build
cd processor-trace-%{libipt_version}-build
# -DPTUNIT:BOOL=ON has no effect on ctest.
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DPTUNIT:BOOL=OFF \
-DDEVBUILD:BOOL=ON \
../../processor-trace-%{libipt_version}
make VERBOSE=1 %{?_smp_mflags}
ctest -V %{?_smp_mflags}
make install DESTDIR=../processor-trace-%{libipt_version}-root
)
# There is also: --with-libipt-prefix
CFLAGS="$CFLAGS -I$PWD/processor-trace-%{libipt_version}-root%{_includedir}"
LDFLAGS="$LDFLAGS -L$PWD/processor-trace-%{libipt_version}-root%{_libdir}"
%endif
export CXXFLAGS="$CFLAGS"
export LIBRPM=no
@ -730,6 +776,11 @@ $(: ppc64 host build crashes on ppc variant of libexpat.so ) \
--enable-inprocess-agent \
%else
--disable-inprocess-agent \
%endif
%if %{have_libipt}
--with-intel-pt \
%else
--without-intel-pt \
%endif
--with-bugurl=http://bugs.opensuse.org/ \
--with-pkgversion="GDB; %{DIST}" \

22
v1.5-libipt-static.patch Normal file
View File

@ -0,0 +1,22 @@
--- 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)
set(LIBIPT_FILES ${LIBIPT_FILES} ${LIBIPT_SECTION_FILES})
-add_library(libipt SHARED
+add_library(libipt STATIC
${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
@@ -29,7 +29,7 @@
#include "pt_ild.h"
-static void __attribute__((constructor)) init(void)
+void __libipt_init(void)
{
/* Initialize the Intel(R) Processor Trace instruction decoder. */
pt_ild_init();

View File

@ -0,0 +1,23 @@
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;

3
v1.6.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:861fd8178414e07ba622b5e40f5ba4d68d62f4712a8302a7ec51997748c4585a
size 250843