import-trace: fail gracefully if --elf is missing but needed

Change-Id: Ib154326507e307b65099f1b84c44e796b1aef98a
This commit is contained in:
Horst Schirmeier
2018-07-23 15:33:06 +02:00
parent 54f3d3f9b6
commit 8adc859223
4 changed files with 16 additions and 1 deletions

View File

@ -104,6 +104,11 @@ bool AdvancedMemoryImporter::handle_ip_event(fail::simtime_t curtime, instructio
llvm::InitializeAllTargetMCs();
llvm::InitializeAllDisassemblers();
if (!m_elf) {
LOG << "Please give an ELF binary as parameter (-e/--elf)." << std::endl;
return false;
}
Expected<OwningBinary<Binary>> BinaryOrErr = createBinary(m_elf->getFilename());
if (!BinaryOrErr) {
std::string Buf;

View File

@ -94,7 +94,7 @@ bool ElfImporter::create_database()
bool ElfImporter::copy_to_database(ProtoIStream &ps)
{
if (!m_elf) {
LOG << "please give an elf binary as parameter (-e/--elf)" << std::endl;
LOG << "Please give an ELF binary as parameter (-e/--elf)." << std::endl;
return false;
}

View File

@ -18,6 +18,11 @@ bool InstructionImporter::handle_ip_event(fail::simtime_t curtime, instruction_c
llvm::InitializeAllTargetMCs();
llvm::InitializeAllDisassemblers();
if (!m_elf) {
LOG << "Please give an ELF binary as parameter (-e/--elf)." << std::endl;
return false;
}
Expected<OwningBinary<Binary>> BinaryOrErr = createBinary(m_elf->getFilename());
if (!BinaryOrErr) {
std::string Buf;

View File

@ -133,6 +133,11 @@ bool RegisterImporter::handle_ip_event(fail::simtime_t curtime, instruction_coun
llvm::InitializeAllTargetMCs();
llvm::InitializeAllDisassemblers();
if (!m_elf) {
LOG << "Please give an ELF binary as parameter (-e/--elf)." << std::endl;
return false;
}
Expected<OwningBinary<Binary>> BinaryOrErr = createBinary(m_elf->getFilename());
if (!BinaryOrErr) {
std::string Buf;