import-trace: introduce AdvancedMemoryImporter

A MemoryImporter that additionally imports Relyzer-style conditional
branch history, instruction opcodes, and a virtual
duration=time2-time1+1 column (MariaDB 5.2+ only) for fault-space
pruning purposes.

Change-Id: I6764a26fa8aae21655be44134b88fdee85e67ff6
This commit is contained in:
Horst Schirmeier
2013-07-05 16:59:30 +02:00
parent 12b539ff75
commit ba7c663551
9 changed files with 208 additions and 1 deletions

View File

@ -0,0 +1,39 @@
#ifndef __ADVANCED_MEMORY_IMPORTER_H__
#define __ADVANCED_MEMORY_IMPORTER_H__
#include <vector>
#include "MemoryImporter.hpp"
#include "util/llvmdisassembler/LLVMDisassembler.hpp"
/**
* A MemoryImporter that additionally imports Relyzer-style conditional branch
* history, instruction opcodes, and a virtual duration = time2 - time1 + 1
* column (MariaDB 5.2+ only!) for fault-space pruning purposes.
*/
class AdvancedMemoryImporter : public MemoryImporter {
llvm::OwningPtr<llvm::object::Binary> binary;
llvm::OwningPtr<fail::LLVMDisassembler> disas;
bool m_last_was_conditional_branch;
fail::guest_address_t m_ip_jump_not_taken;
std::vector<bool> branches_taken;
struct TraceEntry {
unsigned instr2;
uint64_t data_address;
unsigned data_width;
unsigned opcode;
unsigned branches_before;
};
std::vector<TraceEntry> update_entries;
public:
AdvancedMemoryImporter() : m_last_was_conditional_branch(false) {}
virtual std::string database_additional_columns();
virtual bool handle_ip_event(fail::simtime_t curtime, instruction_count_t instr,
Trace_Event &ev);
virtual bool handle_mem_event(fail::simtime_t curtime, instruction_count_t instr,
Trace_Event &ev);
virtual bool finalize();
};
#endif