Files
revng-revng/lib/PipelineC/CMakeLists.txt
Giacomo Vercesi a2b7d0e0bf PipelineC: add tracing
Add support for tracing onto the PipelineC. This is done by:
1. Creating wrapper functions for each PipelineC function with the
   script in `scripts/PipelineC_add_tracing.py`. These will call a
   special function called `wrap` which will ultimately call a method
   with a `_` prepended to the name
2. Conversion of all PipelineC methods in `PipelineC.cpp` to `static`
   and their rename with a `_` in front, in order for them to work with
   the wrapper function in (1)
3. Generation of 2 additional include files, one for types and one for
   functions, to be used by users of tracing files in order to have
   introspection.

These steps allow the creation of a trace file with the use of the
`REVNG_C_API_TRACE_PATH` environment variable. The traces can then be
used in conjunction with the `revng trace run` and `revng trace
inspect` commands.
2023-04-20 14:43:13 +02:00

31 lines
1.3 KiB
CMake

#
# This file is distributed under the MIT License. See LICENSE.md for details.
#
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/include/revng/PipelineC/Types.inc"
"${CMAKE_BINARY_DIR}/include/revng/PipelineC/Functions.inc"
"${CMAKE_BINARY_DIR}/include/revng/PipelineC/Wrappers.h"
COMMAND
# cmake-format: off
python "${CMAKE_SOURCE_DIR}/scripts/PipelineC_add_tracing.py"
-i "${CMAKE_SOURCE_DIR}/include/revng/PipelineC/ForwardDeclarationsC.h"
-i "${CMAKE_SOURCE_DIR}/include/revng/PipelineC/Prototypes.h"
"${CMAKE_BINARY_DIR}/include/revng/PipelineC"
# cmake-format: on
DEPENDS "${CMAKE_SOURCE_DIR}/scripts/PipelineC_add_tracing.py"
"${CMAKE_SOURCE_DIR}/include/revng/PipelineC/ForwardDeclarationsC.h"
"${CMAKE_SOURCE_DIR}/include/revng/PipelineC/Prototypes.h")
add_custom_target(
PipelineC-autogenerated
DEPENDS "${CMAKE_BINARY_DIR}/include/revng/PipelineC/Types.inc"
"${CMAKE_BINARY_DIR}/include/revng/PipelineC/Functions.inc"
"${CMAKE_BINARY_DIR}/include/revng/PipelineC/Wrappers.h")
revng_add_library_internal(revngPipelineC SHARED PipelineC.cpp
Tracing/Inspector.cpp Tracing/Runner.cpp)
add_dependencies(revngPipelineC PipelineC-autogenerated)
target_link_libraries(revngPipelineC revngPipes ${LLVM_LIBRARIES})