mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
a2b7d0e0bf
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.
63 lines
1.8 KiB
C++
63 lines
1.8 KiB
C++
#pragma once
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
#include "revng/Pipeline/Target.h"
|
|
#include "revng/Pipes/PipelineManager.h"
|
|
|
|
// NOLINTBEGIN
|
|
|
|
struct rp_error_reason {
|
|
public:
|
|
std::string Message;
|
|
std::string Location;
|
|
|
|
rp_error_reason(std::string Message, std::string Location) :
|
|
Message(std::move(Message)), Location(std::move(Location)) {}
|
|
};
|
|
|
|
struct rp_document_error {
|
|
public:
|
|
std::vector<rp_error_reason> Reasons;
|
|
std::string LocationType;
|
|
std::string ErrorType;
|
|
|
|
rp_document_error(std::string ErrorType, std::string LocationType) :
|
|
LocationType(std::move(LocationType)), ErrorType(std::move(ErrorType)) {}
|
|
};
|
|
|
|
struct rp_simple_error {
|
|
public:
|
|
std::string Message;
|
|
std::string ErrorType;
|
|
|
|
rp_simple_error(std::string Message, std::string Type) :
|
|
Message(std::move(Message)), ErrorType(std::move(Type)) {}
|
|
};
|
|
|
|
// clang-format off
|
|
using rp_error = std::variant<std::monostate,
|
|
rp_simple_error,
|
|
rp_document_error>;
|
|
// clang-format on
|
|
|
|
typedef revng::pipes::PipelineManager rp_manager;
|
|
typedef const pipeline::Kind rp_kind;
|
|
typedef const pipeline::Rank rp_rank;
|
|
typedef pipeline::Step rp_step;
|
|
typedef pipeline::ContainerSet::value_type rp_container;
|
|
typedef const pipeline::ContainerFactorySet::value_type rp_container_identifier;
|
|
typedef const pipeline::Target rp_target;
|
|
typedef const pipeline::TargetsList rp_targets_list;
|
|
typedef const pipeline::Step::AnalysisValueType rp_analysis;
|
|
typedef const pipeline::DiffMap rp_diff_map;
|
|
typedef llvm::StringMap<std::string> rp_string_map;
|
|
typedef pipeline::InvalidationMap rp_invalidations;
|
|
typedef llvm::SmallVector<char, 0> rp_buffer;
|
|
typedef pipeline::ContainerToTargetsMap rp_container_targets_map;
|
|
typedef const pipeline::AnalysesList rp_analyses_list;
|
|
|
|
// NOLINTEND
|