import-trace: add --cover-memorymap switch

This compatibility-breaking change introduces the --cover-memorymap
switch to import-trace.  It makes a previous behavior optional, which
enforces DB entries for addresses covered by the --memorymap that
don't occur in the trace.  This creates a continuous and potentially
very large fault space in the DB, which never made any real sense.

Change-Id: I47e412bb621b595748c1772e02d2577308be8664
This commit is contained in:
Horst Schirmeier
2021-03-28 08:52:34 +02:00
parent 6598520c0a
commit 3b7404de43
3 changed files with 13 additions and 5 deletions

View File

@ -146,10 +146,11 @@ bool Importer::copy_to_database(fail::ProtoIStream &ps) {
LOG << "trace duration: " << std::dec << (curtime - m_time_trace_start) << " ticks" << std::endl; LOG << "trace duration: " << std::dec << (curtime - m_time_trace_start) << " ticks" << std::endl;
LOG << "Inserted " << m_row_count << " real trace events into the database" << std::endl; LOG << "Inserted " << m_row_count << " real trace events into the database" << std::endl;
if (m_cover_memorymap) {
/* All addresses that were specified in the memory map get an open /* All addresses that were specified in the memory map get an open
EC */ EC */
open_unused_ec_intervals(); open_unused_ec_intervals();
}
/* Close all open EC intervals */ /* Close all open EC intervals */
if (!close_ec_intervals()) { if (!close_ec_intervals()) {

View File

@ -27,6 +27,7 @@ protected:
bool m_sanitychecks; bool m_sanitychecks;
bool m_import_write_ecs; bool m_import_write_ecs;
bool m_extended_trace; bool m_extended_trace;
bool m_cover_memorymap;
fail::Database *db; fail::Database *db;
fail::Architecture m_arch; fail::Architecture m_arch;
fail::UniformRegisterSet *m_extended_trace_regs; fail::UniformRegisterSet *m_extended_trace_regs;
@ -120,7 +121,8 @@ protected:
bool sanitycheck(std::string check_name, std::string fail_msg, std::string sql); bool sanitycheck(std::string check_name, std::string fail_msg, std::string sql);
public: public:
Importer() : m_variant_id(0), m_elf(NULL), m_mm(NULL), m_faultspace_rightmargin('W'), Importer() : m_variant_id(0), m_elf(NULL), m_mm(NULL), m_faultspace_rightmargin('W'),
m_sanitychecks(false), m_import_write_ecs(true), m_extended_trace(false), db(NULL), m_sanitychecks(false), m_import_write_ecs(true), m_extended_trace(false),
m_cover_memorymap(false), db(NULL),
m_extended_trace_regs(NULL), m_row_count(0), m_time_trace_start(0), m_extended_trace_regs(NULL), m_row_count(0), m_time_trace_start(0),
m_last_ip(0), m_last_instr(0), m_last_time(0) {} m_last_ip(0), m_last_instr(0), m_last_time(0) {}
bool init(const std::string &variant, const std::string &benchmark, fail::Database *db); bool init(const std::string &variant, const std::string &benchmark, fail::Database *db);
@ -142,6 +144,7 @@ public:
void set_sanitychecks(bool enabled) { m_sanitychecks = enabled; } void set_sanitychecks(bool enabled) { m_sanitychecks = enabled; }
void set_import_write_ecs(bool enabled) { m_import_write_ecs = enabled; } void set_import_write_ecs(bool enabled) { m_import_write_ecs = enabled; }
void set_extended_trace(bool enabled) { m_extended_trace = enabled; } void set_extended_trace(bool enabled) { m_extended_trace = enabled; }
void set_cover_memorymap(bool enabled) { m_cover_memorymap = enabled; }
}; };
#endif #endif

View File

@ -118,6 +118,9 @@ int main(int argc, char *argv[]) {
CommandLine::option_handle MEMORYMAP = CommandLine::option_handle MEMORYMAP =
cmd.addOption("m", "memorymap", Arg::Required, cmd.addOption("m", "memorymap", Arg::Required,
"-m/--memorymap \tMemory map to intersect with trace (if used more than once, the union of all maps will be used; default: UNSET)"); "-m/--memorymap \tMemory map to intersect with trace (if used more than once, the union of all maps will be used; default: UNSET)");
CommandLine::option_handle COVER_MEMORYMAP =
cmd.addOption("", "cover-memorymap", Arg::None,
"--cover-memorymap \tEnforces DB entries for addresses covered by the --memorymap that don't occur in the trace");
CommandLine::option_handle NO_DELETE = CommandLine::option_handle NO_DELETE =
cmd.addOption("", "no-delete", Arg::None, cmd.addOption("", "no-delete", Arg::None,
"--no-delete \tAssume there are no DB entries for this variant/benchmark, don't issue a DELETE"); "--no-delete \tAssume there are no DB entries for this variant/benchmark, don't issue a DELETE");
@ -252,6 +255,7 @@ int main(int argc, char *argv[]) {
importer->set_sanitychecks(cmd[ENABLE_SANITYCHECKS]); importer->set_sanitychecks(cmd[ENABLE_SANITYCHECKS]);
importer->set_extended_trace(cmd[EXTENDED_TRACE]); importer->set_extended_trace(cmd[EXTENDED_TRACE]);
importer->set_import_write_ecs(!cmd[NO_WRITE_ECS]); importer->set_import_write_ecs(!cmd[NO_WRITE_ECS]);
importer->set_cover_memorymap(cmd[COVER_MEMORYMAP]);
if (!importer->init(variant, benchmark, db)) { if (!importer->init(variant, benchmark, db)) {
LOG << "importer->init() failed" << endl; LOG << "importer->init() failed" << endl;