mirror of
https://github.com/NaC-L/Mergen.git
synced 2026-05-12 09:40:34 +00:00
Refactor: reorganize lifter/ into subdirectories with PascalCase naming
Directory structure: lifter/core/ - LifterClass, pipeline, drivers, application, utils lifter/semantics/ - Semantics*.ipp, OperandUtils.ipp, opcodes lifter/disasm/ - Disassembler backends, mnemonic/register mappings lifter/memory/ - GEPTracker, MemoryPolicy, FileReader lifter/analysis/ - PathSolver, CustomPasses lifter/test/ - TestInstructions, Tester, test_vectors/ Naming convention standardized to PascalCase: fileReader.hpp -> FileReader.hpp lifterClass.hpp -> LifterClass.hpp icedDisassembler* -> IcedDisassembler* utils.h/cpp -> Utils.h/cpp includes.h -> Includes.h pp_macros.hpp -> PPMacros.hpp test_instructions* -> TestInstructions* tester.hpp -> Tester.hpp Include resolution uses cmake include-directories so no path prefixes needed in #include directives. All script paths updated for new test_vectors and opcodes locations.
This commit is contained in:
Generated
+71
-49
@@ -72,50 +72,55 @@ FetchContent_MakeAvailable(magic_enum)
|
||||
|
||||
# Target: lifter
|
||||
set(lifter_SOURCES
|
||||
"lifter/PathSolver.cpp"
|
||||
"lifter/lifter.cpp"
|
||||
"lifter/test_instructions.cpp"
|
||||
"lifter/utils.cpp"
|
||||
"lifter/CommonMnemonics.h"
|
||||
"lifter/CommonRegisters.h"
|
||||
"lifter/GEPTracker.h"
|
||||
"lifter/OperandUtils.h"
|
||||
"lifter/PathSolver.h"
|
||||
"lifter/Semantics.h"
|
||||
"lifter/ZydisDisassembler_mnemonics.h"
|
||||
"lifter/ZydisDisassembler_registers.h"
|
||||
"lifter/icedDisassembler_mnemonics.h"
|
||||
"lifter/icedDisassembler_registers.h"
|
||||
"lifter/includes.h"
|
||||
"lifter/test_instructions.h"
|
||||
"lifter/utils.h"
|
||||
"lifter/CommandLineHelpers.hpp"
|
||||
"lifter/CommonDisassembler.hpp"
|
||||
"lifter/CustomPasses.hpp"
|
||||
"lifter/FunctionSignatures.hpp"
|
||||
"lifter/InlinePolicy.hpp"
|
||||
"lifter/LiftDriver.hpp"
|
||||
"lifter/LifterApplication.hpp"
|
||||
"lifter/LifterPipeline.hpp"
|
||||
"lifter/LifterPipelineStages.hpp"
|
||||
"lifter/LifterStages.hpp"
|
||||
"lifter/MemoryPolicy.hpp"
|
||||
"lifter/MemoryPolicySetup.hpp"
|
||||
"lifter/MergenPB.hpp"
|
||||
"lifter/RegisterManager.hpp"
|
||||
"lifter/RuntimeImageContext.hpp"
|
||||
"lifter/ZydisDisassembler.hpp"
|
||||
"lifter/fileReader.hpp"
|
||||
"lifter/icedDisassembler.hpp"
|
||||
"lifter/lifterClass.hpp"
|
||||
"lifter/lifterClass_concolic.hpp"
|
||||
"lifter/lifterClass_symbolic.hpp"
|
||||
"lifter/pp_macros.hpp"
|
||||
"lifter/tester.hpp"
|
||||
"lifter/GEPTracker.ipp"
|
||||
"lifter/OperandUtils.ipp"
|
||||
"lifter/PathSolver.ipp"
|
||||
"lifter/Semantics.ipp"
|
||||
"lifter/core/Lifter.cpp"
|
||||
"lifter/core/Utils.cpp"
|
||||
"lifter/analysis/PathSolver.cpp"
|
||||
"lifter/test/TestInstructions.cpp"
|
||||
"lifter/core/Includes.h"
|
||||
"lifter/core/OperandUtils.h"
|
||||
"lifter/core/Semantics.h"
|
||||
"lifter/core/Utils.h"
|
||||
"lifter/core/CommandLineHelpers.hpp"
|
||||
"lifter/core/FunctionSignatures.hpp"
|
||||
"lifter/core/InlinePolicy.hpp"
|
||||
"lifter/core/LiftDriver.hpp"
|
||||
"lifter/core/LifterApplication.hpp"
|
||||
"lifter/core/LifterClass.hpp"
|
||||
"lifter/core/LifterClass_Concolic.hpp"
|
||||
"lifter/core/LifterClass_Symbolic.hpp"
|
||||
"lifter/core/LifterPipeline.hpp"
|
||||
"lifter/core/LifterPipelineStages.hpp"
|
||||
"lifter/core/LifterStages.hpp"
|
||||
"lifter/core/MergenPB.hpp"
|
||||
"lifter/core/RegisterManager.hpp"
|
||||
"lifter/core/RuntimeImageContext.hpp"
|
||||
"lifter/disasm/CommonDisassembler.hpp"
|
||||
"lifter/disasm/CommonMnemonics.h"
|
||||
"lifter/disasm/CommonRegisters.h"
|
||||
"lifter/disasm/IcedDisassembler.hpp"
|
||||
"lifter/disasm/IcedDisassemblerMnemonics.h"
|
||||
"lifter/disasm/IcedDisassemblerRegisters.h"
|
||||
"lifter/disasm/ZydisDisassembler.hpp"
|
||||
"lifter/disasm/ZydisDisassemblerMnemonics.h"
|
||||
"lifter/disasm/ZydisDisassemblerRegisters.h"
|
||||
"lifter/memory/FileReader.hpp"
|
||||
"lifter/memory/GEPTracker.h"
|
||||
"lifter/memory/GEPTracker.ipp"
|
||||
"lifter/memory/MemoryPolicy.hpp"
|
||||
"lifter/memory/MemoryPolicySetup.hpp"
|
||||
"lifter/analysis/CustomPasses.hpp"
|
||||
"lifter/analysis/PathSolver.h"
|
||||
"lifter/analysis/PathSolver.ipp"
|
||||
"lifter/semantics/OperandUtils.ipp"
|
||||
"lifter/semantics/PPMacros.hpp"
|
||||
"lifter/semantics/Semantics.ipp"
|
||||
"lifter/semantics/Semantics_Arithmetic.ipp"
|
||||
"lifter/semantics/Semantics_Bitwise.ipp"
|
||||
"lifter/semantics/Semantics_ControlFlow.ipp"
|
||||
"lifter/semantics/Semantics_Helpers.ipp"
|
||||
"lifter/semantics/Semantics_Misc.ipp"
|
||||
"lifter/test/TestInstructions.h"
|
||||
"lifter/test/Tester.hpp"
|
||||
cmake.toml
|
||||
)
|
||||
|
||||
@@ -124,6 +129,15 @@ add_executable(lifter)
|
||||
target_sources(lifter PRIVATE ${lifter_SOURCES})
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${lifter_SOURCES})
|
||||
|
||||
target_include_directories(lifter PRIVATE
|
||||
"lifter/core"
|
||||
"lifter/semantics"
|
||||
"lifter/disasm"
|
||||
"lifter/memory"
|
||||
"lifter/analysis"
|
||||
"lifter/test"
|
||||
)
|
||||
|
||||
if(DEFINED MERGEN_TEST) # testmode
|
||||
target_compile_definitions(lifter PRIVATE
|
||||
MERGEN_TEST
|
||||
@@ -169,10 +183,10 @@ endif()
|
||||
|
||||
# Target: rewrite_microtests
|
||||
set(rewrite_microtests_SOURCES
|
||||
"lifter/PathSolver.cpp"
|
||||
"lifter/lifter.cpp"
|
||||
"lifter/test_instructions.cpp"
|
||||
"lifter/utils.cpp"
|
||||
"lifter/core/Lifter.cpp"
|
||||
"lifter/core/Utils.cpp"
|
||||
"lifter/analysis/PathSolver.cpp"
|
||||
"lifter/test/TestInstructions.cpp"
|
||||
cmake.toml
|
||||
)
|
||||
|
||||
@@ -181,6 +195,15 @@ add_executable(rewrite_microtests)
|
||||
target_sources(rewrite_microtests PRIVATE ${rewrite_microtests_SOURCES})
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${rewrite_microtests_SOURCES})
|
||||
|
||||
target_include_directories(rewrite_microtests PRIVATE
|
||||
"lifter/core"
|
||||
"lifter/semantics"
|
||||
"lifter/disasm"
|
||||
"lifter/memory"
|
||||
"lifter/analysis"
|
||||
"lifter/test"
|
||||
)
|
||||
|
||||
target_compile_definitions(rewrite_microtests PRIVATE
|
||||
MERGEN_TEST
|
||||
)
|
||||
@@ -216,4 +239,3 @@ if(WIN32) # windows
|
||||
Ws2_32
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
+20
-4
@@ -36,8 +36,16 @@ tag = "a413fcc"
|
||||
|
||||
[target.lifter]
|
||||
type = "executable"
|
||||
sources = ["lifter/*.cpp"]
|
||||
headers = ["lifter/*.h", "lifter/*.hpp", "lifter/*.ipp"]
|
||||
sources = ["lifter/core/*.cpp", "lifter/analysis/*.cpp", "lifter/test/*.cpp"]
|
||||
headers = [
|
||||
"lifter/core/*.h", "lifter/core/*.hpp",
|
||||
"lifter/semantics/*.hpp", "lifter/semantics/*.ipp",
|
||||
"lifter/disasm/*.h", "lifter/disasm/*.hpp",
|
||||
"lifter/memory/*.h", "lifter/memory/*.hpp", "lifter/memory/*.ipp",
|
||||
"lifter/analysis/*.h", "lifter/analysis/*.hpp", "lifter/analysis/*.ipp",
|
||||
"lifter/test/*.h", "lifter/test/*.hpp"
|
||||
]
|
||||
include-directories = ["lifter/core", "lifter/semantics", "lifter/disasm", "lifter/memory", "lifter/analysis", "lifter/test"]
|
||||
link-libraries = ["LLVM-Wrapper", "linux-pe", "magic_enum"]
|
||||
ICED_NOT_FOUND.link-libraries = ["Zydis"]
|
||||
ICED_FOUND.link-libraries = ["Iced_Wrapper"]
|
||||
@@ -51,8 +59,16 @@ compile-options = ["$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<NOT:$<CXX_COMPILER_ID:Clan
|
||||
# cmkr lacks target inheritance, so fields are duplicated — keep in sync with [target.lifter].
|
||||
[target.rewrite_microtests]
|
||||
type = "executable"
|
||||
sources = ["lifter/*.cpp"]
|
||||
headers = ["lifter/*.h", "lifter/*.hpp", "lifter/*.ipp"]
|
||||
sources = ["lifter/core/*.cpp", "lifter/analysis/*.cpp", "lifter/test/*.cpp"]
|
||||
headers = [
|
||||
"lifter/core/*.h", "lifter/core/*.hpp",
|
||||
"lifter/semantics/*.hpp", "lifter/semantics/*.ipp",
|
||||
"lifter/disasm/*.h", "lifter/disasm/*.hpp",
|
||||
"lifter/memory/*.h", "lifter/memory/*.hpp", "lifter/memory/*.ipp",
|
||||
"lifter/analysis/*.h", "lifter/analysis/*.hpp", "lifter/analysis/*.ipp",
|
||||
"lifter/test/*.h", "lifter/test/*.hpp"
|
||||
]
|
||||
include-directories = ["lifter/core", "lifter/semantics", "lifter/disasm", "lifter/memory", "lifter/analysis", "lifter/test"]
|
||||
link-libraries = ["LLVM-Wrapper", "linux-pe", "magic_enum"]
|
||||
ICED_NOT_FOUND.link-libraries = ["Zydis"]
|
||||
ICED_FOUND.link-libraries = ["Iced_Wrapper"]
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
#define CUSTOMPASSES_H
|
||||
|
||||
#include "MemoryPolicy.hpp"
|
||||
#include "fileReader.hpp"
|
||||
#include "includes.h"
|
||||
#include "utils.h"
|
||||
#include "FileReader.hpp"
|
||||
#include "Includes.h"
|
||||
#include "Utils.h"
|
||||
#include "llvm/IR/PassManager.h"
|
||||
#include <algorithm>
|
||||
#include <llvm/Analysis/ValueTracking.h>
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
#include "PathSolver.h"
|
||||
#include "CustomPasses.hpp"
|
||||
#include "utils.h"
|
||||
#include "Utils.h"
|
||||
#include <llvm/ADT/DenseMap.h>
|
||||
#include <llvm/Analysis/InstructionSimplify.h>
|
||||
#include <llvm/Analysis/ConstantFolding.h>
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
#include "CommonDisassembler.hpp"
|
||||
#include "PathSolver.h"
|
||||
#include "lifterClass.hpp"
|
||||
#include "utils.h"
|
||||
#include "LifterClass.hpp"
|
||||
#include "Utils.h"
|
||||
#include <llvm/Analysis/AliasAnalysis.h>
|
||||
#include <llvm/Analysis/MemorySSA.h>
|
||||
#include <llvm/Analysis/MemorySSAUpdater.h>
|
||||
@@ -1,6 +1,6 @@
|
||||
#ifndef FUNCSIGNATURES_H
|
||||
#define FUNCSIGNATURES_H
|
||||
#include "fileReader.hpp"
|
||||
#include "FileReader.hpp"
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "lifterClass_concolic.hpp"
|
||||
#include "LifterClass_Concolic.hpp"
|
||||
|
||||
inline void runLiftWorklist(lifterConcolic<>* lifter) {
|
||||
BBInfo bbinfo;
|
||||
@@ -7,15 +7,15 @@
|
||||
#include "LifterPipeline.hpp"
|
||||
#include "LifterStages.hpp"
|
||||
#include "MergenPB.hpp"
|
||||
#include "includes.h"
|
||||
#include "lifterClass.hpp"
|
||||
#include "lifterClass_concolic.hpp"
|
||||
#include "lifterClass_symbolic.hpp"
|
||||
#include "Includes.h"
|
||||
#include "LifterClass.hpp"
|
||||
#include "LifterClass_Concolic.hpp"
|
||||
#include "LifterClass_Symbolic.hpp"
|
||||
|
||||
|
||||
#include "test_instructions.h"
|
||||
#include "TestInstructions.h"
|
||||
#include "Semantics.ipp"
|
||||
#include "utils.h"
|
||||
#include "Utils.h"
|
||||
#include <coff/line_number.hpp>
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CommandLineHelpers.hpp"
|
||||
#include "utils.h"
|
||||
#include "Utils.h"
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@@ -7,14 +7,14 @@
|
||||
#include "PathSolver.h"
|
||||
#include "RegisterManager.hpp"
|
||||
#include "ZydisDisassembler.hpp"
|
||||
#include "ZydisDisassembler_mnemonics.h"
|
||||
#include "ZydisDisassembler_registers.h"
|
||||
#include "fileReader.hpp"
|
||||
#include "icedDisassembler.hpp"
|
||||
#include "icedDisassembler_mnemonics.h"
|
||||
#include "icedDisassembler_registers.h"
|
||||
#include "includes.h"
|
||||
#include "utils.h"
|
||||
#include "ZydisDisassemblerMnemonics.h"
|
||||
#include "ZydisDisassemblerRegisters.h"
|
||||
#include "FileReader.hpp"
|
||||
#include "IcedDisassembler.hpp"
|
||||
#include "IcedDisassemblerMnemonics.h"
|
||||
#include "IcedDisassemblerRegisters.h"
|
||||
#include "Includes.h"
|
||||
#include "Utils.h"
|
||||
#include "llvm/Analysis/AssumptionCache.h"
|
||||
#include "llvm/Analysis/TargetTransformInfo.h"
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
#ifndef DEFINE_FUNCTION
|
||||
#define DEFINE_FUNCTION(name) void lift_##name()
|
||||
#endif
|
||||
@@ -2,10 +2,10 @@
|
||||
#define LIFTERCLASS_CONCRETE_H
|
||||
#include "CommonDisassembler.hpp"
|
||||
#include "RegisterManager.hpp"
|
||||
#include "icedDisassembler.hpp"
|
||||
#include "icedDisassembler_mnemonics.h"
|
||||
#include "icedDisassembler_registers.h"
|
||||
#include "lifterClass.hpp"
|
||||
#include "IcedDisassembler.hpp"
|
||||
#include "IcedDisassemblerMnemonics.h"
|
||||
#include "IcedDisassemblerRegisters.h"
|
||||
#include "LifterClass.hpp"
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
|
||||
template <
|
||||
@@ -2,10 +2,10 @@
|
||||
#define LIFTERCLASS_SYMBOLIC_H
|
||||
|
||||
#include "CommonDisassembler.hpp"
|
||||
#include "icedDisassembler.hpp"
|
||||
#include "icedDisassembler_mnemonics.h"
|
||||
#include "icedDisassembler_registers.h"
|
||||
#include "lifterClass.hpp"
|
||||
#include "IcedDisassembler.hpp"
|
||||
#include "IcedDisassemblerMnemonics.h"
|
||||
#include "IcedDisassemblerRegisters.h"
|
||||
#include "LifterClass.hpp"
|
||||
#include <llvm/IR/Attributes.h>
|
||||
#include <llvm/IR/DerivedTypes.h>
|
||||
#include <llvm/IR/Metadata.h>
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "LiftDriver.hpp"
|
||||
#include "LifterPipelineStages.hpp"
|
||||
#include "utils.h"
|
||||
#include "Utils.h"
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "RuntimeImageContext.hpp"
|
||||
#include "lifterClass_concolic.hpp"
|
||||
#include "utils.h"
|
||||
#include "LifterClass_Concolic.hpp"
|
||||
#include "Utils.h"
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "MemoryPolicySetup.hpp"
|
||||
#include "RuntimeImageContext.hpp"
|
||||
#include "utils.h"
|
||||
#include "Utils.h"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
#include "CustomPasses.hpp"
|
||||
#include "lifterClass.hpp"
|
||||
#include "utils.h"
|
||||
#include "LifterClass.hpp"
|
||||
#include "Utils.h"
|
||||
#include <llvm/ADT/DenseMap.h>
|
||||
#include <llvm/IR/BasicBlock.h>
|
||||
#include <llvm/IR/Constants.h>
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "CommonRegisters.h"
|
||||
#include "utils.h"
|
||||
#include "Utils.h"
|
||||
#include <array>
|
||||
#include <assert.h>
|
||||
#include <concepts>
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fileReader.hpp"
|
||||
#include "FileReader.hpp"
|
||||
#include "nt/nt_headers.hpp"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "utils.h"
|
||||
#include "Utils.h"
|
||||
#include "llvm/IR/Value.h"
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
#include "CommonMnemonics.h"
|
||||
#include "CommonRegisters.h"
|
||||
#include "ZydisDisassembler_mnemonics.h"
|
||||
#include "ZydisDisassembler_registers.h"
|
||||
#include "ZydisDisassemblerMnemonics.h"
|
||||
#include "ZydisDisassemblerRegisters.h"
|
||||
#include <array>
|
||||
#include <concepts>
|
||||
#include <cstdint>
|
||||
@@ -4,9 +4,9 @@
|
||||
#include "CommonDisassembler.hpp"
|
||||
#include "CommonMnemonics.h"
|
||||
#include "CommonRegisters.h"
|
||||
#include "icedDisassembler_mnemonics.h"
|
||||
#include "icedDisassembler_registers.h"
|
||||
#include "utils.h"
|
||||
#include "IcedDisassemblerMnemonics.h"
|
||||
#include "IcedDisassemblerRegisters.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <magic_enum/magic_enum.hpp>
|
||||
@@ -5,8 +5,8 @@
|
||||
#include "CommonDisassembler.hpp"
|
||||
#include "CommonMnemonics.h"
|
||||
#include "CommonRegisters.h"
|
||||
#include "ZydisDisassembler_mnemonics.h"
|
||||
#include "utils.h"
|
||||
#include "ZydisDisassemblerMnemonics.h"
|
||||
#include "Utils.h"
|
||||
#include <Zydis/Register.h>
|
||||
#include <Zydis/SharedTypes.h>
|
||||
#include <Zydis/Zydis.h>
|
||||
@@ -3,8 +3,8 @@
|
||||
#include "GEPTracker.h"
|
||||
#include "MemoryPolicy.hpp"
|
||||
#include "OperandUtils.ipp"
|
||||
#include "lifterClass.hpp"
|
||||
#include "utils.h"
|
||||
#include "LifterClass.hpp"
|
||||
#include "Utils.h"
|
||||
#include "llvm/Analysis/MemorySSA.h"
|
||||
#include <llvm/Analysis/AliasAnalysis.h>
|
||||
#include <llvm/Analysis/LoopAnalysisManager.h>
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "lifterClass_concolic.hpp"
|
||||
#include "LifterClass_Concolic.hpp"
|
||||
|
||||
inline void configureDefaultMemoryPolicy(lifterConcolic<>* lifter) {
|
||||
lifter->memoryPolicy.setDefaultMode(MemoryAccessMode::SYMBOLIC);
|
||||
@@ -4,8 +4,8 @@
|
||||
#include "CommonDisassembler.hpp"
|
||||
#include "GEPTracker.ipp"
|
||||
#include "ZydisDisassembler.hpp"
|
||||
#include "lifterClass.hpp"
|
||||
#include "utils.h"
|
||||
#include "LifterClass.hpp"
|
||||
#include "Utils.h"
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <llvm/ADT/DenseMap.h>
|
||||
@@ -2,10 +2,10 @@
|
||||
#include "FunctionSignatures.hpp"
|
||||
#include "OperandUtils.ipp"
|
||||
#include "PathSolver.ipp"
|
||||
#include "fileReader.hpp"
|
||||
#include "includes.h"
|
||||
#include "lifterClass.hpp"
|
||||
#include "utils.h"
|
||||
#include "FileReader.hpp"
|
||||
#include "Includes.h"
|
||||
#include "LifterClass.hpp"
|
||||
#include "Utils.h"
|
||||
#include <immintrin.h>
|
||||
#include <iostream>
|
||||
#include <llvm/IR/Constant.h>
|
||||
@@ -40,7 +40,7 @@ int branchnumber = 0;
|
||||
|
||||
// Dispatch machinery
|
||||
|
||||
#include "pp_macros.hpp"
|
||||
#include "PPMacros.hpp"
|
||||
|
||||
MERGEN_LIFTER_DEFINITION_TEMPLATES(void)::liftInstructionSemantics() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "test_instructions.h"
|
||||
#include "TestInstructions.h"
|
||||
|
||||
#ifdef MERGEN_TEST
|
||||
|
||||
#include "tester.hpp"
|
||||
#include "Tester.hpp"
|
||||
|
||||
#include <llvm/Support/FormatVariadic.h>
|
||||
#include <llvm/Support/JSON.h>
|
||||
@@ -662,7 +662,7 @@ int buildFullHandlerSeed(const std::string& outputPath,
|
||||
int testInit(const std::string& suiteFilter) {
|
||||
const char* vectorsEnv = std::getenv("MERGEN_TEST_VECTORS");
|
||||
const std::string vectorsPath =
|
||||
vectorsEnv ? vectorsEnv : "lifter/test_vectors/oracle_vectors.json";
|
||||
vectorsEnv ? vectorsEnv : "lifter/test/test_vectors/oracle_vectors.json";
|
||||
|
||||
std::vector<InstructionTestCase> testCases;
|
||||
std::string loadError;
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "lifterClass_concolic.hpp"
|
||||
#include "LifterClass_Concolic.hpp"
|
||||
#include <llvm/IR/Constants.h>
|
||||
#include <llvm/Support/Casting.h>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"schema": "mergen-oracle-v1",
|
||||
"generated_at_utc": "2026-03-05T19:49:19.307536+00:00",
|
||||
"generated_at_utc": "2026-03-06T15:07:06.954438+00:00",
|
||||
"source_seed_schema": "mergen-oracle-seed-v1",
|
||||
"providers": [
|
||||
"unicorn"
|
||||
@@ -458,7 +458,7 @@ def main() -> None:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Build full handler seed using Capstone auto-discovery"
|
||||
)
|
||||
parser.add_argument("--opcode-file", default="lifter/x86_64_opcodes.x")
|
||||
parser.add_argument("--opcode-file", default="lifter/semantics/x86_64_opcodes.x")
|
||||
parser.add_argument("--base-seed", default="scripts/rewrite/oracle_seed_vectors.json")
|
||||
parser.add_argument("--out-seed", default="scripts/rewrite/oracle_seed_full_handlers.json")
|
||||
parser.add_argument("--iterations", type=int, default=12)
|
||||
|
||||
@@ -176,17 +176,17 @@ def main():
|
||||
)
|
||||
parser.add_argument(
|
||||
"--opcode-file",
|
||||
default="lifter/x86_64_opcodes.x",
|
||||
default="lifter/semantics/x86_64_opcodes.x",
|
||||
help="Path to opcode dispatch table",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--vectors-file",
|
||||
default="lifter/test_vectors/oracle_vectors.json",
|
||||
default="lifter/test/test_vectors/oracle_vectors.json",
|
||||
help="Path to generated oracle vectors JSON",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--legacy-tests-file",
|
||||
default="lifter/test_instructions.cpp",
|
||||
default="lifter/test/TestInstructions.cpp",
|
||||
help="Optional legacy source file for extra signal extraction",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
||||
@@ -12,8 +12,8 @@ from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
from typing import Dict, Iterable, List, Tuple
|
||||
|
||||
DEFAULT_INPUT_VECTORS = Path("lifter/test_vectors/oracle_vectors_full_handlers.json")
|
||||
DEFAULT_OUTPUT_VECTORS = Path("lifter/test_vectors/oracle_vectors_flagstress.json")
|
||||
DEFAULT_INPUT_VECTORS = Path("lifter/test/test_vectors/oracle_vectors_full_handlers.json")
|
||||
DEFAULT_OUTPUT_VECTORS = Path("lifter/test/test_vectors/oracle_vectors_flagstress.json")
|
||||
DEFAULT_SEMANTICS = Path("lifter/Semantics.ipp")
|
||||
|
||||
DEFAULT_CODE_ADDRESS = 0x1000000
|
||||
|
||||
@@ -215,7 +215,7 @@ def main():
|
||||
)
|
||||
parser.add_argument(
|
||||
"--out",
|
||||
default="lifter/test_vectors/oracle_vectors.json",
|
||||
default="lifter/test/test_vectors/oracle_vectors.json",
|
||||
help="Generated oracle output JSON",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
||||
@@ -11,12 +11,12 @@ def main():
|
||||
parser = argparse.ArgumentParser(description="Report handler test coverage")
|
||||
parser.add_argument(
|
||||
"--vectors",
|
||||
default="lifter/test_vectors/oracle_vectors.json",
|
||||
default="lifter/test/test_vectors/oracle_vectors.json",
|
||||
help="Oracle vectors JSON path",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--opcodes",
|
||||
default="lifter/x86_64_opcodes.x",
|
||||
default="lifter/semantics/x86_64_opcodes.x",
|
||||
help="Opcode handler definition file",
|
||||
)
|
||||
parser.add_argument("--json", action="store_true", help="Output JSON instead of text")
|
||||
|
||||
@@ -15,7 +15,7 @@ if errorlevel 1 exit /b 1
|
||||
|
||||
set "FULL_SEED=%~dp0oracle_seed_full_handlers.json"
|
||||
set "ENRICHED_SEED=%~dp0oracle_seed_full_handlers_enriched.json"
|
||||
set "FULL_VECTORS=%~dp0..\..\lifter\test_vectors\oracle_vectors_full_handlers.json"
|
||||
set "FULL_VECTORS=%~dp0..\..\lifter\test\test_vectors\oracle_vectors_full_handlers.json"
|
||||
|
||||
call "%~dp0build_full_handler_seed.cmd" --out-seed "%FULL_SEED%"
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
@@ -4,7 +4,7 @@ setlocal
|
||||
call "%~dp0generate_flag_stress_vectors.cmd"
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
set "MERGEN_TEST_VECTORS=%~dp0..\..\lifter\test_vectors\oracle_vectors_flagstress.json"
|
||||
set "MERGEN_TEST_VECTORS=%~dp0..\..\lifter\test\test_vectors\oracle_vectors_flagstress.json"
|
||||
set "SKIP_ORACLE_GENERATION=1"
|
||||
set "MERGEN_TEST_CHECK_FLAGS=1"
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@ from typing import Dict, List
|
||||
|
||||
ROOT = Path(__file__).resolve().parent
|
||||
REWRITE_DIR = ROOT / "scripts" / "rewrite"
|
||||
FULL_VECTORS = ROOT / "lifter" / "test_vectors" / "oracle_vectors_full_handlers.json"
|
||||
DEFAULT_VECTORS = ROOT / "lifter" / "test_vectors" / "oracle_vectors.json"
|
||||
FULL_VECTORS = ROOT / "lifter" / "test" / "test_vectors" / "oracle_vectors_full_handlers.json"
|
||||
DEFAULT_VECTORS = ROOT / "lifter" / "test" / "test_vectors" / "oracle_vectors.json"
|
||||
IR_OUTPUT_DIR = ROOT.parent / "rewrite-regression-work" / "ir_outputs"
|
||||
GOLDEN_HASHES_FILE = ROOT / "lifter" / "test_vectors" / "golden_ir_hashes.json"
|
||||
GOLDEN_HASHES_FILE = ROOT / "lifter" / "test" / "test_vectors" / "golden_ir_hashes.json"
|
||||
|
||||
|
||||
def _run(argv: List[str], extra_env: Dict[str, str] | None = None) -> None:
|
||||
|
||||
Reference in New Issue
Block a user