formatting, typos, comments, details

Change-Id: Iae5f1acb653a694622e9ac2bad93efcfca588f3a
This commit is contained in:
Horst Schirmeier
2013-10-14 14:43:39 +02:00
parent 7591c9edc5
commit 4cb97a7fa5
138 changed files with 1566 additions and 1576 deletions

View File

@ -75,16 +75,16 @@ bool ElfImporter::import_with_objdump(const std::string &binary) {
LOG << "Executing: " << command << std::endl;
redi::ipstream objdump( command );
std::string str;
while(std::getline(objdump, str)){
while (std::getline(objdump, str)) {
if (!evaluate_objdump_line(str)) {
objdump.close();
return false;
}
}
objdump.close();
if(objdump.rdbuf()->exited()){
if (objdump.rdbuf()->exited()) {
int ex = objdump.rdbuf()->status();
if(ex != 0){
if (ex != 0) {
clear_database();
LOG << "Could not disassemble!" << std::endl;
return false;
@ -99,11 +99,11 @@ bool ElfImporter::evaluate_objdump_line(const std::string& line){
#ifndef __puma
// Only read in real code lines:
// Code lines start with a leading whitespace! (hopefully in each objdump implementation!)
if(line.size() > 0 && isspace(line[0])){
if (line.size() > 0 && isspace(line[0])) {
// a line looks like: 800156c:\tdd14 \tble.n 8001598 <_ZN2hw3hal7T32Term8PutBlockEPci+0x30>
static boost::regex expr("\\s+([A-Fa-f0-9]+):((?:\\s+[A-Fa-f0-9]{2})+)\\s+(.+?)(;.*)?$");
boost::smatch res;
if(boost::regex_search(line, res, expr)){
if (boost::regex_search(line, res, expr)) {
std::string address = res[1];
std::stringstream ss;
ss << std::hex << address;

View File

@ -88,7 +88,7 @@ bool Importer::copy_to_database(fail::ProtoIStream &ps) {
curtime += ev.time_delta();
}
// instruction events just get counted
// instruction event?
if (!ev.has_memaddr()) {
// new instruction
// sanity check for overflow

View File

@ -146,7 +146,7 @@ int main(int argc, char *argv[]) {
importer = new ElfImporter();
#endif
} else {
LOG << "Unkown import method: " << imp << endl;
LOG << "Unknown import method: " << imp << endl;
exit(-1);
}
LOG << "Using " << imp << endl;