Compare commits
56 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
238a2d5e59 | ||
|
|
2c3bf3ff72 | ||
|
|
1aaacf00c0 | ||
|
|
4d320a0508 | ||
|
|
75a479c9cc | ||
|
|
e8cdcd672a | ||
|
|
6600f8b882 | ||
|
|
1e4aa1f8f9 | ||
|
|
05fb71cf62 | ||
|
|
9dde4656ab | ||
|
|
1a6e35086a | ||
|
|
ba863fce9d | ||
|
|
a0b8b3efb5 |
||
|
|
83283f30bb | ||
|
|
bd527a689e | ||
|
|
15cf32d088 | ||
|
|
0139cfdb77 | ||
|
|
407d316605 | ||
|
|
4415a5d270 | ||
|
|
7262c85591 | ||
|
|
a4ccd30890 | ||
|
|
6b692d8ea3 | ||
|
|
b958d1d861 | ||
|
|
6fd6035841 | ||
|
|
8c06128c9f | ||
|
|
3c9bcecebd |
||
|
|
5613a7798b | ||
|
|
afaa35c98c | ||
|
|
05e041c920 | ||
|
|
df818674e3 | ||
|
|
765f434830 | ||
|
|
511a74a18b | ||
|
|
7ff5c1b1b5 | ||
|
|
6f56eaefa4 | ||
|
|
c69dd4f6e2 | ||
|
|
6d48c36717 | ||
|
|
0b66d3bae3 | ||
|
|
c7e910447c | ||
|
|
c2951e4bc5 | ||
|
|
5c6c00a9e5 | ||
|
|
e350d4cd07 | ||
|
|
7d4fab42a8 | ||
|
|
43c3301e82 | ||
|
|
52366e3364 | ||
|
|
a10ca5be63 | ||
|
|
ce2957123d | ||
|
|
489f2de661 | ||
|
|
90c81439ea | ||
|
|
77d455a6b5 | ||
|
|
9ebd1d0187 | ||
|
|
2eb398d8d5 | ||
|
|
36f9c5a1f5 | ||
|
|
63c540813b | ||
|
|
d64c178af3 | ||
|
|
9821229e2e | ||
|
|
570c7ab5bb |
30 changed files with 1217 additions and 485 deletions
1
.fmf/version
Normal file
1
.fmf/version
Normal file
|
|
@ -0,0 +1 @@
|
|||
1
|
||||
14
.gitignore
vendored
14
.gitignore
vendored
|
|
@ -23,3 +23,17 @@
|
|||
/dyninst-10.1.0.tar.gz
|
||||
/dyninst-10.2.0.tar.gz
|
||||
/dyninst-10.2.1.tar.gz
|
||||
/dyninst-11.0.0.tar.gz
|
||||
/testsuite-11.0.0.tar.gz
|
||||
/dyninst-11.0.1.tar.gz
|
||||
/testsuite-11.0.1.tar.gz
|
||||
/dyninst-12.0.1.tar.gz
|
||||
/testsuite-12.0.0.tar.gz
|
||||
/dyninst-12.1.0.tar.gz
|
||||
/testsuite-12.1.0.tar.gz
|
||||
/dyninst-12.2.0.tar.gz
|
||||
/testsuite-12.2.0.tar.gz
|
||||
/dyninst-12.3.0.tar.gz
|
||||
/testsuite-12.3.0.tar.gz
|
||||
/dyninst-13.snap.20250123.g80e1adaf.tar.gz
|
||||
/dyninst-13.0.0.tar.gz
|
||||
|
|
|
|||
|
|
@ -1,317 +0,0 @@
|
|||
Debuginfod is a lightweight web service that indexes ELF/DWARF debugging
|
||||
resources by build-id and serves them over HTTP.
|
||||
|
||||
This patch enables dyninst to query debuginfod servers for a file's
|
||||
separate debuginfo when it otherwise cannot be found.
|
||||
|
||||
This patch also adds a cmake option -DENABLE_DEBUGINFOD to control
|
||||
whether dyninst is built with debuginfod support.
|
||||
|
||||
This requires having the debuginfod client library (libdebuginfod)
|
||||
and header installed.
|
||||
|
||||
Debuginfod is distributed with elfutils, for more information see
|
||||
https://sourceware.org/elfutils/Debuginfod.html
|
||||
---
|
||||
cmake/ElfUtils.cmake | 37 ++++++++---
|
||||
cmake/Modules/FindLibDebuginfod.cmake | 76 +++++++++++++++++++++
|
||||
cmake/options.cmake | 2 +
|
||||
elf/CMakeLists.txt | 3 +
|
||||
elf/src/Elf_X.C | 95 ++++++++++++++++++++-------
|
||||
5 files changed, 178 insertions(+), 35 deletions(-)
|
||||
create mode 100644 cmake/Modules/FindLibDebuginfod.cmake
|
||||
|
||||
--- dyninst-10.2.1/dyninst-10.2.1/cmake/ElfUtils.cmake
|
||||
+++ dyninst-10.2.1/dyninst-10.2.1/cmake/ElfUtils.cmake
|
||||
@@ -28,7 +28,7 @@
|
||||
#
|
||||
#======================================================================================
|
||||
|
||||
-if(LibElf_FOUND AND LibDwarf_FOUND)
|
||||
+if(LibElf_FOUND AND LibDwarf_FOUND AND (LibDebuginfod_FOUND OR NOT ENABLE_DEBUGINFOD))
|
||||
return()
|
||||
endif()
|
||||
|
||||
@@ -37,7 +37,12 @@ if(NOT UNIX)
|
||||
endif()
|
||||
|
||||
# Minimum acceptable version of elfutils
|
||||
-set(_min_version 0.178)
|
||||
+if(ENABLE_DEBUGINFOD)
|
||||
+ set(_min_version 0.179)
|
||||
+else()
|
||||
+ set(_min_version 0.178)
|
||||
+endif()
|
||||
+
|
||||
set(ElfUtils_MIN_VERSION ${_min_version}
|
||||
CACHE STRING "Minimum acceptable elfutils version")
|
||||
if(${ElfUtils_MIN_VERSION} VERSION_LESS ${_min_version})
|
||||
@@ -62,7 +67,7 @@ set(ElfUtils_LIBRARYDIR "${ElfUtils_ROOT_DIR}/lib"
|
||||
CACHE PATH "Hint directory that contains the elfutils library files")
|
||||
|
||||
# libelf/dwarf-specific directory hints
|
||||
-foreach(l LibElf LibDwarf)
|
||||
+foreach(l LibElf LibDwarf LibDebuginfod)
|
||||
foreach(d ROOT_DIR INCLUDEDIR LIBRARYDIR)
|
||||
set(${l}_${d} ${ElfUtils_${d}})
|
||||
endforeach()
|
||||
@@ -72,18 +77,30 @@ endforeach()
|
||||
|
||||
find_package(LibElf ${ElfUtils_MIN_VERSION})
|
||||
|
||||
-# Don't search for libdw if we didn't find a suitable libelf
|
||||
+# Don't search for libdw or libdebuginfod if we didn't find a suitable libelf
|
||||
if(LibElf_FOUND)
|
||||
find_package(LibDwarf ${ElfUtils_MIN_VERSION})
|
||||
+ if (ENABLE_DEBUGINFOD)
|
||||
+ find_package(LibDebuginfod ${ElfUtils_MIN_VERSION})
|
||||
+ endif()
|
||||
endif()
|
||||
|
||||
# -------------- SOURCE BUILD -------------------------------------------------
|
||||
-if(LibElf_FOUND AND LibDwarf_FOUND)
|
||||
- set(_eu_root ${ElfUtils_ROOT_DIR})
|
||||
- set(_eu_inc_dirs ${LibElf_INCLUDE_DIRS} ${LibDwarf_INCLUDE_DIRS})
|
||||
- set(_eu_lib_dirs ${LibElf_LIBRARY_DIRS} ${LibDwarf_LIBRARY_DIRS})
|
||||
- set(_eu_libs ${LibElf_LIBRARIES} ${LibDwarf_LIBRARIES})
|
||||
+if(LibElf_FOUND AND LibDwarf_FOUND AND (NOT ENABLE_DEBUGINFOD OR LibDebuginfod_FOUND))
|
||||
+ if(ENABLE_DEBUGINFOD AND LibDebuginfod_FOUND)
|
||||
+ set(_eu_root ${ElfUtils_ROOT_DIR})
|
||||
+ set(_eu_inc_dirs ${LibElf_INCLUDE_DIRS} ${LibDwarf_INCLUDE_DIRS} ${LibDebuginfod_INCLUDE_DIRS})
|
||||
+ set(_eu_lib_dirs ${LibElf_LIBRARY_DIRS} ${LibDwarf_LIBRARY_DIRS} ${LibDebuginfod_LIBRARY_DIRS})
|
||||
+ set(_eu_libs ${LibElf_LIBRARIES} ${LibDwarf_LIBRARIES} ${LibDebuginfod_LIBRARIES})
|
||||
+ else()
|
||||
+ set(_eu_root ${ElfUtils_ROOT_DIR})
|
||||
+ set(_eu_inc_dirs ${LibElf_INCLUDE_DIRS} ${LibDwarf_INCLUDE_DIRS})
|
||||
+ set(_eu_lib_dirs ${LibElf_LIBRARY_DIRS} ${LibDwarf_LIBRARY_DIRS})
|
||||
+ set(_eu_libs ${LibElf_LIBRARIES} ${LibDwarf_LIBRARIES})
|
||||
+ endif()
|
||||
add_library(ElfUtils SHARED IMPORTED)
|
||||
+elseif(ENABLE_DEBUGINFOD AND NOT LibDebuginfod_FOUND)
|
||||
+ message(FATAL_ERROR "Debuginfod enabled but not found")
|
||||
elseif(NOT (LibElf_FOUND AND LibDwarf_FOUND) AND STERILE_BUILD)
|
||||
message(FATAL_ERROR "Elfutils not found and cannot be downloaded because build is sterile.")
|
||||
else()
|
||||
|
||||
--- /dev/null
|
||||
+++ dyninst-10.2.1/dyninst-10.2.1/cmake/Modules/FindLibDebuginfod.cmake
|
||||
@@ -0,0 +1,76 @@
|
||||
+#========================================================================================
|
||||
+# FindDebuginfod
|
||||
+# -----------
|
||||
+#
|
||||
+# Find debuginfod library and headers
|
||||
+#
|
||||
+# The module defines the following variables:
|
||||
+#
|
||||
+# This module reads hints about search locations from variables::
|
||||
+#
|
||||
+# LibDebuginfod_ROOT_DIR - Base directory the of libdebuginfod installation
|
||||
+# LibDebuginfod_INCLUDEDIR - Hint directory that contains the libdebuginfod headers files
|
||||
+# LibDebuginfod_LIBRARYDIR - Hint directory that contains the libdebuginfod library files
|
||||
+#
|
||||
+# and saves search results persistently in CMake cache entries::
|
||||
+#
|
||||
+# LibDebuginfod_FOUND - True if headers and requested libraries were found
|
||||
+# LibDebuginfod_INCLUDE_DIRS - libdebuginfod include directories
|
||||
+# LibDebuginfod_LIBRARY_DIRS - Link directories for libdebuginfod libraries
|
||||
+# LibDebuginfod_LIBRARIES - libdebuginfod library files
|
||||
+#
|
||||
+# Utilize package config (e.g. /usr/lib64/pkgconfig/libdebuginfod.pc) to fetch
|
||||
+# version information.
|
||||
+#
|
||||
+#========================================================================================
|
||||
+
|
||||
+find_package(PkgConfig QUIET)
|
||||
+pkg_check_modules(PC_Debuginfod QUIET REQUIRED libdebuginfod>=${ElfUtils_MIN_VERSION})
|
||||
+set(LibDebuginfod_VERSION "${PC_Debuginfod_VERSION}")
|
||||
+
|
||||
+find_path(LibDebuginfod_INCLUDE_DIRS
|
||||
+ NAMES
|
||||
+ debuginfod.h
|
||||
+ HINTS
|
||||
+ ${PC_Debuginfod_INCLUDEDIR}
|
||||
+ ${PC_Debuginfod_INCLUDE_DIRS}
|
||||
+ ${LibDebuginfod_ROOT_DIR}/include
|
||||
+ ${LibDebuginfod_ROOT_DIR}
|
||||
+ ${LibDebuginfod_INCLUDEDIR}
|
||||
+ PATHS
|
||||
+ ${DYNINST_SYSTEM_INCLUDE_PATHS}
|
||||
+ PATH_SUFFIXES
|
||||
+ ${_path_suffixes}
|
||||
+ DOC
|
||||
+ "libdebuginfod include directories")
|
||||
+
|
||||
+find_library(LibDebuginfod_LIBRARIES
|
||||
+ NAMES
|
||||
+ libdebuginfod.so.1 libdebuginfod.so
|
||||
+ HINTS
|
||||
+ ${PC_Debuginfod_LIBDIR}
|
||||
+ ${PC_Debuginfod_LIBRARY_DIRS}
|
||||
+ ${LibDebuginfod_ROOT_DIR}/lib
|
||||
+ ${LibDebuginfod_ROOT_DIR}
|
||||
+ ${LibDebuginfod_LIBRARYDIR}
|
||||
+ PATHS
|
||||
+ ${DYNINST_SYSTEM_LIBRARY_PATHS}
|
||||
+ PATH_SUFFIXES
|
||||
+ ${_path_suffixes})
|
||||
+
|
||||
+include(FindPackageHandleStandardArgs)
|
||||
+find_package_handle_standard_args(LibDebuginfod
|
||||
+ FOUND_VAR
|
||||
+ LibDebuginfod_FOUND
|
||||
+ REQUIRED_VARS
|
||||
+ LibDebuginfod_INCLUDE_DIRS
|
||||
+ LibDebuginfod_LIBRARIES
|
||||
+ VERSION_VAR
|
||||
+ LibDebuginfod_VERSION)
|
||||
+
|
||||
+if(LibDebuginfod_FOUND)
|
||||
+ set(LibDebuginfod_INCLUDE_DIRS ${LibDebuginfod_INCLUDE_DIRS})
|
||||
+ set(LibDebuginfod_LIBRARIES ${LibDebuginfod_LIBRARIES})
|
||||
+ get_filename_component(_debuginfod_dir ${LibDebuginfod_LIBRARIES} DIRECTORY)
|
||||
+ set(LibDebuginfod_LIBRARY_DIRS ${_debuginfod_dir} "${_debuginfod_dir}/elfutils")
|
||||
+endif()
|
||||
|
||||
--- dyninst-10.2.1/dyninst-10.2.1/cmake/options.cmake
|
||||
+++ dyninst-10.2.1/dyninst-10.2.1/cmake/options.cmake
|
||||
@@ -16,6 +16,8 @@ option(USE_COTIRE "Enable Cotire precompiled headers")
|
||||
|
||||
option (ENABLE_LTO "Enable Link-Time Optimization" OFF)
|
||||
|
||||
+option(ENABLE_DEBUGINFOD "Enable debuginfod support" OFF)
|
||||
+
|
||||
# Some global on/off switches
|
||||
if (LIGHTWEIGHT_SYMTAB)
|
||||
add_definitions (-DWITHOUT_SYMTAB_API -DWITH_SYMLITE)
|
||||
|
||||
--- dyninst-10.2.1/dyninst-10.2.1/elf/CMakeLists.txt
|
||||
+++ dyninst-10.2.1/dyninst-10.2.1/elf/CMakeLists.txt
|
||||
@@ -27,5 +27,8 @@ endif()
|
||||
add_dependencies(dynElf ElfUtils)
|
||||
target_link_private_libraries(dynElf ${ElfUtils_LIBRARIES})
|
||||
|
||||
+if (ENABLE_DEBUGINFOD AND LibDebuginfod_FOUND)
|
||||
+ add_definitions(-DDEBUGINFOD_LIB)
|
||||
+endif()
|
||||
|
||||
add_definitions(-DDYNELF_LIB)
|
||||
|
||||
|
||||
--- dyninst-10.2.1/dyninst-10.2.1/elf/src/Elf_X.C
|
||||
+++ dyninst-10.2.1/dyninst-10.2.1/elf/src/Elf_X.C
|
||||
@@ -47,6 +47,9 @@
|
||||
#include <sstream>
|
||||
#include <libelf.h>
|
||||
|
||||
+#if DEBUGINFOD_LIB
|
||||
+#include <elfutils/debuginfod.h>
|
||||
+#endif
|
||||
|
||||
using namespace std;
|
||||
using boost::crc_32_type;
|
||||
@@ -1722,37 +1725,79 @@ bool Elf_X::findDebugFile(std::string origfilename, string &output_name, char* &
|
||||
}
|
||||
}
|
||||
|
||||
- if (debugFileFromDebugLink.empty())
|
||||
- return false;
|
||||
+ if (!debugFileFromDebugLink.empty()) {
|
||||
+ char *mfPathNameCopy = strdup(origfilename.c_str());
|
||||
+ string objectFileDirName = dirname(mfPathNameCopy);
|
||||
|
||||
- char *mfPathNameCopy = strdup(origfilename.c_str());
|
||||
- string objectFileDirName = dirname(mfPathNameCopy);
|
||||
+ vector<string> fnames = list_of
|
||||
+ (objectFileDirName + "/" + debugFileFromDebugLink)
|
||||
+ (objectFileDirName + "/.debug/" + debugFileFromDebugLink)
|
||||
+ ("/usr/lib/debug/" + objectFileDirName + "/" + debugFileFromDebugLink);
|
||||
|
||||
- vector<string> fnames = list_of
|
||||
- (objectFileDirName + "/" + debugFileFromDebugLink)
|
||||
- (objectFileDirName + "/.debug/" + debugFileFromDebugLink)
|
||||
- ("/usr/lib/debug/" + objectFileDirName + "/" + debugFileFromDebugLink);
|
||||
+ free(mfPathNameCopy);
|
||||
|
||||
- free(mfPathNameCopy);
|
||||
+ for(unsigned i = 0; i < fnames.size(); i++) {
|
||||
+ bool result = loadDebugFileFromDisk(fnames[i], output_buffer, output_buffer_size);
|
||||
+ if (!result)
|
||||
+ continue;
|
||||
|
||||
- for(unsigned i = 0; i < fnames.size(); i++) {
|
||||
- bool result = loadDebugFileFromDisk(fnames[i], output_buffer, output_buffer_size);
|
||||
- if (!result)
|
||||
- continue;
|
||||
-
|
||||
- boost::crc_32_type crcComputer;
|
||||
- crcComputer.process_bytes(output_buffer, output_buffer_size);
|
||||
- if(crcComputer.checksum() != debugFileCrc) {
|
||||
- munmap(output_buffer, output_buffer_size);
|
||||
- continue;
|
||||
- }
|
||||
+ boost::crc_32_type crcComputer;
|
||||
+ crcComputer.process_bytes(output_buffer, output_buffer_size);
|
||||
+ if(crcComputer.checksum() != debugFileCrc) {
|
||||
+ munmap(output_buffer, output_buffer_size);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ output_name = fnames[i];
|
||||
+ cached_debug_buffer = output_buffer;
|
||||
+ cached_debug_size = output_buffer_size;
|
||||
+ cached_debug_name = output_name;
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- output_name = fnames[i];
|
||||
- cached_debug_buffer = output_buffer;
|
||||
- cached_debug_size = output_buffer_size;
|
||||
- cached_debug_name = output_name;
|
||||
- return true;
|
||||
+#ifdef DEBUGINFOD_LIB
|
||||
+ if (!debugFileFromBuildID.empty()) {
|
||||
+ // Given /usr/lib/debug/.buildid/XX/YYYYYY.debug, isolate XXYYYYYY.
|
||||
+ size_t idx1 = debugFileFromBuildID.find_last_of("/");
|
||||
+ size_t idx2 = debugFileFromBuildID.find_last_of(".");
|
||||
+
|
||||
+ if (idx1 == string::npos || idx2 == string::npos
|
||||
+ || idx1 < 2 || idx1 > idx2)
|
||||
+ return false;
|
||||
+
|
||||
+ idx1 -= 2;
|
||||
+ string buildid(debugFileFromBuildID.substr(idx1, idx2 - idx1));
|
||||
+ buildid.erase(2, 1);
|
||||
+
|
||||
+ debuginfod_client *client = debuginfod_begin();
|
||||
+ if (client == NULL)
|
||||
+ return false;
|
||||
+
|
||||
+ char *filename;
|
||||
+ int fd = debuginfod_find_debuginfo(client,
|
||||
+ (const unsigned char *)buildid.c_str(),
|
||||
+ 0, &filename);
|
||||
+ debuginfod_end(client);
|
||||
+
|
||||
+ if (fd >= 0) {
|
||||
+ string fname = string(filename);
|
||||
+ free(filename);
|
||||
+ close(fd);
|
||||
+
|
||||
+ bool result = loadDebugFileFromDisk(fname,
|
||||
+ output_buffer,
|
||||
+ output_buffer_size);
|
||||
+ if (result) {
|
||||
+ output_name = fname;
|
||||
+ cached_debug_buffer = output_buffer;
|
||||
+ cached_debug_size = output_buffer_size;
|
||||
+ cached_debug_name = output_name;
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
+#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
diff --git a/testsuite-10.1.0/src/dyninst/test1_3.C b/testsuite-10.1.0/src/dyninst/test1_3.C
|
||||
index d32f630..b9bd0ba 100644
|
||||
--- a/testsuite-10.1.0/src/dyninst/test1_3.C
|
||||
+++ b/testsuite-10.1.0/src/dyninst/test1_3.C
|
||||
@@ -134,7 +134,7 @@ test_results_t test1_3_Mutator::executeTest()
|
||||
}
|
||||
|
||||
// see if we can find the address
|
||||
- if (expr3_1->getBaseAddr() <= 0)
|
||||
+ if (expr3_1->getBaseAddr() == 0)
|
||||
{
|
||||
logerror("*Error*: address %p for %s is not valid\n",
|
||||
expr3_1->getBaseAddr(), globalVar);
|
||||
234
dyninst.spec
234
dyninst.spec
|
|
@ -1,23 +1,19 @@
|
|||
Summary: An API for Run-time Code Generation
|
||||
License: LGPLv2+
|
||||
License: LGPL-2.1-or-later AND GPL-3.0-or-later WITH Bison-exception-2.2 AND LicenseRef-Fedora-Public-Domain AND BSD-3-Clause
|
||||
Name: dyninst
|
||||
Release: 1%{?dist}
|
||||
URL: http://www.dyninst.org
|
||||
Version: 10.2.1
|
||||
ExclusiveArch: %{ix86} x86_64 ppc64le aarch64
|
||||
Group: Development/Libraries
|
||||
Release: 8%{?dist}
|
||||
URL: https://www.paradyn.org
|
||||
Version: 13.0.0
|
||||
ExclusiveArch: x86_64 ppc64le aarch64
|
||||
|
||||
%define __testsuite_version 10.1.0
|
||||
Source0: https://github.com/dyninst/dyninst/archive/v%{version}/dyninst-%{version}.tar.gz
|
||||
Source1: https://github.com/dyninst/testsuite/archive/v10.1.0/testsuite-%{__testsuite_version}.tar.gz
|
||||
|
||||
Patch1: %{name}-gcc11.patch
|
||||
Patch2: %{name}-10.2.1-dbid.patch
|
||||
Patch3: testsuite-10.1.0-gettid.patch
|
||||
Patch4: testsuite-10.1.0-386.patch
|
||||
Patch5: testsuite-10.1.0-throw.patch
|
||||
Source0: dyninst-13.0.0.tar.gz
|
||||
Patch1: github-pr1721.patch
|
||||
Patch2: github-pr1880.patch
|
||||
Patch3: github-pr1880-ish.patch
|
||||
Patch4: github-pr1730.patch
|
||||
|
||||
%global dyninst_base dyninst-%{version}
|
||||
%global testsuite_base testsuite-%{__testsuite_version}
|
||||
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: elfutils-devel
|
||||
|
|
@ -29,16 +25,11 @@ BuildRequires: cmake
|
|||
BuildRequires: libtirpc-devel
|
||||
BuildRequires: tbb tbb-devel
|
||||
BuildRequires: tex-latex
|
||||
BuildRequires: make
|
||||
|
||||
# Extra requires just for the testsuite
|
||||
BuildRequires: gcc-gfortran libxml2-devel
|
||||
|
||||
# Testsuite files should not provide/require anything
|
||||
%{?filter_setup:
|
||||
%filter_provides_in %{_libdir}/dyninst/testsuite/
|
||||
%filter_requires_in %{_libdir}/dyninst/testsuite/
|
||||
%filter_setup
|
||||
}
|
||||
# https://fedoraproject.org/wiki/Changes/Linker_Error_On_Security_Issues
|
||||
# may impact the RT library
|
||||
%undefine _hardened_linker_errors
|
||||
|
||||
%description
|
||||
|
||||
|
|
@ -52,42 +43,40 @@ the creation of tools and applications that use run-time code patching.
|
|||
|
||||
%package doc
|
||||
Summary: Documentation for using the Dyninst API
|
||||
Group: Documentation
|
||||
%description doc
|
||||
dyninst-doc contains API documentation for the Dyninst libraries.
|
||||
License: LGPL-2.1-or-later
|
||||
|
||||
%package devel
|
||||
Summary: Header files for compiling programs with Dyninst
|
||||
Group: Development/System
|
||||
Requires: dyninst = %{version}-%{release}
|
||||
Requires: boost-devel
|
||||
Requires: tbb-devel
|
||||
License: LGPL-2.1-or-later AND BSD-3-Clause AND MIT
|
||||
# FindTBB.cmake: presumed MIT, removed in next version of dyninst
|
||||
|
||||
%description devel
|
||||
dyninst-devel includes the C header files that specify the Dyninst user-space
|
||||
libraries and interfaces. This is required for rebuilding any program
|
||||
that uses Dyninst.
|
||||
|
||||
%package testsuite
|
||||
Summary: Programs for testing Dyninst
|
||||
Requires: dyninst = %{version}-%{release}
|
||||
Requires: dyninst-devel = %{version}-%{release}
|
||||
%description testsuite
|
||||
dyninst-testsuite includes the test harness and target programs for
|
||||
making sure that dyninst works properly.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version} -c
|
||||
%setup -q -T -D -a 1
|
||||
# %setup -q -T -D -a 1
|
||||
|
||||
%patch1 -p1 -b .gcc11
|
||||
%patch2 -p1 -b .dbid
|
||||
%patch3 -p1 -b .gettid
|
||||
%patch4 -p1 -b .386
|
||||
%patch5 -p1 -b .throw
|
||||
pushd %{dyninst_base}
|
||||
%patch -P1 -p1
|
||||
%patch -P2 -p1
|
||||
%patch -P3 -p1
|
||||
%patch -P4 -p1
|
||||
popd
|
||||
|
||||
# cotire seems to cause non-deterministic gcc errors
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1420551
|
||||
sed -i.cotire -e 's/USE_COTIRE true/USE_COTIRE false/' \
|
||||
%{dyninst_base}/cmake/shared.cmake
|
||||
# sed -i.cotire -e 's/USE_COTIRE true/USE_COTIRE false/' \
|
||||
# %{dyninst_base}/cmake/shared.cmake
|
||||
|
||||
%build
|
||||
|
||||
|
|
@ -102,52 +91,31 @@ LDFLAGS="$LDFLAGS $RPM_LD_FLAGS"
|
|||
CXXFLAGS="$CFLAGS"
|
||||
export CFLAGS CXXFLAGS LDFLAGS
|
||||
|
||||
%cmake \
|
||||
%cmake --log-level=DEBUG \
|
||||
-DENABLE_DEBUGINFOD=1 \
|
||||
-DINSTALL_LIB_DIR:PATH=%{_libdir}/dyninst \
|
||||
-DINSTALL_INCLUDE_DIR:PATH=%{_includedir}/dyninst \
|
||||
-DINSTALL_CMAKE_DIR:PATH=%{_libdir}/cmake/Dyninst \
|
||||
-DCMAKE_BUILD_TYPE=None \
|
||||
-DCMAKE_SKIP_RPATH:BOOL=YES
|
||||
%cmake_build
|
||||
|
||||
# Hack to install dyninst nearby, so the testsuite can use it
|
||||
DESTDIR="../install" %__cmake --install "%{__cmake_builddir}"
|
||||
find ../install -name '*.cmake' -execdir \
|
||||
sed -i -e "s!%{_prefix}!$PWD/../install&!" '{}' '+'
|
||||
# cmake mistakenly looks for libtbb.so in the dyninst install dir
|
||||
sed -i '/libtbb.so/ s/".*usr/"\/usr/' $PWD/../install%{_libdir}/cmake/Dyninst/commonTargets.cmake
|
||||
|
||||
cd ../%{testsuite_base}
|
||||
%cmake \
|
||||
-DDyninst_DIR:PATH=$PWD/../install%{_libdir}/cmake/Dyninst \
|
||||
-DINSTALL_DIR:PATH=%{_libdir}/dyninst/testsuite \
|
||||
-DCMAKE_BUILD_TYPE:STRING=Debug \
|
||||
-DCMAKE_SKIP_RPATH:BOOL=YES \
|
||||
%cmake_build
|
||||
-DINSTALL_CMAKE_DIR:PATH=/usr/lib64/cmake/Dyninst \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
|
||||
-DCMAKE_INSTALL_INCLUDEDIR:PATH=/usr/include/dyninst \
|
||||
-DCMAKE_INSTALL_LIBDIR:PATH=/usr/lib64/dyninst
|
||||
%cmake_build -v -v -v
|
||||
|
||||
%install
|
||||
|
||||
cd %{dyninst_base}
|
||||
%cmake_install
|
||||
%cmake_install -v -v -v
|
||||
|
||||
# It doesn't install docs the way we want, so remove them.
|
||||
# We'll just grab the pdfs later, directly from the build dir.
|
||||
rm -v %{buildroot}%{_docdir}/*-%{version}.pdf
|
||||
# move /usr/lib64//dyninst/cmake/Dyninst to /usr/lib64/cmake/Dyninst
|
||||
mkdir -p %{buildroot}/%{_libdir}/cmake
|
||||
mv %{buildroot}/%{_libdir}/dyninst/cmake/Dyninst %{buildroot}/%{_libdir}/cmake/Dyninst
|
||||
|
||||
cd ../%{testsuite_base}
|
||||
%cmake_install
|
||||
# this is a testsuite-like binary, not needed in main package
|
||||
rm -f "%{buildroot}%{_bindir}/parseThat"
|
||||
|
||||
mkdir -p %{buildroot}/etc/ld.so.conf.d
|
||||
echo "%{_libdir}/dyninst" > %{buildroot}/etc/ld.so.conf.d/%{name}-%{_arch}.conf
|
||||
|
||||
# Ugly hack to mask testsuite files from debuginfo extraction. Running the
|
||||
# testsuite requires debuginfo, so extraction is useless. However, debuginfo
|
||||
# extraction is still nice for the main libraries, so we don't want to disable
|
||||
# it package-wide. The permissions are restored by attr(755,-,-) in files.
|
||||
find %{buildroot}%{_libdir}/dyninst/testsuite/ \
|
||||
-type f '!' -name '*.a' -execdir chmod 644 '{}' '+'
|
||||
|
||||
%post -p /sbin/ldconfig
|
||||
%postun -p /sbin/ldconfig
|
||||
|
||||
|
|
@ -179,14 +147,120 @@ find %{buildroot}%{_libdir}/dyninst/testsuite/ \
|
|||
%{_libdir}/dyninst/*.so
|
||||
%{_libdir}/cmake/Dyninst
|
||||
|
||||
%files testsuite
|
||||
%{_bindir}/parseThat
|
||||
%dir %{_libdir}/dyninst/testsuite/
|
||||
%attr(755,root,root) %{_libdir}/dyninst/testsuite/*[!a]
|
||||
%attr(644,root,root) %{_libdir}/dyninst/testsuite/*.a
|
||||
|
||||
%changelog
|
||||
* Mon Dec 07 2020 Stan Cox <scox@redhat.com> - 10.2.1-1
|
||||
* Mon Jan 12 2026 Jonathan Wakely <jwakely@fedoraproject.org> - 13.0.0-8
|
||||
- Rebuilt for Boost 1.90
|
||||
|
||||
* Wed Aug 20 2025 Jerry James <loganjerry@gmail.com> - 13.0.0-7
|
||||
- Rebuild for tbb 2022.2.0
|
||||
|
||||
* Wed Jul 23 2025 Fedora Release Engineering <releng@fedoraproject.org> - 13.0.0-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
|
||||
|
||||
* Thu Feb 06 2025 Frank Ch. Eigler <fche@redhat.com> - 13.0.0-5
|
||||
- Backported github PR/1370 for constructor ordering.
|
||||
|
||||
* Thu Jan 23 2025 Frank Ch. Eigler <fche@redhat.com> - 13.0.0-4
|
||||
- Rebuilt for F42 FTBFS with 13.0.0 + backported fixes + sans i686
|
||||
|
||||
* Thu Jan 16 2025 Fedora Release Engineering <releng@fedoraproject.org> - 12.3.0-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
|
||||
|
||||
* Wed Jul 17 2024 Fedora Release Engineering <releng@fedoraproject.org> - 12.3.0-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
|
||||
|
||||
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 12.3.0-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 12.3.0-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Wed Jan 17 2024 Jonathan Wakely <jwakely@redhat.com> - 12.3.0-4
|
||||
- Rebuilt for Boost 1.83
|
||||
|
||||
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 12.3.0-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Tue Jul 11 2023 Frank Ch. Eigler <fche@redhat.com> - 12.3.0-2
|
||||
- side-tag respin
|
||||
|
||||
* Tue Jul 04 2023 Frank Ch. Eigler <fche@redhat.com> - 12.3.0-1
|
||||
- migrated to SPDX license
|
||||
|
||||
* Tue Jul 04 2023 Orion Poplawski <orion@nwra.com> - 12.3.0-1
|
||||
- Update to 12.3.0
|
||||
- Add patch for cmake 3.27 support
|
||||
|
||||
* Tue Jun 27 2023 Jonathan Wakely <jwakely@fedoraproject.org> - 12.2.0-5
|
||||
- Patch for oneTBB (#2036372)
|
||||
|
||||
* Thu Feb 23 2023 Frank Ch. Eigler <fche@redhat.com> - 12.2.0-4
|
||||
- rhbz2173030: ftbfs with gcc 13
|
||||
|
||||
* Mon Feb 20 2023 Jonathan Wakely <jwakely@redhat.com> - 12.2.0-3
|
||||
- Rebuilt for Boost 1.81
|
||||
|
||||
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 12.2.0-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Tue Oct 4 2022 William Cohen <wcohen@redhat.com> - 12.2.0-1
|
||||
- Update to 12.2.0
|
||||
|
||||
* Wed Aug 03 2022 Stan Cox <scox@redhat.com> - 12.1.0-4
|
||||
- Explicitly include time.h as <string> no longer pulls it in
|
||||
|
||||
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 12.1.0-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
* Wed May 04 2022 Thomas Rodgers <trodgers@redhat.com> - 12.1.0-2
|
||||
- Rebuilt for Boost 1.78
|
||||
|
||||
* Thu Mar 10 2022 William Cohen <wcohen@redhat.com> - 12.1.0-1
|
||||
- Update to 12.1.0
|
||||
|
||||
* Sat Mar 05 2022 Orion Poplawski <orion@nwra.com> - 12.0.1-4
|
||||
- Fix cmake build dir
|
||||
|
||||
* Mon Feb 07 2022 Stan Cox <scox@redhat.com> - 12.0.1-3
|
||||
- Quiesce dwarf 5 warnings
|
||||
|
||||
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 12.0.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Mon Jan 10 2022 Stan Cox <scox@redhat.com> - 12.0.1-1
|
||||
- Update to 12.0.1
|
||||
|
||||
* Tue Nov 09 2021 Stan Cox <scox@redhat.com> - 11.0.1-4
|
||||
- Do not create reloc for aarch64 static calls
|
||||
|
||||
* Fri Aug 06 2021 Jonathan Wakely <jwakely@redhat.com> - 11.0.1-3
|
||||
- Rebuilt for Boost 1.76
|
||||
|
||||
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 11.0.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Thu Jul 08 2021 Stan Cox <scox@redhat.com> - 11.0.1
|
||||
- Update to 11.0.1
|
||||
|
||||
* Fri Apr 30 2021 Stan Cox <scox@redhat.com> - 11.0.0
|
||||
- Update to 11.0.0
|
||||
|
||||
* Tue Mar 30 2021 Jonathan Wakely <jwakely@redhat.com> - 10.2.1-6
|
||||
- Rebuilt for removed libstdc++ symbol (#1937698)
|
||||
|
||||
* Fri Jan 29 2021 Frank Ch. Eigler <fche@redhat.com> - 10.2.1-5
|
||||
- Rebuilt for Boost 1.75 for sure, via buildrequire version constraints
|
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 10.2.1-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Fri Jan 22 2021 Jonathan Wakely <jwakely@redhat.com> - 10.2.1-3
|
||||
- Rebuilt for Boost 1.75
|
||||
|
||||
* Tue Nov 10 2020 Stan Cox <scox@redhat.com> - 10.2.1-2
|
||||
- Enable debuginfod
|
||||
|
||||
* Wed Oct 28 2020 Stan Cox <scox@redhat.com> - 10.2.1-1
|
||||
- Update to 10.2.1
|
||||
|
||||
* Tue Oct 27 2020 Jeff Law <law@redhat.com> - 10.2.0-2
|
||||
|
|
|
|||
19
gating.yaml
Normal file
19
gating.yaml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
--- !Policy
|
||||
product_versions:
|
||||
- fedora-*
|
||||
decision_context: bodhi_update_push_stable
|
||||
subject_type: koji_build
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-8
|
||||
decision_context: osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-9
|
||||
decision_context: osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}
|
||||
55
github-pr1721.patch
Normal file
55
github-pr1721.patch
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
commit e70b1001eb5082bb0204b602e3ca1cfccd67fc94
|
||||
gpg: Signature made Tue 09 Apr 2024 11:21:17 AM EDT
|
||||
gpg: using RSA key B5690EEEBB952194
|
||||
gpg: Can't check signature: No public key
|
||||
Author: kupsch <kupsch@cs.wisc.edu>
|
||||
Date: Tue Apr 9 10:21:17 2024 -0500
|
||||
|
||||
improve cmake install dirs (#1721)
|
||||
|
||||
* Use cmake's GNUInstallDirs to get the lib, bin and include directory
|
||||
names instead of always using 'lib', 'bin', and 'include'. This
|
||||
results in two changes to the installation:
|
||||
|
||||
- lib directory becomes 'lib64' on platforms where this is the
|
||||
convention
|
||||
|
||||
- the lib, bin and include may be overwritten using the cmake
|
||||
variables CMAKE_INSTALL_BINDIR, CMAKE_INSTALL_LIBDIR and
|
||||
CMAKE_INSTALL_INCLUDEDIR respectively
|
||||
|
||||
* Update github workflows to handle the lib install dir lib64:
|
||||
|
||||
- use Dyninst_ROOT instead of Dyninst_DIR as it searches for the
|
||||
directory used
|
||||
|
||||
- for non-cmake uses search for lib* to find either lib or lib64
|
||||
|
||||
diff --git a/cmake/DyninstLibrarySettings.cmake b/cmake/DyninstLibrarySettings.cmake
|
||||
index d3627f8789f2..e8cb26b95c39 100644
|
||||
--- a/cmake/DyninstLibrarySettings.cmake
|
||||
+++ b/cmake/DyninstLibrarySettings.cmake
|
||||
@@ -25,9 +25,10 @@ else()
|
||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
|
||||
endif()
|
||||
|
||||
-set(DYNINST_INSTALL_BINDIR "bin")
|
||||
-set(DYNINST_INSTALL_LIBDIR "lib")
|
||||
-set(DYNINST_INSTALL_INCLUDEDIR "include")
|
||||
+include(GNUInstallDirs)
|
||||
+set(DYNINST_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}")
|
||||
+set(DYNINST_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}")
|
||||
+set(DYNINST_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
set(DYNINST_INSTALL_CMAKEDIR "${DYNINST_INSTALL_LIBDIR}/cmake/Dyninst")
|
||||
|
||||
# -- Set up the RPATH ---
|
||||
diff --git a/parseThat/CMakeLists.txt b/parseThat/CMakeLists.txt
|
||||
index ffe4b7aea29c..d4697a8a1d99 100644
|
||||
--- a/parseThat/CMakeLists.txt
|
||||
+++ b/parseThat/CMakeLists.txt
|
||||
@@ -29,4 +29,4 @@ target_link_libraries(parseThat PRIVATE dyninstAPI)
|
||||
target_include_directories(parseThat BEFORE
|
||||
PRIVATE "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/common/h>")
|
||||
|
||||
-install(TARGETS parseThat RUNTIME DESTINATION bin)
|
||||
+install(TARGETS parseThat RUNTIME DESTINATION "${DYNINST_INSTALL_BINDIR}")
|
||||
151
github-pr1730.patch
Normal file
151
github-pr1730.patch
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
commit eae798d4e5f938cb85758571dbab9afbbea7b5d2 (HEAD -> v13.0.0)
|
||||
Author: Frank Ch. Eigler <fche@redhat.com>
|
||||
Date: Thu Feb 6 08:35:33 2025 -0500
|
||||
|
||||
MachRegister: fix initialization order bug (#1731)
|
||||
|
||||
Backported upstream commit to 13.0.0 base.
|
||||
|
||||
commit a29f32ac87c4483b97a2c5cb9beed5642124ae8f
|
||||
Author: Tim Haines <thaines.astro@gmail.com>
|
||||
Date: Mon Apr 22 15:32:12 2024 -0500
|
||||
|
||||
MachRegister: fix initialization order bug (#1731)
|
||||
|
||||
This fixes the static initialization ordering issue reported in https://github.com/dyninst/dyninst/issues/1730.
|
||||
|
||||
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
|
||||
index 669659e44c76..b6507772858c 100644
|
||||
--- a/common/CMakeLists.txt
|
||||
+++ b/common/CMakeLists.txt
|
||||
@@ -39,7 +39,6 @@ set(_public_headers
|
||||
h/registers/AMDGPU/amdgpu_gfx90a_regs.h
|
||||
h/registers/AMDGPU/amdgpu_gfx940_regs.h
|
||||
h/registers/cuda_regs.h
|
||||
- h/registers/MachRegister.h
|
||||
h/registers/ppc32_regs.h
|
||||
h/registers/ppc64_regs.h
|
||||
h/registers/reg_def.h
|
||||
@@ -72,12 +71,12 @@ set(_private_headers
|
||||
src/lprintf.h
|
||||
src/lru_cache.h
|
||||
src/MappedFile.h
|
||||
+ src/registers/MachRegisterCache.h
|
||||
src/NodeIterator.h
|
||||
src/ntHeaders.h
|
||||
src/parseauxv.h
|
||||
src/pathName.h
|
||||
src/pool_allocators.h
|
||||
- src/registers/MachRegister.C
|
||||
src/sha1.h
|
||||
src/singleton_object_pool.h
|
||||
src/stats.h
|
||||
@@ -111,6 +110,7 @@ set(_sources
|
||||
src/debug_common.C
|
||||
src/VariableLocation.C
|
||||
src/Buffer.C
|
||||
+ src/registers/MachRegister.C
|
||||
src/MachSyscall.C)
|
||||
|
||||
if(DYNINST_OS_UNIX)
|
||||
diff --git a/common/src/dyn_regs.C b/common/src/dyn_regs.C
|
||||
index 3fcd194a71dd..7951dbe753bc 100644
|
||||
--- a/common/src/dyn_regs.C
|
||||
+++ b/common/src/dyn_regs.C
|
||||
@@ -28,8 +28,16 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
+#include "registers/MachRegisterCache.h"
|
||||
+
|
||||
+namespace Dyninst { namespace registers {
|
||||
+ // These are used in MachRegister.C
|
||||
+ name_cache names;
|
||||
+}}
|
||||
+
|
||||
//clang-format: off
|
||||
#define DYN_DEFINE_REGS
|
||||
#include "dyn_regs.h"
|
||||
#undef DYN_DEFINE_REGS
|
||||
//clang-format: on
|
||||
+
|
||||
diff --git a/common/src/registers/MachRegister.C b/common/src/registers/MachRegister.C
|
||||
index ccd01abc1811..93c020c04415 100644
|
||||
--- a/common/src/registers/MachRegister.C
|
||||
+++ b/common/src/registers/MachRegister.C
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "common/h/registers/MachRegister.h"
|
||||
+#include "registers/MachRegisterCache.h"
|
||||
#include "debug_common.h"
|
||||
#include "dyn_regs.h"
|
||||
#include "external/rose/amdgpuInstructionEnum.h"
|
||||
@@ -10,17 +11,24 @@
|
||||
#include <unordered_map>
|
||||
|
||||
namespace {
|
||||
- std::unordered_map<signed int, std::string> names;
|
||||
const std::string invalid_reg_name{"<INVALID_REG>"};
|
||||
}
|
||||
|
||||
+namespace Dyninst { namespace registers {
|
||||
+ // These are defined in dyn_regs.C to ensure global constructor initialization ordering
|
||||
+ extern name_cache names;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
namespace Dyninst {
|
||||
|
||||
MachRegister::MachRegister() : reg(0) {}
|
||||
|
||||
MachRegister::MachRegister(signed int r) : reg(r) {}
|
||||
|
||||
- MachRegister::MachRegister(signed int r, std::string n) : reg(r) { names.emplace(r, std::move(n)); }
|
||||
+ MachRegister::MachRegister(signed int r, std::string n) : reg(r) {
|
||||
+ registers::names.emplace(r, std::move(n)); }
|
||||
|
||||
unsigned int MachRegister::regClass() const { return reg & 0x00ff0000; }
|
||||
|
||||
@@ -106,8 +114,8 @@ namespace Dyninst {
|
||||
bool MachRegister::isValid() const { return (reg != InvalidReg.reg); }
|
||||
|
||||
std::string const& MachRegister::name() const {
|
||||
- auto iter = names.find(reg);
|
||||
- if(iter != names.end()) {
|
||||
+ auto iter = registers::names.find(reg);
|
||||
+ if(iter != registers::names.end()) {
|
||||
return iter->second;
|
||||
}
|
||||
common_parsing_printf("No MachRegister found with value %x\n", static_cast<unsigned int>(reg));
|
||||
diff --git a/common/src/dyn_regs.C b/common/src/registers/MachRegisterCache.h
|
||||
similarity index 80%
|
||||
copy from common/src/dyn_regs.C
|
||||
copy to common/src/registers/MachRegisterCache.h
|
||||
index 3fcd194a71dd..2a74bbde821a 100644
|
||||
--- a/common/src/dyn_regs.C
|
||||
+++ b/common/src/registers/MachRegisterCache.h
|
||||
@@ -28,8 +28,19 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
-//clang-format: off
|
||||
-#define DYN_DEFINE_REGS
|
||||
-#include "dyn_regs.h"
|
||||
-#undef DYN_DEFINE_REGS
|
||||
-//clang-format: on
|
||||
+#ifndef DYNINST_COMMON_REGISTERS_MACHREGISTERCACHE_H
|
||||
+#define DYNINST_COMMON_REGISTERS_MACHREGISTERCACHE_H
|
||||
+
|
||||
+#include "registers/MachRegister.h"
|
||||
+
|
||||
+#include <unordered_map>
|
||||
+#include <map>
|
||||
+#include <vector>
|
||||
+#include <string>
|
||||
+
|
||||
+namespace Dyninst { namespace registers {
|
||||
+ typedef std::unordered_map<signed int, std::string> name_cache;
|
||||
+}}
|
||||
+
|
||||
+
|
||||
+#endif
|
||||
36
github-pr1880-ish.patch
Normal file
36
github-pr1880-ish.patch
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
diff --git a/common/h/Annotatable.h b/common/h/Annotatable.h
|
||||
index 6588e3dd36da..262a193ffbb8 100644
|
||||
--- a/common/h/Annotatable.h
|
||||
+++ b/common/h/Annotatable.h
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
+#include <cstdint>
|
||||
#include "util.h"
|
||||
#include "compiler_annotations.h"
|
||||
|
||||
diff --git a/instructionAPI/h/ArchSpecificFormatters.h b/instructionAPI/h/ArchSpecificFormatters.h
|
||||
index b32d4cc14e03..145c604f9619 100644
|
||||
--- a/instructionAPI/h/ArchSpecificFormatters.h
|
||||
+++ b/instructionAPI/h/ArchSpecificFormatters.h
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
+#include <cstdint>
|
||||
#include "Architecture.h"
|
||||
#include "registers/MachRegister.h"
|
||||
|
||||
diff --git a/common/src/arch-x86.h b/common/src/arch-x86.h
|
||||
index ecdc3dc13..7745306d3 100644
|
||||
--- a/common/src/arch-x86.h
|
||||
+++ b/common/src/arch-x86.h
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
+#include <cstdint>
|
||||
#include "entryIDs.h"
|
||||
#include "registers/MachRegister.h"
|
||||
#include "common/src/ia32_locations.h"
|
||||
23
github-pr1880.patch
Normal file
23
github-pr1880.patch
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
commit 165402aa1640afb394b11a096b38c6bc3a5bf9d0 (github-fche/patch-1)
|
||||
gpg: Signature made Wed 22 Jan 2025 03:35:55 PM EST
|
||||
gpg: using RSA key B5690EEEBB952194
|
||||
gpg: Can't check signature: No public key
|
||||
Author: Frank Ch. Eigler <fche@elastic.org>
|
||||
Date: Wed Jan 22 15:35:55 2025 -0500
|
||||
|
||||
Update sha1.C: #include <cstdint>
|
||||
|
||||
Subject header is needed on gcc15 to compile sha1.C, supplying declaration of types like uint32_t.
|
||||
|
||||
diff --git a/common/src/sha1.C b/common/src/sha1.C
|
||||
index 91e9ad291561..d6e76c5727ac 100644
|
||||
--- a/common/src/sha1.C
|
||||
+++ b/common/src/sha1.C
|
||||
@@ -102,6 +102,7 @@ A million repetitions of "a"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
+#include <cstdint>
|
||||
|
||||
#include "dyntypes.h"
|
||||
#include "common/src/sha1.h"
|
||||
5
plans/ci.fmf
Normal file
5
plans/ci.fmf
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
summary: CI Gating Plan
|
||||
discover:
|
||||
how: fmf
|
||||
execute:
|
||||
how: tmt
|
||||
3
sources
3
sources
|
|
@ -1,2 +1 @@
|
|||
SHA512 (dyninst-10.2.1.tar.gz) = 5666ffd888afdb9493bd495aa6027ca5b9f71fe811a6d88777d55b612c92f73dc6c008c1738be111175a31fb0a2ec804d8ffc3e79888d8366ae5b5b624537055
|
||||
SHA512 (testsuite-10.1.0.tar.gz) = 47b91ebc0623f672378086a5f8d84e3934bd6b22d8932b12aaad257ccf7eb109505edb63dfbc3eb15aa099fc488a517835412099a77e3e0dd1275b3e3f672b3b
|
||||
SHA512 (dyninst-13.0.0.tar.gz) = efa09018c411f6138e6e2cf6510007b29b00ed9e0d643df702303ee0ccb39b1ea1640bba18555f4cb0a7dbab677362c88ffe0eccace62b57860daee9350a4eee
|
||||
|
|
|
|||
19
tests/Sanity/smoke-test/dynamic-double/Makefile
Normal file
19
tests/Sanity/smoke-test/dynamic-double/Makefile
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
CPP=g++
|
||||
#DYNINST_ROOT=/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst
|
||||
LINK=-L/opt/rh/devtoolset-3/root/usr/lib$(BITS)/dyninst -L/opt/rh/devtoolset-3/root/usr/lib$(BITS)/dyninst/lib
|
||||
# -ldyninstAPI -ldynC -ldl
|
||||
#LINK=-L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst -L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst/lib -ldyninstAPI -ldl
|
||||
|
||||
INCLUDE=-I/opt/rh/devtoolset-3/root/usr/include/dyninst
|
||||
LINK2=-ldyninstAPI -ldl -lboost_system
|
||||
|
||||
all: mutatee mutator
|
||||
|
||||
clean:
|
||||
rm mutatee mutator
|
||||
|
||||
mutatee: mutatee.cpp
|
||||
$(CPP) -g -o mutatee mutatee.cpp
|
||||
|
||||
mutator: mutator.cpp
|
||||
$(CPP) -g -o mutator $(INCLUDE) $(LINK) $(LINK2) mutator.cpp
|
||||
49
tests/Sanity/smoke-test/dynamic-double/mutatee.cpp
Normal file
49
tests/Sanity/smoke-test/dynamic-double/mutatee.cpp
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#include <cstdio>
|
||||
#include <unistd.h>
|
||||
#include <cstdlib>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int a = 0;
|
||||
|
||||
void incr(void)
|
||||
{
|
||||
a++;
|
||||
}
|
||||
|
||||
void incr2(void)
|
||||
{
|
||||
a += 100;
|
||||
}
|
||||
|
||||
int function_name(void)
|
||||
{
|
||||
fprintf(stderr, "FUNCTION EXECUTED. VALUE = %i\n", a);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int n = 10, i;
|
||||
FILE *f = fopen("RESULT.log", "w");
|
||||
if(argc > 1)
|
||||
{
|
||||
if((n = atoi(argv[1])) <= 0)
|
||||
n = 10;
|
||||
}
|
||||
else
|
||||
n = 10;
|
||||
|
||||
for(i = 0; i < n; i++)
|
||||
{
|
||||
function_name();
|
||||
sleep(3);
|
||||
}
|
||||
|
||||
if((a > 200) && (a % 100 > 0))
|
||||
fprintf(f, "MUTATION OK.\n");
|
||||
else
|
||||
fprintf(f, "MUTATION FAILED.\n");
|
||||
|
||||
fclose(f);
|
||||
return !a;
|
||||
}
|
||||
115
tests/Sanity/smoke-test/dynamic-double/mutator.cpp
Normal file
115
tests/Sanity/smoke-test/dynamic-double/mutator.cpp
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
// dyninst libraries
|
||||
|
||||
#include "BPatch.h"
|
||||
#include "BPatch_addressSpace.h"
|
||||
#include "BPatch_process.h"
|
||||
#include "BPatch_function.h"
|
||||
#include "BPatch_point.h"
|
||||
//#include "BPatch_flowGraph.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
BPatch bpatch1, bpatch2;
|
||||
int pid;
|
||||
BPatch_process *app_proc;
|
||||
BPatch_addressSpace *aspace;
|
||||
BPatch_image *image;
|
||||
|
||||
// check the options
|
||||
if(argc != 2)
|
||||
{
|
||||
cerr << "ERROR ## Missing command line args. Use PID of the process you want to attach.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
pid = atoi(argv[1]);
|
||||
if(pid == 0)
|
||||
{
|
||||
cerr << "ERROR ## Wrong PID " << pid << ", please use another.\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
cerr << "TAKE1 A\n";
|
||||
// let's go...
|
||||
app_proc = bpatch1.processAttach(NULL, pid);
|
||||
cerr << "TAKE1 B\n";
|
||||
aspace = app_proc;
|
||||
cerr << "TAKE1 C\n";
|
||||
image = aspace->getImage();
|
||||
cerr << "TAKE1 D\n";
|
||||
|
||||
/* BPatch_Set<BPatch_opCode> access_types;
|
||||
access_types.insert(BPatch_opLoad);
|
||||
access_types.insert(BPatch_opStore);
|
||||
*/
|
||||
vector<BPatch_function *> functions, incr_functions;
|
||||
vector<BPatch_point *> *points;
|
||||
image->findFunction("function_name", functions);
|
||||
cerr << "TAKE1 E\n";
|
||||
points = functions[0]->findPoint(BPatch_entry);
|
||||
cerr << "TAKE1 F\n";
|
||||
|
||||
// create snippet
|
||||
image->findFunction("incr", incr_functions);
|
||||
cerr << "TAKE1 G\n";
|
||||
vector<BPatch_snippet *> incr_args;
|
||||
BPatch_funcCallExpr incr_call(*(incr_functions[0]), incr_args);
|
||||
|
||||
aspace->insertSnippet(incr_call, *points);
|
||||
cerr << "TAKE1 H\n";
|
||||
app_proc->continueExecution();
|
||||
cerr << "TAKE1 I\n";
|
||||
sleep(4);
|
||||
app_proc->detach(true);
|
||||
|
||||
cout << "FIRST MUTATION DONE. MUTATOR IS DOING THE SECOND ONE...\n";
|
||||
|
||||
sleep(4);
|
||||
|
||||
cerr << "TAKE2 A\n";
|
||||
// let's go...
|
||||
app_proc = bpatch2.processAttach(NULL, pid);
|
||||
cerr << "TAKE2 B\n";
|
||||
aspace = app_proc;
|
||||
cerr << "TAKE2 C\n";
|
||||
image = aspace->getImage();
|
||||
cerr << "TAKE2 D\n";
|
||||
|
||||
/* BPatch_Set<BPatch_opCode> access_types;
|
||||
access_types.insert(BPatch_opLoad);
|
||||
access_types.insert(BPatch_opStore);
|
||||
*/
|
||||
vector<BPatch_function *> functions2, incr_functions2;
|
||||
vector<BPatch_point *> *points2;;
|
||||
image->findFunction("function_name", functions2);
|
||||
cerr << "TAKE2 E\n";
|
||||
points2 = functions2[0]->findPoint(BPatch_exit);
|
||||
cerr << "TAKE2 F\n";
|
||||
|
||||
// create snippet
|
||||
image->findFunction("incr2", incr_functions2);
|
||||
cerr << "TAKE2 G\n";
|
||||
vector<BPatch_snippet *> incr_args2;
|
||||
BPatch_funcCallExpr incr_call2(*(incr_functions2[0]), incr_args2);
|
||||
|
||||
aspace->insertSnippet(incr_call2, *points2);
|
||||
cerr << "TAKE2 H\n";
|
||||
app_proc->continueExecution();
|
||||
cerr << "TAKE2 I\n";
|
||||
app_proc->detach(true);
|
||||
|
||||
cout << "SECOND MUTATION DONE. MUTATOR IS GOING...\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
17
tests/Sanity/smoke-test/dynamic/Makefile
Normal file
17
tests/Sanity/smoke-test/dynamic/Makefile
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
CPP=g++
|
||||
#DYNINST_ROOT=/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst
|
||||
##LINK=-L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst -L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst/lib -ldyninstAPI -ldynC -ldl
|
||||
#LINK=-L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst -L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst/lib -ldyninstAPI -ldl
|
||||
#INCLUDE=-I/opt/rh/devtoolset-2/root/usr/include/dyninst
|
||||
LINK2=-ldyninstAPI -ldl -lboost_system
|
||||
|
||||
all: mutatee mutator
|
||||
|
||||
clean:
|
||||
rm mutatee mutator
|
||||
|
||||
mutatee: mutatee.cpp
|
||||
$(CPP) -g -o mutatee mutatee.cpp
|
||||
|
||||
mutator: mutator.cpp
|
||||
$(CPP) -g -o mutator $(INCLUDE) $(LINK) $(LINK2) mutator.cpp
|
||||
6
tests/Sanity/smoke-test/dynamic/load_env.sh
Normal file
6
tests/Sanity/smoke-test/dynamic/load_env.sh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
DYNINSTAPI_RT_LIB=/opt/rh/devtoolset-3/root/usr/lib64/dyninst/libdyninstAPI_RT.so
|
||||
export DYNINSTAPI_RT_LIB
|
||||
if [[ ! $LD_LIBRARY_PATH =~ .*dyninst.* ]]; then
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LD_LIBRARY_PATH/dyninst
|
||||
fi
|
||||
export LD_LIBRARY_PATH
|
||||
44
tests/Sanity/smoke-test/dynamic/mutatee.cpp
Normal file
44
tests/Sanity/smoke-test/dynamic/mutatee.cpp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#include <cstdio>
|
||||
#include <unistd.h>
|
||||
#include <cstdlib>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int a = 0;
|
||||
|
||||
void incr(void)
|
||||
{
|
||||
a++;
|
||||
}
|
||||
|
||||
int function_name(void)
|
||||
{
|
||||
fprintf(stderr, "FUNCTION EXECUTED. VALUE = %i\n", a);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int n = 10, i;
|
||||
FILE *f = fopen("RESULT.log", "w");
|
||||
if(argc > 1)
|
||||
{
|
||||
if((n = atoi(argv[1])) <= 0)
|
||||
n = 10;
|
||||
}
|
||||
else
|
||||
n = 10;
|
||||
|
||||
for(i = 0; i < n; i++)
|
||||
{
|
||||
function_name();
|
||||
sleep(3);
|
||||
}
|
||||
|
||||
if(a)
|
||||
fprintf(f, "MUTATION OK.\n");
|
||||
else
|
||||
fprintf(f, "MUTATION FAILED.\n");
|
||||
|
||||
fclose(f);
|
||||
return !a;
|
||||
}
|
||||
73
tests/Sanity/smoke-test/dynamic/mutator.cpp
Normal file
73
tests/Sanity/smoke-test/dynamic/mutator.cpp
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
// dyninst libraries
|
||||
|
||||
#include "BPatch.h"
|
||||
#include "BPatch_addressSpace.h"
|
||||
#include "BPatch_process.h"
|
||||
#include "BPatch_function.h"
|
||||
#include "BPatch_point.h"
|
||||
//#include "BPatch_flowGraph.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
BPatch bpatch;
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int pid;
|
||||
BPatch_process *app_proc;
|
||||
BPatch_addressSpace *aspace;
|
||||
BPatch_image *image;
|
||||
|
||||
// check the options
|
||||
if(argc != 2)
|
||||
{
|
||||
cerr << "ERROR ## Missing command line args. Use PID of the process you want to attach.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
pid = atoi(argv[1]);
|
||||
if(pid == 0)
|
||||
{
|
||||
cerr << "ERROR ## Wrong PID " << pid << ", please use another.\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
// let's go...
|
||||
app_proc = bpatch.processAttach(NULL, pid);
|
||||
aspace = app_proc;
|
||||
image = aspace->getImage();
|
||||
|
||||
/* BPatch_Set<BPatch_opCode> access_types;
|
||||
access_types.insert(BPatch_opLoad);
|
||||
access_types.insert(BPatch_opStore);
|
||||
*/
|
||||
vector<BPatch_function *> functions, incr_functions;
|
||||
vector<BPatch_point *> *points;
|
||||
image->findFunction("function_name", functions);
|
||||
points = functions[0]->findPoint(BPatch_entry);
|
||||
|
||||
// create snippet
|
||||
image->findFunction("incr", incr_functions);
|
||||
vector<BPatch_snippet *> incr_args;
|
||||
BPatch_funcCallExpr incr_call(*(incr_functions[0]), incr_args);
|
||||
|
||||
aspace->insertSnippet(incr_call, *points);
|
||||
app_proc->continueExecution();
|
||||
#ifdef __PPC__
|
||||
// PPC detach removes snippets, so wait
|
||||
bpatch.waitForStatusChange();
|
||||
#endif
|
||||
app_proc->detach(true);
|
||||
|
||||
cout << "MUTATION DONE. MUTATOR IS GOING...\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
16
tests/Sanity/smoke-test/main.fmf
Normal file
16
tests/Sanity/smoke-test/main.fmf
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
summary: The test does basic instrumentation on binaries.
|
||||
description: ''
|
||||
contact:
|
||||
- Michael Petlan <mpetlan@redhat.com>
|
||||
component:
|
||||
- dyninst
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- dyninst
|
||||
- dyninst-devel
|
||||
- gcc
|
||||
- gcc-c++
|
||||
duration: 12m
|
||||
extra-summary: /tools/dyninst/Sanity/smoke-test
|
||||
extra-task: /tools/dyninst/Sanity/smoke-test
|
||||
207
tests/Sanity/smoke-test/runtest.sh
Executable file
207
tests/Sanity/smoke-test/runtest.sh
Executable file
|
|
@ -0,0 +1,207 @@
|
|||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /tools/dyninst/Sanity/smoke-test
|
||||
# Description: The test does basic instrumentation on binaries.
|
||||
# Author: Michael Petlan <mpetlan@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2013 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGE="dyninst"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlRun "TMPD=$(mktemp -d)"
|
||||
rlRun "cp -r dynamic dynamic-double static $TMPD/"
|
||||
rlRun "pushd $TMPD"
|
||||
# load the proper environment - set the variables
|
||||
# When using dyninst, we have to have LD_LIBRARY_PATH set to dyninst's directory
|
||||
# and DYNINSTAPI_RT_LIB should keep the path of libdyninstAPI_RT.so.8.0 shared library.
|
||||
# After having this set properly, an application what uses dyninst, can be compiled and run.
|
||||
|
||||
test -e "/usr/lib64" && BITS="64" || BITS=""
|
||||
ARCH=`rlGetPrimaryArch`
|
||||
|
||||
rlAssertRpm $PACKAGE
|
||||
DYNINST_ROOT="/usr/lib$BITS/dyninst"
|
||||
INCLUDE="-I/usr/include/dyninst"
|
||||
LINK="-L/usr/lib$BITS/dyninst -L/usr/lib$BITS/dyninst/lib"
|
||||
echo $LD_LIBRARY_PATH | grep "$DYNINST_ROOT"
|
||||
if [ $? -ne 0 ]; then
|
||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DYNINST_ROOT"
|
||||
fi
|
||||
|
||||
# the API runtime library path should be available from rpmquery
|
||||
if [ `rpmquery -l $PACKAGE.$ARCH | grep API_RT | wc -l` -eq 1 ]; then
|
||||
# if there's only one file, we may accept that
|
||||
DYNINSTAPI_RT_LIB=`rpmquery -l $PACKAGE.$ARCH | grep API_RT`
|
||||
else
|
||||
# sometimes there're many links to the API_RT lib, so we have to choose the proper file
|
||||
for rtlib in `rpmquery -l $PACKAGE.$ARCH | grep API_RT`; do
|
||||
test -L $rtlib || DYNINSTAPI_RT_LIB="$rtlib"
|
||||
done
|
||||
fi
|
||||
export DYNINSTAPI_RT_LIB
|
||||
if [[ ! $LD_LIBRARY_PATH =~ .*dyninst.* ]]; then
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LD_LIBRARY_PATH/dyninst
|
||||
fi
|
||||
export LD_LIBRARY_PATH
|
||||
|
||||
# compile both static and dynamic test
|
||||
for TC in static dynamic dynamic-double; do
|
||||
cd $TC
|
||||
rlRun "make BITS=\"$BITS\" DYNINST_ROOT=\"$DYNINST_ROOT\" INCLUDE=\"$INCLUDE\" LINK=\"$LINK\"" 0 "Compiling $TC dyninst example."
|
||||
cd ..
|
||||
done
|
||||
|
||||
# IMPORTANT: We have to make sure, that some SELinux bools are set right (see dyninst docs)
|
||||
#
|
||||
# We need:
|
||||
# allow_execmod --> on
|
||||
# allow_execstack --> on
|
||||
# deny_ptrace --> off
|
||||
#
|
||||
# Note: The bool deny_ptrace is not present in RHEL yet.
|
||||
#
|
||||
SELINUX_STATUS=`sestatus | grep "SELinux status" | awk '{ print $3; }'`
|
||||
if [[ "$SELINUX_STATUS" == "enabled" ]]; then
|
||||
rlLog "SELINUX IS ENABLED."
|
||||
SEBOOL_ALLOW_EXECMOD=`getsebool allow_execmod`
|
||||
SEBOOL_ALLOW_EXECSTACK=`getsebool allow_execstack`
|
||||
SEBOOL_DENY_PTRACE=`getsebool deny_ptrace`
|
||||
if [[ "$SEBOOL_ALLOW_EXECMOD" =~ "> off" ]]; then
|
||||
rlLog "SELINUX: We need to set allow_execmod to on."
|
||||
setsebool allow_execmod on
|
||||
SEBOOL_ALLOW_EXECMOD="off"
|
||||
else
|
||||
rlLog "SELINUX: $SEBOOL_ALLOW_EXECMOD -- already OK."
|
||||
fi
|
||||
if [[ "$SEBOOL_ALLOW_EXECSTACK" =~ "> off" ]]; then
|
||||
rlLog "SELINUX: We need to set allow_execstack to on."
|
||||
setsebool allow_execstack on
|
||||
SEBOOL_ALLOW_EXECSTACK="off"
|
||||
else
|
||||
rlLog "SELINUX: $SEBOOL_ALLOW_EXECSTACK -- already OK."
|
||||
fi
|
||||
if [[ "$SEBOOL_DENY_PTRACE" =~ "> on" ]]; then
|
||||
rlLog "SELINUX: We need to set deny_ptrace to off."
|
||||
setsebool deny_ptrace off
|
||||
SEBOOL_DENY_PTRACE="on"
|
||||
else
|
||||
if [ -z "$SEBOOL_DENY_PTRACE" ]; then
|
||||
rlLog "SELINUX: deny_ptrace does not exist -- OK."
|
||||
else
|
||||
rlLog "SELINUX: $SEBOOL_DENY_PTRACE -- already OK."
|
||||
fi
|
||||
fi
|
||||
else
|
||||
rlLog "SELINUX IS DISABLED. We do not have to change anything."
|
||||
fi
|
||||
|
||||
# Checking for lahf instruction support (bz1134843 workaround)
|
||||
ARCH=`uname -i`
|
||||
if [[ "$ARCH" =~ "86" ]]; then
|
||||
IS_LAHF_SUPPORTED=`cat /proc/cpuinfo | grep lahf`
|
||||
if [ -z "$IS_LAHF_SUPPORTED" ]; then
|
||||
rlLogWarning "The CPU does not support needed LAHF instruction."
|
||||
fi
|
||||
fi
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Testing static instrumentation"
|
||||
cd static
|
||||
rlRun "./mutator"
|
||||
rlAssertExists "mutated"
|
||||
RESULT=`./mutated`
|
||||
if [[ "$RESULT" == "MUTATION OK." ]]; then
|
||||
rlPass "Instrumentation PASSed."
|
||||
else
|
||||
rlFail "Instrumentation FAILed."
|
||||
fi
|
||||
cd ..
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Testing dynamic instrumentation"
|
||||
cd dynamic
|
||||
./mutatee 10 &
|
||||
PID=$!
|
||||
# export DYNINST_DEBUG_STARTUP=1
|
||||
# export DYNINST_DEBUG_RTLIB=1
|
||||
# export DYNINST_DEBUG_CRASH=1
|
||||
# export DYNINST_DEBUG_BPATCH=1
|
||||
./mutator $PID
|
||||
sleep 50
|
||||
RESULT=`cat RESULT.log`
|
||||
if [[ "$RESULT" == "MUTATION OK." ]]; then
|
||||
rlPass "Instrumentation PASSed."
|
||||
else
|
||||
rlFail "Instrumentation FAILed."
|
||||
fi
|
||||
cd ..
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Testing dynamic double instrumentation"
|
||||
# This case needs to have the DYNINSTAPI_RT_LIB variable pointing to a regular file
|
||||
# not to symlink. So it has to be hacked a little
|
||||
export DYNINSTAPI_RT_LIB=`readlink -fn $DYNINSTAPI_RT_LIB`
|
||||
|
||||
cd dynamic-double
|
||||
./mutatee 10 &
|
||||
PID=$!
|
||||
# export DYNINST_DEBUG_STARTUP=1
|
||||
# export DYNINST_DEBUG_RTLIB=1
|
||||
# export DYNINST_DEBUG_CRASH=1
|
||||
# export DYNINST_DEBUG_BPATCH=1
|
||||
./mutator $PID
|
||||
sleep 50
|
||||
RESULT=`cat RESULT.log`
|
||||
if [[ "$RESULT" == "MUTATION OK." ]]; then
|
||||
rlPass "Instrumentation PASSed."
|
||||
else
|
||||
rlFail "Instrumentation FAILed."
|
||||
fi
|
||||
cd ..
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TMPD"
|
||||
|
||||
# restore the SELinux bools, if they were changed
|
||||
if [[ "$SEBOOL_ALLOW_EXECMOD" == "off" ]]; then
|
||||
rlLog "Restoring SELinux bool allow_execmod to $SEBOOL_ALLOW_EXECMOD."
|
||||
setsebool allow_execmod $SEBOOL_ALLOW_EXECMOD
|
||||
fi
|
||||
if [[ "$SEBOOL_ALLOW_EXECSTACK" == "off" ]]; then
|
||||
rlLog "Restoring SELinux bool allow_execstack to $SEBOOL_ALLOW_EXECSTACK."
|
||||
setsebool allow_execstack $SEBOOL_ALLOW_EXECSTACK
|
||||
fi
|
||||
if [[ "$SEBOOL_DENY_PTRACE" == "on" ]]; then
|
||||
rlLog "Restoring SELinux bool deny_ptrace to $SEBOOL_DENY_PTRACE."
|
||||
setsebool deny_ptrace $SEBOOL_DENY_PTRACE
|
||||
fi
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
||||
17
tests/Sanity/smoke-test/static/Makefile
Normal file
17
tests/Sanity/smoke-test/static/Makefile
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
CPP=g++
|
||||
#DYNINST_ROOT=/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst
|
||||
##LINK=-L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst -L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst/lib -ldyninstAPI -ldynC -ldl
|
||||
#LINK=-L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst -L/opt/rh/devtoolset-2/root/usr/lib$(BITS)/dyninst/lib -ldyninstAPI -ldl
|
||||
#INCLUDE=-I/opt/rh/devtoolset-2/root/usr/include/dyninst
|
||||
LINK2=-ldyninstAPI -ldl -lboost_system
|
||||
|
||||
all: mutatee mutator
|
||||
|
||||
clean:
|
||||
rm mutatee mutator mutated
|
||||
|
||||
mutatee: mutatee.cpp
|
||||
$(CPP) -g -o mutatee mutatee.cpp
|
||||
|
||||
mutator: mutator.cpp
|
||||
$(CPP) -g -o mutator $(INCLUDE) $(LINK) $(LINK2) mutator.cpp
|
||||
6
tests/Sanity/smoke-test/static/load_env.sh
Normal file
6
tests/Sanity/smoke-test/static/load_env.sh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
DYNINSTAPI_RT_LIB=/opt/rh/devtoolset-3/root/usr/lib64/dyninst/libdyninstAPI_RT.so
|
||||
export DYNINSTAPI_RT_LIB
|
||||
if [[ ! $LD_LIBRARY_PATH =~ .*dyninst.* ]]; then
|
||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LD_LIBRARY_PATH/dyninst
|
||||
fi
|
||||
export LD_LIBRARY_PATH
|
||||
32
tests/Sanity/smoke-test/static/mutatee.cpp
Normal file
32
tests/Sanity/smoke-test/static/mutatee.cpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#include <cstdio>
|
||||
#include <unistd.h>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int a = 0;
|
||||
|
||||
void incr(void)
|
||||
{
|
||||
a++;
|
||||
}
|
||||
|
||||
int function_name(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
sleep(3);
|
||||
|
||||
if(a)
|
||||
printf("MUTATION OK.\n");
|
||||
else
|
||||
printf("MUTATION FAILED.\n");
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
function_name();
|
||||
}
|
||||
69
tests/Sanity/smoke-test/static/mutator.cpp
Normal file
69
tests/Sanity/smoke-test/static/mutator.cpp
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
// dyninst libraries
|
||||
|
||||
#include "BPatch.h"
|
||||
#include "BPatch_addressSpace.h"
|
||||
#include "BPatch_process.h"
|
||||
#include "BPatch_function.h"
|
||||
#include "BPatch_point.h"
|
||||
//#include "BPatch_flowGraph.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
BPatch bpatch;
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int pid;
|
||||
BPatch_binaryEdit *app_bin;
|
||||
BPatch_addressSpace *aspace;
|
||||
BPatch_image *image;
|
||||
|
||||
/* // check the options
|
||||
if(argc != 2)
|
||||
{
|
||||
cerr << "ERROR ## Missing command line args. Use PID of the process you want to attach.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
pid = atoi(argv[1]);
|
||||
if(pid == 0)
|
||||
{
|
||||
cerr << "ERROR ## Wrong PID " << pid << ", please use another.\n";
|
||||
return 2;
|
||||
}
|
||||
*/
|
||||
// let's go...
|
||||
app_bin = bpatch.openBinary("mutatee");
|
||||
aspace = app_bin;
|
||||
image = aspace->getImage();
|
||||
|
||||
/* BPatch_Set<BPatch_opCode> access_types;
|
||||
access_types.insert(BPatch_opLoad);
|
||||
access_types.insert(BPatch_opStore);
|
||||
*/
|
||||
vector<BPatch_function *> functions, incr_functions;
|
||||
vector<BPatch_point *> *points;
|
||||
image->findFunction("function_name", functions);
|
||||
points = functions[0]->findPoint(BPatch_entry);
|
||||
|
||||
// create snippet
|
||||
image->findFunction("incr", incr_functions);
|
||||
vector<BPatch_snippet *> incr_args;
|
||||
BPatch_funcCallExpr incr_call(*(incr_functions[0]), incr_args);
|
||||
|
||||
aspace->insertSnippet(incr_call, *points);
|
||||
app_bin->writeFile("mutated");
|
||||
|
||||
|
||||
cout << "MUTATION DONE. MUTATOR IS GOING...\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
19
tests/Sanity/testsuite/main.fmf
Normal file
19
tests/Sanity/testsuite/main.fmf
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
summary: Dyninst upstream testsuite wrapper
|
||||
description: ''
|
||||
contact: Martin Cermak <mcermak@redhat.com>
|
||||
component:
|
||||
- dyninst
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- dyninst
|
||||
- dyninst-devel
|
||||
- dyninst-testsuite
|
||||
- boost
|
||||
- boost-devel
|
||||
- elfutils-libelf-devel
|
||||
- libdwarf-devel
|
||||
- gcc-c++
|
||||
duration: 360m
|
||||
extra-summary: /tools/dyninst/Sanity/testsuite
|
||||
extra-task: /tools/dyninst/Sanity/testsuite
|
||||
69
tests/Sanity/testsuite/runtest.sh
Executable file
69
tests/Sanity/testsuite/runtest.sh
Executable file
|
|
@ -0,0 +1,69 @@
|
|||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /tools/dyninst/Sanity/testsuite
|
||||
# Description: Basic functionality covering testsuite
|
||||
# Author: Michael Petlan <mpetlan@redhat.com>
|
||||
# Martin Cermak <mcermak@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2013 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
# PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public
|
||||
# License along with this program; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGE=${PACKAGE:-dyninst}
|
||||
TESTDIR=${TESTDIR:-/usr/lib64/dyninst/testsuite}
|
||||
|
||||
# Tests known to fail
|
||||
SKIPLIST=test_thread_2,pc_thread,pc_tls,test_reloc,test_thread_3,\
|
||||
test_thread_5,test_thread_6,test_thread_8
|
||||
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlRun "rpm -q $PACKAGE $PACKAGE-testsuite"
|
||||
|
||||
DYNINSTAPI_RT_LIB=$(rpm -ql $PACKAGE | fgrep libdyninstAPI_RT.so | sort | tail -1)
|
||||
|
||||
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR"
|
||||
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$(dirname $DYNINSTAPI_RT_LIB)"
|
||||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH#:}
|
||||
|
||||
export DYNINSTAPI_RT_LIB
|
||||
export LD_LIBRARY_PATH
|
||||
|
||||
rlRun "setsebool allow_execmod on"
|
||||
rlRun "setsebool allow_execstack on"
|
||||
rlRun "setsebool deny_ptrace off"
|
||||
|
||||
rlRun "pushd $TESTDIR"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
rlRun "./runTests -v++ -allmode -allcompilers -allopt -exclude $SKIPLIST"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
--- dyninst-10.2.0/testsuite-10.1.0/CMakeLists.txt
|
||||
+++ dyninst-10.2.0/testsuite-10.1.0/CMakeLists.txt
|
||||
@@ -111,7 +111,8 @@
|
||||
if(UNIX)
|
||||
enable_language(ASM-ATT)
|
||||
- if("${DYNINST_PLATFORM}" MATCHES "i386")
|
||||
- enable_language(ASM_NASM)
|
||||
- endif()
|
||||
+# nasm/yasm are deprecated
|
||||
+# if("${DYNINST_PLATFORM}" MATCHES "i386")
|
||||
+# enable_language(ASM_NASM)
|
||||
+# endif()
|
||||
elseif(WIN32)
|
||||
enable_language(ASM_MASM)
|
||||
|
||||
--- dyninst-10.2.0/testsuite-10.1.0/src/instruction/test_instruction_farcall.C
|
||||
+++ dyninst-10.2.0/testsuite-10.1.0/src/instruction/test_instruction_farcall.C
|
||||
@@ -96,21 +96,21 @@ test_results_t test_instruction_farcall_Mutator::executeTest()
|
||||
if(decodedInsns.size() != expectedInsns) // six valid, one invalid
|
||||
{
|
||||
logerror("FAILED: Expected %d instructions, decoded %d\n", expectedInsns, decodedInsns.size());
|
||||
- for(std::vector<Instruction::Ptr>::iterator curInsn = decodedInsns.begin();
|
||||
+ for(std::vector<Instruction>::iterator curInsn = decodedInsns.begin();
|
||||
curInsn != decodedInsns.end();
|
||||
++curInsn)
|
||||
{
|
||||
- logerror("\t%s\t", (*curInsn)->format().c_str());
|
||||
- for(unsigned j = 0; j < (*curInsn)->size(); ++j)
|
||||
+ logerror("\t%s\t", (*curInsn).format().c_str());
|
||||
+ for(unsigned j = 0; j < (*curInsn).size(); ++j)
|
||||
{
|
||||
- logerror("%x ", (*curInsn)->rawByte(j));
|
||||
+ logerror("%x ", (*curInsn).rawByte(j));
|
||||
}
|
||||
logerror("\n");
|
||||
}
|
||||
|
||||
return FAILED;
|
||||
}
|
||||
- if(decodedInsns.back() && decodedInsns.back()->isValid())
|
||||
+ if(decodedInsns.size() > 0 && decodedInsns.back().isValid())
|
||||
{
|
||||
logerror("FAILED: Expected instructions to end with an invalid instruction, but they didn't");
|
||||
return FAILED;
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
--- dyninst-10.1.0/testsuite-10.1.0/src/proccontrol/pcontrol_mutatee_tools.c.orig 2019-05-31 05:20:00.492379706 +0200
|
||||
+++ dyninst-10.1.0/testsuite-10.1.0/src/proccontrol/pcontrol_mutatee_tools.c 2019-05-31 05:10:11.354826668 +0200
|
||||
@@ -62,9 +62,9 @@
|
||||
#if !defined(os_windows_test)
|
||||
#include <poll.h>
|
||||
|
||||
-static unsigned int gettid(){
|
||||
- return (unsigned int)pthread_self();
|
||||
-}
|
||||
+// static unsigned int gettid(){
|
||||
+// return (unsigned int)pthread_self();
|
||||
+// }
|
||||
#endif
|
||||
|
||||
thread_t threads[MAX_POSSIBLE_THREADS];
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
--- dyninst-10.2.0/testsuite-10.1.0/src/test_lib.h
|
||||
+++ dyninst-10.2.0/testsuite-10.1.0/src/test_lib.h
|
||||
@@ -158,3 +158,3 @@
|
||||
|
||||
- TESTLIB_DLL_EXPORT virtual ~LocErr() THROW;
|
||||
+ TESTLIB_DLL_EXPORT virtual ~LocErr() throw();
|
||||
|
||||
--- dyninst-10.2.0/testsuite-10.1.0/src/test_lib.C
|
||||
+++ dyninst-10.2.0/testsuite-10.1.0/src/test_lib.C
|
||||
@@ -112,3 +112,3 @@
|
||||
|
||||
-LocErr::~LocErr() THROW
|
||||
+LocErr::~LocErr() throw()
|
||||
{}
|
||||
Loading…
Add table
Add a link
Reference in a new issue