Skip to content

Commit

Permalink
ARM syntax fixes dealign with hexadecimal values and commas and brack…
Browse files Browse the repository at this point in the history
…ets in dereferences
  • Loading branch information
ssunny7 committed Oct 21, 2016
1 parent ba425e4 commit a979a5b
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions instructionAPI/src/ArchSpecificFormatters.C
Expand Up @@ -11,7 +11,7 @@ using namespace Dyninst::InstructionAPI;
///////// Formatter for ARMv-8A

std::string ArmFormatter::formatImmediate(std::string evalString) {
return evalString;
return "0x" + evalString;
}

std::string ArmFormatter::formatRegister(std::string regName) {
Expand All @@ -27,16 +27,14 @@ std::string ArmFormatter::formatRegister(std::string regName) {

std::string ArmFormatter::formatDeref(std::string addrString) {
std::stringstream out;
size_t pluspos;

if((pluspos = addrString.find("+")) != std::string::npos) {
std::string lhs = addrString.substr(0, pluspos - 1);
if(lhs == "PC")
out<<addrString.substr(pluspos + 2);
else
out<<"["<<addrString<<"]";
size_t pluspos = addrString.find("+");

if(pluspos != std::string::npos && addrString.substr(0, pluspos - 1) == "PC") {
out<<addrString.substr(pluspos + 2);
} else {
out<<"["<<addrString<<"]";
std::string left = addrString.substr(0, pluspos - 1);
std::string right = addrString.substr(pluspos + 2);
out<<"["<<left<<", "<<right<<"]";
}

return out.str();
Expand Down

0 comments on commit a979a5b

Please sign in to comment.