mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
GP-3369 Implement shortened display names in decompiler
This commit is contained in:
parent
69549f576f
commit
ba694068ef
31 changed files with 709 additions and 134 deletions
|
@ -176,6 +176,7 @@ class Symbol {
|
|||
protected:
|
||||
Scope *scope; ///< The scope that owns this symbol
|
||||
string name; ///< The local name of the symbol
|
||||
string displayName; ///< Name to use when displaying symbol in output
|
||||
Datatype *type; ///< The symbol's data-type
|
||||
uint4 nameDedup; ///< id to distinguish symbols with the same name
|
||||
uint4 flags; ///< Varnode-like properties of the symbol
|
||||
|
@ -218,6 +219,7 @@ public:
|
|||
Symbol(Scope *sc,const string &nm,Datatype *ct); ///< Construct given a name and data-type
|
||||
Symbol(Scope *sc); ///< Construct for use with decode()
|
||||
const string &getName(void) const { return name; } ///< Get the local name of the symbol
|
||||
const string &getDisplayName(void) const { return displayName; } ///< Get the name to display in output
|
||||
Datatype *getType(void) const { return type; } ///< Get the data-type
|
||||
uint8 getId(void) const { return symbolId; } ///< Get a unique id for the symbol
|
||||
uint4 getFlags(void) const { return flags; } ///< Get the boolean properties of the Symbol
|
||||
|
@ -469,6 +471,7 @@ class Scope {
|
|||
protected:
|
||||
Architecture *glb; ///< Architecture of \b this scope
|
||||
string name; ///< Name of \b this scope
|
||||
string displayName; ///< Name to display in output
|
||||
Funcdata *fd; ///< (If non-null) the function which \b this is the local Scope for
|
||||
uint8 uniqueId; ///< Unique id for the scope, for deduping scope names, assigning symbol ids
|
||||
static const Scope *stackAddr(const Scope *scope1,
|
||||
|
@ -551,6 +554,7 @@ protected:
|
|||
const RangeList &uselim)=0;
|
||||
SymbolEntry *addMap(SymbolEntry &entry); ///< Integrate a SymbolEntry into the range maps
|
||||
void setSymbolId(Symbol *sym,uint8 id) const { sym->symbolId = id; } ///< Adjust the id associated with a symbol
|
||||
void setDisplayName(const string &nm) { displayName = nm; } ///< Change name displayed in output
|
||||
public:
|
||||
#ifdef OPACTION_DEBUG
|
||||
mutable bool debugon;
|
||||
|
@ -559,7 +563,7 @@ public:
|
|||
#endif
|
||||
/// \brief Construct an empty scope, given a name and Architecture
|
||||
Scope(uint8 id,const string &nm,Architecture *g,Scope *own) {
|
||||
uniqueId = id; name = nm; glb = g; parent = (Scope *)0; fd = (Funcdata *)0; owner=own;
|
||||
uniqueId = id; name = nm; displayName = nm; glb = g; parent = (Scope *)0; fd = (Funcdata *)0; owner=own;
|
||||
#ifdef OPACTION_DEBUG
|
||||
debugon = false;
|
||||
#endif
|
||||
|
@ -732,6 +736,7 @@ public:
|
|||
const Address &addr,const Address &usepoint);
|
||||
|
||||
const string &getName(void) const { return name; } ///< Get the name of the Scope
|
||||
const string &getDisplayName(void) const { return displayName; } ///< Get name displayed in output
|
||||
uint8 getId(void) const { return uniqueId; } ///< Get the globally unique id
|
||||
bool isGlobal(void) const { return (fd == (Funcdata *)0); } ///< Return \b true if \b this scope is global
|
||||
|
||||
|
@ -938,7 +943,8 @@ public:
|
|||
const partmap<Address,uint4> &getProperties(void) const { return flagbase; } ///< Get the entire property map
|
||||
void encode(Encoder &encoder) const; ///< Encode the whole Database to a stream
|
||||
void decode(Decoder &decoder); ///< Decode the whole database from a stream
|
||||
void decodeScope(Decoder &decoder,Scope *newScope); ///< Register and fill out a single Scope from an XML \<scope> tag
|
||||
void decodeScope(Decoder &decoder,Scope *newScope); ///< Register and fill out a single Scope from an XML \<scope> tag
|
||||
Scope *decodeScopePath(Decoder &decoder); ///< Decode a namespace path and make sure each namespace exists
|
||||
};
|
||||
|
||||
/// \param sc is the scope containing the new symbol
|
||||
|
@ -949,6 +955,7 @@ inline Symbol::Symbol(Scope *sc,const string &nm,Datatype *ct)
|
|||
{
|
||||
scope=sc;
|
||||
name=nm;
|
||||
displayName = nm;
|
||||
nameDedup=0;
|
||||
type=ct;
|
||||
flags=0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue