GenericExperiment: optionally continue if symbol not found
When prefixing a symbol name with '?', the GenericExperiment does not abort in case the symbol is not found in the provided ELF binary: fail-client -Wf,--detected-marker=?eddiErrorHandler [...] [GenericExperiment] ELF Symbol not found, ignoring: eddiErrorHandler Change-Id: Iec12416ce8e38ff0ee1704e3a725c2cadc97b756
This commit is contained in:
@ -71,10 +71,20 @@ void GenericExperiment::parseSymbols(const std::string &args, std::set<fail::Bas
|
|||||||
std::stringstream ss(args);
|
std::stringstream ss(args);
|
||||||
std::string item;
|
std::string item;
|
||||||
while (std::getline(ss, item, ',')) {
|
while (std::getline(ss, item, ',')) {
|
||||||
|
bool is_optional = false;
|
||||||
|
if (item.length() > 0 && item[0] == '?') {
|
||||||
|
item.erase(item.begin());
|
||||||
|
is_optional = true;
|
||||||
|
}
|
||||||
const ElfSymbol * symbol = &(m_elf->getSymbol(item));
|
const ElfSymbol * symbol = &(m_elf->getSymbol(item));
|
||||||
if (!symbol->isValid()) {
|
if (!symbol->isValid()) {
|
||||||
m_log << "ELF Symbol not found: " << item << endl;
|
if (is_optional) {
|
||||||
simulator.terminate(1);
|
m_log << "ELF Symbol not found, ignoring: " << item << endl;
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
m_log << "ELF Symbol not found, aborting: " << item << endl;
|
||||||
|
simulator.terminate(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_log << "Adding symbol " << item << " at 0x" << hex << symbol->getAddress() << endl;
|
m_log << "Adding symbol " << item << " at 0x" << hex << symbol->getAddress() << endl;
|
||||||
BPSingleListener *l = new BPSingleListener(symbol->getAddress());
|
BPSingleListener *l = new BPSingleListener(symbol->getAddress());
|
||||||
@ -123,7 +133,7 @@ bool GenericExperiment::cb_start_experiment() {
|
|||||||
it != end_marker_groups.end(); ++it) {
|
it != end_marker_groups.end(); ++it) {
|
||||||
CommandLine::option_handle handle =
|
CommandLine::option_handle handle =
|
||||||
cmd.addOption("", it->first, Arg::Required,
|
cmd.addOption("", it->first, Arg::Required,
|
||||||
"--" + it->first + " \tList of symbols (comma separated)");
|
"--" + it->first + " \tList of symbols (comma separated; will abort if not found, unless prefixed with '?')");
|
||||||
option_handles[it->first] = handle;
|
option_handles[it->first] = handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user