ElfImporter: removed --debug, refactored code

This change removes the "--debug" parameter, which previously imported the
mapping of source code lines to static instructions into the database. This
mapping is useless by itself (i.e. without "--sources"), which is why its
code was refactored into the code handling "--sources".

Change-Id: I4700eb0a98661f4df9eb3c190f00dcbe4df0e200
This commit is contained in:
Michael Lenz
2014-10-07 12:18:22 +02:00
parent 3e01b0c4d5
commit 99f5d2833e

View File

@ -27,9 +27,7 @@ bool ElfImporter::cb_commandline_init() {
OBJDUMP = cmd.addOption("", "objdump", Arg::Required, OBJDUMP = cmd.addOption("", "objdump", Arg::Required,
"--objdump \tObjdump: location of objdump binary, otherwise LLVM Disassembler is used"); "--objdump \tObjdump: location of objdump binary, otherwise LLVM Disassembler is used");
SOURCECODE = cmd.addOption("", "sources", Arg::None, SOURCECODE = cmd.addOption("", "sources", Arg::None,
"--sources \timport all source files into the database"); "--sources \timport all source files and the mapping of code line<->static instruction into the database");
DEBUGINFO = cmd.addOption("", "debug", Arg::None,
"--debug \timport some debug informations into the database");
return true; return true;
} }
@ -73,9 +71,7 @@ bool ElfImporter::create_database() {
if (!db->query(create_statement.str().c_str())) { if (!db->query(create_statement.str().c_str())) {
return false; return false;
} }
}
if (cmd[DEBUGINFO]) {
create_statement.str(""); create_statement.str("");
create_statement << "CREATE TABLE IF NOT EXISTS dbg_mapping (" create_statement << "CREATE TABLE IF NOT EXISTS dbg_mapping ("
" variant_id int(11) NOT NULL," " variant_id int(11) NOT NULL,"
@ -125,9 +121,8 @@ bool ElfImporter::copy_to_database(ProtoIStream &ps) {
return false; return false;
} }
} }
}
if (cmd[DEBUGINFO]) { // import debug informations // import debug information
if(!import_mapping(m_elf->getFilename())) { if(!import_mapping(m_elf->getFilename())) {
return false; return false;
} }
@ -410,10 +405,8 @@ bool ElfImporter::clear_database() {
ret = db->query(ss.str().c_str()) == 0 ? false : true; ret = db->query(ss.str().c_str()) == 0 ? false : true;
} }
LOG << "deleted " << db->affected_rows() << " rows from dbg_source table" << std::endl; LOG << "deleted " << db->affected_rows() << " rows from dbg_source table" << std::endl;
}
//ToDo: Reset auto increment value to 1 //ToDo: Reset auto increment value to 1
if (cmd[DEBUGINFO]) {
ss.str(""); ss.str("");
ss << "DELETE FROM dbg_mapping WHERE variant_id = " << m_variant_id; ss << "DELETE FROM dbg_mapping WHERE variant_id = " << m_variant_id;