Files
revng-revng/lib/Pipes/ImportBinaryPipe.cpp
Alessandro Di Federico 0793e4afcb Turn lifting into a pass
2022-03-11 15:37:12 +01:00

36 lines
1.1 KiB
C++

/// \file ImportBinaryPipe.cpp
/// \brief
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
#include "revng/Model/Binary.h"
#include "revng/Model/Importer/Binary/BinaryImporter.h"
#include "revng/Model/Importer/Binary/BinaryImporterOptions.h"
#include "revng/Model/Importer/Dwarf/DwarfImporter.h"
#include "revng/Pipeline/RegisterPipe.h"
#include "revng/Pipes/ImportBinaryPipe.h"
#include "revng/Pipes/ModelGlobal.h"
#include "revng/TupleTree/TupleTree.h"
using namespace revng::pipes;
void revng::pipes::ImportBinaryPipe::run(pipeline::Context &Context,
const FileContainer &SourceBinary) {
if (not SourceBinary.exists())
return;
TupleTree<model::Binary> &Model = getWritableModelFromContext(Context);
revng_check(not importBinary(Model, *SourceBinary.path(), BaseAddress));
if (ImportDebugInfo.size() > 0) {
DwarfImporter Importer(Model);
for (const std::string &Path : ImportDebugInfo)
Importer.import(Path);
}
}
static pipeline::RegisterPipe<ImportBinaryPipe> E;