From 8cff818ba3b6b5a0e7f82f6da06b28a36cd6217f Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Aug 23 2016 19:04:27 +0000 Subject: Merge Fedora packaging changes from Fedora 24 gdb-7.11.1-83.fc24: --- diff --git a/.gitignore b/.gitignore index 2c4600f..906a1f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -/gdb-libstdc++-v3-python-r225521.tar.xz +/gdb-libstdc++-v3-python-6.1.1-20160817.tar.xz +/v1.5.tar.gz /gdb-7.11.90.20160807.tar.xz diff --git a/gdb-linux_perf-bundle.patch b/gdb-linux_perf-bundle.patch new file mode 100644 index 0000000..c280279 --- /dev/null +++ b/gdb-linux_perf-bundle.patch @@ -0,0 +1,222 @@ +Index: gdb-7.11.1/gdb/nat/linux-btrace.h +=================================================================== +--- gdb-7.11.1.orig/gdb/nat/linux-btrace.h 2016-02-10 04:19:39.000000000 +0100 ++++ gdb-7.11.1/gdb/nat/linux-btrace.h 2016-08-19 20:49:18.735477251 +0200 +@@ -28,6 +28,177 @@ + # include + #endif + ++#ifdef PERF_ATTR_SIZE_VER5_BUNDLE ++#ifndef HAVE_LINUX_PERF_EVENT_H ++# error "PERF_ATTR_SIZE_VER5_BUNDLE && !HAVE_LINUX_PERF_EVENT_H" ++#endif ++#ifndef PERF_ATTR_SIZE_VER5 ++#define PERF_ATTR_SIZE_VER5 ++#define perf_event_mmap_page perf_event_mmap_page_bundle ++// kernel-headers-3.10.0-493.el7.x86_64/usr/include/linux/perf_event.h ++/* ++ * Structure of the page that can be mapped via mmap ++ */ ++struct perf_event_mmap_page { ++ __u32 version; /* version number of this structure */ ++ __u32 compat_version; /* lowest version this is compat with */ ++ ++ /* ++ * Bits needed to read the hw events in user-space. ++ * ++ * u32 seq, time_mult, time_shift, index, width; ++ * u64 count, enabled, running; ++ * u64 cyc, time_offset; ++ * s64 pmc = 0; ++ * ++ * do { ++ * seq = pc->lock; ++ * barrier() ++ * ++ * enabled = pc->time_enabled; ++ * running = pc->time_running; ++ * ++ * if (pc->cap_usr_time && enabled != running) { ++ * cyc = rdtsc(); ++ * time_offset = pc->time_offset; ++ * time_mult = pc->time_mult; ++ * time_shift = pc->time_shift; ++ * } ++ * ++ * index = pc->index; ++ * count = pc->offset; ++ * if (pc->cap_user_rdpmc && index) { ++ * width = pc->pmc_width; ++ * pmc = rdpmc(index - 1); ++ * } ++ * ++ * barrier(); ++ * } while (pc->lock != seq); ++ * ++ * NOTE: for obvious reason this only works on self-monitoring ++ * processes. ++ */ ++ __u32 lock; /* seqlock for synchronization */ ++ __u32 index; /* hardware event identifier */ ++ __s64 offset; /* add to hardware event value */ ++ __u64 time_enabled; /* time event active */ ++ __u64 time_running; /* time event on cpu */ ++ union { ++ __u64 capabilities; ++ struct { ++ __u64 cap_bit0 : 1, /* Always 0, deprecated, see commit 860f085b74e9 */ ++ cap_bit0_is_deprecated : 1, /* Always 1, signals that bit 0 is zero */ ++ ++ cap_user_rdpmc : 1, /* The RDPMC instruction can be used to read counts */ ++ cap_user_time : 1, /* The time_* fields are used */ ++ cap_user_time_zero : 1, /* The time_zero field is used */ ++ cap_____res : 59; ++ }; ++ }; ++ ++ /* ++ * If cap_user_rdpmc this field provides the bit-width of the value ++ * read using the rdpmc() or equivalent instruction. This can be used ++ * to sign extend the result like: ++ * ++ * pmc <<= 64 - width; ++ * pmc >>= 64 - width; // signed shift right ++ * count += pmc; ++ */ ++ __u16 pmc_width; ++ ++ /* ++ * If cap_usr_time the below fields can be used to compute the time ++ * delta since time_enabled (in ns) using rdtsc or similar. ++ * ++ * u64 quot, rem; ++ * u64 delta; ++ * ++ * quot = (cyc >> time_shift); ++ * rem = cyc & (((u64)1 << time_shift) - 1); ++ * delta = time_offset + quot * time_mult + ++ * ((rem * time_mult) >> time_shift); ++ * ++ * Where time_offset,time_mult,time_shift and cyc are read in the ++ * seqcount loop described above. This delta can then be added to ++ * enabled and possible running (if index), improving the scaling: ++ * ++ * enabled += delta; ++ * if (index) ++ * running += delta; ++ * ++ * quot = count / running; ++ * rem = count % running; ++ * count = quot * enabled + (rem * enabled) / running; ++ */ ++ __u16 time_shift; ++ __u32 time_mult; ++ __u64 time_offset; ++ /* ++ * If cap_usr_time_zero, the hardware clock (e.g. TSC) can be calculated ++ * from sample timestamps. ++ * ++ * time = timestamp - time_zero; ++ * quot = time / time_mult; ++ * rem = time % time_mult; ++ * cyc = (quot << time_shift) + (rem << time_shift) / time_mult; ++ * ++ * And vice versa: ++ * ++ * quot = cyc >> time_shift; ++ * rem = cyc & (((u64)1 << time_shift) - 1); ++ * timestamp = time_zero + quot * time_mult + ++ * ((rem * time_mult) >> time_shift); ++ */ ++ __u64 time_zero; ++ __u32 size; /* Header size up to __reserved[] fields. */ ++ ++ /* ++ * Hole for extension of the self monitor capabilities ++ */ ++ ++ __u8 __reserved[118*8+4]; /* align to 1k. */ ++ ++ /* ++ * Control data for the mmap() data buffer. ++ * ++ * User-space reading the @data_head value should issue an smp_rmb(), ++ * after reading this value. ++ * ++ * When the mapping is PROT_WRITE the @data_tail value should be ++ * written by userspace to reflect the last read data, after issueing ++ * an smp_mb() to separate the data read from the ->data_tail store. ++ * In this case the kernel will not over-write unread data. ++ * ++ * See perf_output_put_handle() for the data ordering. ++ * ++ * data_{offset,size} indicate the location and size of the perf record ++ * buffer within the mmapped area. ++ */ ++ __u64 data_head; /* head in the data section */ ++ __u64 data_tail; /* user-space written tail */ ++ __u64 data_offset; /* where the buffer starts */ ++ __u64 data_size; /* data buffer size */ ++ ++ /* ++ * AUX area is defined by aux_{offset,size} fields that should be set ++ * by the userspace, so that ++ * ++ * aux_offset >= data_offset + data_size ++ * ++ * prior to mmap()ing it. Size of the mmap()ed area should be aux_size. ++ * ++ * Ring buffer pointers aux_{head,tail} have the same semantics as ++ * data_{head,tail} and same ordering rules apply. ++ */ ++ __u64 aux_head; ++ __u64 aux_tail; ++ __u64 aux_offset; ++ __u64 aux_size; ++}; ++#endif // PERF_ATTR_SIZE_VER5 ++#endif // PERF_ATTR_SIZE_VER5_BUNDLE ++ + struct target_ops; + + #if HAVE_LINUX_PERF_EVENT_H +Index: gdb-7.11.1/gdb/configure +=================================================================== +--- gdb-7.11.1.orig/gdb/configure 2016-08-19 20:47:11.488325144 +0200 ++++ gdb-7.11.1/gdb/configure 2016-08-19 20:47:11.658326684 +0200 +@@ -10635,7 +10635,7 @@ + + #include + #ifndef PERF_ATTR_SIZE_VER5 +-# error ++// error // PERF_ATTR_SIZE_VER5_BUNDLE is not available here - Fedora+RHEL + #endif + + _ACEOF +Index: gdb-7.11.1/gdb/configure.ac +=================================================================== +--- gdb-7.11.1.orig/gdb/configure.ac 2016-08-19 20:47:11.489325154 +0200 ++++ gdb-7.11.1/gdb/configure.ac 2016-08-19 20:47:11.659326693 +0200 +@@ -1452,7 +1452,7 @@ + AC_PREPROC_IFELSE(AC_LANG_SOURCE([[ + #include + #ifndef PERF_ATTR_SIZE_VER5 +-# error ++// error // PERF_ATTR_SIZE_VER5_BUNDLE is not available here - Fedora+RHEL + #endif + ]]), [perf_event=yes], [perf_event=no]) + if test "$perf_event" != yes; then +--- gdb-7.11.1/gdb/gdb.c-orig 2016-02-10 04:19:39.000000000 +0100 ++++ gdb-7.11.1/gdb/gdb.c 2016-08-23 09:15:13.169650953 +0200 +@@ -25,6 +25,11 @@ main (int argc, char **argv) + { + struct captured_main_args args; + ++#ifdef PERF_ATTR_SIZE_VER5_BUNDLE ++ extern void __libipt_init(void); ++ __libipt_init(); ++#endif ++ + memset (&args, 0, sizeof args); + args.argc = argc; + args.argv = argv; diff --git a/gdb.spec b/gdb.spec index 15506bf..19d6a63 100644 --- a/gdb.spec +++ b/gdb.spec @@ -27,7 +27,7 @@ Version: 7.11.90.20160807 # 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: 5%{?dist} +Release: 6%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL Group: Development/Debuggers @@ -122,12 +122,17 @@ Source3: gdb-gstack.man Source4: gdbinit # libstdc++ pretty printers from GCC SVN. -%global libstdcxxpython gdb-libstdc++-v3-python-r225521 +%global libstdcxxpython gdb-libstdc++-v3-python-6.1.1-20160817 Source5: %{libstdcxxpython}.tar.xz # 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.5 +Source7: v%{libipt_version}.tar.gz +Patch1142: v1.5-libipt-static.patch + # Work around out-of-date dejagnu that does not have KFAIL #=drop: That dejagnu is too old to be supported. Patch1: gdb-6.3-rh-dummykfail-20041202.patch @@ -576,6 +581,9 @@ Patch1120: gdb-testsuite-dw2-undefined-ret-addr.patch # New test for Python "Cannot locate object file for block" (for RH BZ 1325795). Patch1123: gdb-rhbz1325795-framefilters-test.patch +# [dts+el7] [x86*] Bundle linux_perf.h for libipt (RH BZ 1256513). +Patch1143: gdb-linux_perf-bundle.patch + %if 0%{!?rhel:1} || 0%{?rhel} > 6 # RL_STATE_FEDORA_GDB would not be found for: # Patch642: gdb-readline62-ask-more-rh.patch @@ -617,12 +625,16 @@ BuildRequires: libbabeltrace-devel%{buildisa} BuildRequires: guile-devel%{buildisa} %endif %global have_libipt 0 -%if 0%{!?rhel:1} || 0%{?rhel} > 7 +%if 0%{!?rhel:1} || 0%{?rhel} > 7 || (0%{?rhel} == 7 && 0%{?scl:1}) %ifarch %{ix86} x86_64 %global have_libipt 1 +%if 0%{?el7:1} && 0%{?scl:1} +BuildRequires: cmake +%else BuildRequires: libipt-devel%{buildisa} %endif %endif +%endif %if 0%{?_with_testsuite:1} @@ -753,6 +765,14 @@ This package provides INFO, HTML and PDF user manual for GDB. tar xJf %{SOURCE5} %endif # 0%{?rhel:1} && 0%{?rhel} <= 7 +%if 0%{have_libipt} && 0%{?el7:1} && 0%{?scl:1} +tar xzf %{SOURCE7} +( + cd processor-trace-%{libipt_version} +%patch1142 -p1 +) +%endif + # Files have `# ' statements breaking VPATH / find-debuginfo.sh . (cd gdb;rm -fv $(perl -pe 's/\\\n/ /' 6 CFLAGS="$CFLAGS -DNEED_RL_STATE_FEDORA_GDB" @@ -981,6 +1007,25 @@ CFLAGS="$CFLAGS -DNEED_DETACH_SIGSTOP" export CXXFLAGS="$CFLAGS" +%if 0%{have_libipt} && 0%{?el7:1} && 0%{?scl:1} +( + 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_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 + # --htmldir and --pdfdir are not used as they are used from %{gdb_build}. ../configure \ --prefix=%{_prefix} \ @@ -1424,6 +1469,27 @@ then fi %changelog +* Tue Aug 23 2016 Jan Kratochvil - 7.11.90.20160807-6.fc25 +- Merge Fedora packaging changes from Fedora 24 gdb-7.11.1-83.fc24: + +* Tue Aug 23 2016 Jan Kratochvil - 7.11.1-83.fc24 +- [dts+el7] [x86*] Bundle libipt - fix#3 its initialization (RH BZ 1256513). + +* Tue Aug 23 2016 Jan Kratochvil - 7.11.1-82.fc24 +- [dts+el7] [x86*] Bundle libipt - fix#2 its initialization (RH BZ 1256513). + +* Tue Aug 23 2016 Jan Kratochvil - 7.11.1-81.fc24 +- [dts+el7] [x86*] Bundle libipt - fix its initialization (RH BZ 1256513). + +* Mon Aug 22 2016 Jan Kratochvil - 7.11.1-80.fc24 +- [dts] Upgrade libstdc++-v3-python to 6.1.1-20160817. + +* Fri Aug 19 2016 Jan Kratochvil - 7.11.1-79.fc24 +- [dts+el7] [x86*] Bundle linux_perf.h for libipt (RH BZ 1256513). + +* Wed Aug 17 2016 Jan Kratochvil - 7.11.1-78.fc24 +- [dts+el7] [x86*] Bundle libipt (RH BZ 1256513). + * Sun Aug 7 2016 Jan Kratochvil - 7.11.90.20160807-5.fc25 - Rebase to FSF GDB 7.11.90.20160807 (pre-7.12 branch snapshot). diff --git a/sources b/sources index b30dc7c..001dab7 100644 --- a/sources +++ b/sources @@ -1,2 +1,3 @@ -7ad32d3894aaf90d00a4343a735c3e1c gdb-libstdc++-v3-python-r225521.tar.xz +131d0dfd20cd6014c168fbcab9be2c43 gdb-libstdc++-v3-python-6.1.1-20160817.tar.xz +29efc08219d9d6a0536d58f9807c8722 v1.5.tar.gz 2e52dd8b63eb0a459febbee01221fb10 gdb-7.11.90.20160807.tar.xz diff --git a/v1.5-libipt-static.patch b/v1.5-libipt-static.patch new file mode 100644 index 0000000..477b6c4 --- /dev/null +++ b/v1.5-libipt-static.patch @@ -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();