llvm-project/lldb/tools/intel-features/CMakeLists.txt

67 lines
2.3 KiB
CMake
Raw Normal View History

Tool for using Intel(R) Processor Trace hardware feature Summary: 1. Provide single library for all Intel specific hardware features instead of individual libraries for each feature 2. Added Intel(R) Processor Trace hardware feature in this single library. Details about the tool implementing this feature is as follows: Tool developed on top of LLDB to provide its users the execution trace of the debugged inferiors. Tool's API are exposed as C++ object oriented interface in a shared library. API are designed especially to be easily integrable with IDEs providing LLDB as an application debugger. Entire API is also available as Python functions through a script bridging interface allowing development of python modules. This patch also provides a CLI wrapper to use the Tool through LLDB's command line. Highlights of the Tool and the wrapper are given below: ****************************** Intel(R) Processor Trace Tool: ****************************** - Provides execution trace of the debugged application - Uses Intel(R) Processor Trace hardware feature (already implemented inside LLDB) for this purpose -- Collects trace packets generated by this feature from LLDB, decodes and post-processes them -- Constructs the execution trace of the application -- Presents execution trace as a list of assembly instructions - Provides 4 APIs (exposed as C++ object oriented interface) -- start trace with configuration options for a thread/process, -- stop trace for a thread/process, -- get the execution flow (assembly instructions) for a thread, -- get trace specific information for a thread - Easily integrable into IDEs providing LLDB as application debugger - Entire API available as Python functions through script bridging interface -- Allows developing python apps on top of Tool - README_TOOL.txt provides more details about the Tool, its dependencies, building steps and API usage - Tool ready to use through LLDB's command line -- CLI wrapper has been developed on top of the Tool for this purpose ********************************* CLI wrapper: cli-wrapper-pt.cpp ********************************* - Provides 4 commands (syntax similar to LLDB's CLI commands): -- processor-trace start -- processor-trace stop -- processor-trace show-trace-options -- processor-trace show-instr-log - README_CLI.txt provides more details about commands and their options Signed-off-by: Abhishek Aggarwal <abhishek.a.aggarwal@intel.com> Reviewers: clayborg, jingham, lldb-commits, labath Reviewed By: clayborg Subscribers: ravitheja, emaste, krytarowski, mgorny Differential Revision: https://reviews.llvm.org/D33035 llvm-svn: 310261
2017-08-07 23:26:11 +08:00
include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
# Flags to control each individual feature
option(LLDB_BUILD_INTEL_MPX "Enable Building of Intel(R) Memory Protection Extensions" ON)
option(LLDB_BUILD_INTEL_PT "Enable Building of Intel(R) Processor Trace Tool" OFF)
# Return if all features are OFF
if (NOT LLDB_BUILD_INTEL_MPX AND NOT LLDB_BUILD_INTEL_PT)
return()
endif()
LIST (APPEND FEATURE_LIBS "")
# Add feature specific subdirectories based on flags
if (LLDB_BUILD_INTEL_MPX AND CMAKE_SYSTEM_NAME MATCHES "Linux")
add_subdirectory(intel-mpx)
LIST (APPEND FEATURE_LIBS ${FEATURE_LIBS} lldbIntelMPX)
SET (CLI_WRAPPER_PREPROCESSORS "${CLI_WRAPPER_PREPROCESSORS} -DBUILD_INTEL_MPX")
endif()
if (LLDB_BUILD_INTEL_PT)
add_subdirectory(intel-pt)
LIST (APPEND FEATURE_LIBS ${FEATURE_LIBS} lldbIntelPT)
SET (CLI_WRAPPER_PREPROCESSORS "${CLI_WRAPPER_PREPROCESSORS} -DBUILD_INTEL_PT")
endif()
# Add python wrapper if python not disabled
if (NOT LLDB_DISABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
set(LLDB_INTEL_FEATURES_PYTHON_WRAP
${LLDB_BINARY_DIR}/tools/intel-features/scripts/IntelFeaturesPythonWrap.cpp)
set_source_files_properties(${LLDB_INTEL_FEATURES_PYTHON_WRAP}
PROPERTIES GENERATED 1)
if (CLANG_CL)
set_source_files_properties(${LLDB_INTEL_FEATURES_PYTHON_WRAP}
PROPERTIES COMPILE_FLAGS -Wno-unused-function)
endif()
if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
set_property(SOURCE ${LLDB_INTEL_FEATURES_PYTHON_WRAP}
APPEND_STRING PROPERTY COMPILE_FLAGS
" -Wno-sequence-point -Wno-cast-qual")
endif ()
add_subdirectory(scripts)
endif()
set_source_files_properties(cli-wrapper.cpp PROPERTIES
COMPILE_FLAGS ${CLI_WRAPPER_PREPROCESSORS})
add_lldb_library(lldbIntelFeatures SHARED
cli-wrapper.cpp
${LLDB_INTEL_FEATURES_PYTHON_WRAP}
LINK_LIBS
${FEATURE_LIBS}
)
# Add link dependencies for python wrapper
if (NOT LLDB_DISABLE_PYTHON AND LLDB_BUILD_INTEL_PT)
add_dependencies(lldbIntelFeatures intel-features-swig_wrapper)
target_link_libraries(lldbIntelFeatures PRIVATE ${LLDB_SYSTEM_LIBS})
endif()
install(TARGETS lldbIntelFeatures
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})