mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
Decompiler window integer conversions
This commit is contained in:
parent
11149b9ef2
commit
1391e83ce9
35 changed files with 2430 additions and 281 deletions
|
@ -57,6 +57,7 @@ void IfaceDecompCapability::registerCommands(IfaceStatus *status)
|
|||
status->registerCom(new IfcMapfunction(),"map","function");
|
||||
status->registerCom(new IfcMapexternalref(),"map","externalref");
|
||||
status->registerCom(new IfcMaplabel(),"map","label");
|
||||
status->registerCom(new IfcMapconvert(),"map","convert");
|
||||
status->registerCom(new IfcPrintdisasm(),"disassemble");
|
||||
status->registerCom(new IfcDecompile(),"decompile");
|
||||
status->registerCom(new IfcDump(),"dump");
|
||||
|
@ -665,6 +666,45 @@ void IfcMaplabel::execute(istream &s)
|
|||
scope->setAttribute(sym,Varnode::namelock|Varnode::typelock);
|
||||
}
|
||||
|
||||
/// \class IfcMapconvert
|
||||
/// \brief Create an convert directive: `map convert <format> <value> <address> <hash>`
|
||||
///
|
||||
/// Creates a \e convert directive that causes a targeted constant value to be displayed
|
||||
/// with the specified integer format. The constant is specified by \e value, and the
|
||||
/// \e address of the p-code op using the constant plus a dynamic \e hash is also given.
|
||||
void IfcMapconvert::execute(istream &s)
|
||||
|
||||
{
|
||||
if (dcp->fd == (Funcdata *)0)
|
||||
throw IfaceExecutionError("No function loaded");
|
||||
string name;
|
||||
uintb value;
|
||||
uint8 hash;
|
||||
int4 size;
|
||||
uint4 format = 0;
|
||||
|
||||
s >> name; // Parse the format token
|
||||
if (name == "hex")
|
||||
format = Symbol::force_hex;
|
||||
else if (name == "dec")
|
||||
format = Symbol::force_dec;
|
||||
else if (name == "bin")
|
||||
format = Symbol::force_bin;
|
||||
else if (name == "oct")
|
||||
format = Symbol::force_oct;
|
||||
else if (name == "char")
|
||||
format = Symbol::force_char;
|
||||
else
|
||||
throw IfaceParseError("Bad convert format");
|
||||
|
||||
s >> ws >> hex >> value;
|
||||
Address addr = parse_machaddr(s,size,*dcp->conf->types); // Read pc address of hash
|
||||
|
||||
s >> hex >> hash; // Parse the hash value
|
||||
|
||||
dcp->fd->getScopeLocal()->addConvertSymbol(format, value, addr, hash);
|
||||
}
|
||||
|
||||
/// \class IfcPrintdisasm
|
||||
/// \brief Print disassembly of a memory range: `disassemble [<address1> <address2>]`
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue