Files
fail/tools/import-trace/RandomJumpImporter.hpp
Christian Dietrich 6c9bb21ab3 import-trace: introduce RandomJumpImporter
The random jump importer defines trace events, that indicate all
possible jumps into a specific instruction range. The region where
jumps should start can be defined by a memory map given with
--jump-from. For each instruction declared in that memory range, all
possible jumps to a memory region specified by with --jump-to are
inserted. The target of the jump is saved in the data_address
field. So all database tools work as expected.

for each event E \in region(--jump-from):
    foreach Instruction in region(--jump-to):
         insert_trace(injection_instr = E.IP(), data_address = Instruction.addr)

Change-Id: Ie163968acae47fc6c946fc77774c47ee07950bab
2013-07-05 10:19:58 +02:00

44 lines
1.0 KiB
C++

#ifndef __RANDOM_JUMP_IMPORTER_H__
#define __RANDOM_JUMP_IMPORTER_H__
#include <vector>
#include "util/CommandLine.hpp"
#include "Importer.hpp"
#ifndef __puma
#include "util/llvmdisassembler/LLVMDisassembler.hpp"
#endif
class RandomJumpImporter : public Importer {
#ifndef __puma
llvm::OwningPtr<llvm::object::Binary> binary;
llvm::OwningPtr<fail::LLVMDisassembler> disas;
#endif
fail::CommandLine::option_handle FROM, TO;
fail::MemoryMap *m_mm_from, *m_mm_to;
std::vector<fail::guest_address_t> m_jump_to_addresses;
public:
/**
* Callback function that can be used to add command line options
* to the campaign
*/
virtual bool cb_commandline_init();
virtual bool handle_ip_event(fail::simtime_t curtime, instruction_count_t instr,
const Trace_Event &ev);
virtual bool handle_mem_event(fail::simtime_t curtime, instruction_count_t instr,
const Trace_Event &ev) {
/* ignore on purpose */
return true;
}
virtual void open_unused_ec_intervals() {
/* empty, Memory Map has a different meaning in this importer */
}
};
#endif