Ghidra Decompiler Analysis Engine
|
Go to the documentation of this file.
19 #ifndef __DATABASE_GHIDRA__
20 #define __DATABASE_GHIDRA__
39 vector<int4> spacerange;
41 mutable bool cacheDirty;
44 void processHole(
const Element *el)
const;
45 Scope *reresolveScope(uint8
id)
const;
46 virtual void addRange(
AddrSpace *spc,uintb first,uintb last);
47 virtual void removeRange(
AddrSpace *spc,uintb first,uintb last) {
48 throw LowlevelError(
"remove_range should not be performed on ghidra scope");
50 virtual Scope *buildSubScope(uint8
id,
const string &nm);
51 virtual void addSymbolInternal(
Symbol *sym) {
throw LowlevelError(
"add_symbol_internal unimplemented"); }
54 virtual SymbolEntry *addDynamicMapInternal(
Symbol *sym,uint4 exfl,uint8 hash,int4 off,int4 sz,
67 virtual void clear(
void);
72 Datatype *ct,int4 &index,uint4 flags)
const {
84 const Address &usepoint)
const {
Ghidra specific architecture information and connection to a Ghidra client.
A region where processor data is stored.
Definition: space.hh:73
virtual void clearAttribute(Symbol *sym, uint4 attr)
Clear boolean Varnode properties on a Symbol.
Definition: database_ghidra.hh:76
The lowest level error generated by the decompiler.
Definition: error.hh:44
ScopeInternal(uint8 id, const string &nm, Architecture *g)
Construct the Scope.
Definition: database.cc:1861
virtual void adjustCaches(void)
Let scopes internally adjust any caches.
Definition: database.cc:2017
A function Symbol referring to an external location.
Definition: database.hh:296
virtual void removeSymbolMappings(Symbol *symbol)
Remove all SymbolEntrys from the given Symbol.
Definition: database_ghidra.hh:105
virtual bool isNameUsed(const string &nm, const Scope *op2) const
Check if the given name is occurs within the given scope path.
Definition: database_ghidra.cc:404
An in-memory implementation of the Scope interface.
Definition: database.hh:726
virtual void clearCategory(int4 cat)
Clear all symbols of the given category from this scope.
Definition: database_ghidra.hh:101
virtual MapIterator begin(void) const
Beginning iterator to mapped SymbolEntrys.
Definition: database_ghidra.hh:95
virtual void setCategory(Symbol *sym, int4 cat, int4 ind)
Set the category and index for the given Symbol.
Definition: database_ghidra.hh:115
An iterator over SymbolEntry objects in multiple address spaces.
Definition: database.hh:330
virtual void printEntries(ostream &s) const
Dump a description of all SymbolEntry objects to a stream.
Definition: database_ghidra.hh:112
A complete in-memory XML document.
Definition: xml.hh:206
A collection of Symbol objects within a single (namespace or functional) scope.
Definition: database.hh:402
virtual string buildUndefinedName(void) const
Build a formal undefined name, used internally when a Symbol is not given a name.
Definition: database_ghidra.hh:74
virtual void renameSymbol(Symbol *sym, const string &newname)
Rename a Symbol within this Scope.
Definition: database_ghidra.hh:107
virtual SymbolEntry * findOverlap(const Address &addr, int4 size) const
Find first Symbol overlapping the given memory range.
Definition: database_ghidra.hh:91
An XML element. A node in the DOM tree.
Definition: xml.hh:150
virtual ExternRefSymbol * findExternalRef(const Address &addr) const
Find an external reference at the given address.
Definition: database_ghidra.cc:303
virtual SymbolEntry * findAddr(const Address &addr, const Address &usepoint) const
Find a Symbol at a given address and usepoint.
Definition: database_ghidra.cc:262
virtual void clearUnlockedCategory(int4 cat)
Clear unlocked symbols of the given category from this scope.
Definition: database_ghidra.hh:102
A storage location for a particular Symbol.
Definition: database.hh:51
virtual void setDisplayFormat(Symbol *sym, uint4 attr)
Set the display format for a Symbol.
Definition: database.cc:2119
virtual SymbolEntry * addMapInternal(Symbol *sym, uint4 exfl, const Address &addr, int4 off, int4 sz, const RangeList &uselim)
Create a new SymbolEntry for a Symbol given a memory range.
Definition: database_ghidra.cc:395
virtual SymbolEntry * findContainer(const Address &addr, int4 size, const Address &usepoint) const
Find the smallest Symbol containing the given memory range.
Definition: database_ghidra.cc:282
virtual void setDisplayFormat(Symbol *sym, uint4 attr)
Set the display format for a Symbol.
Definition: database_ghidra.hh:77
ScopeGhidra(ArchitectureGhidra *g)
Constructor.
Definition: database_ghidra.cc:27
virtual SymbolEntry * addSymbol(const string &name, Datatype *ct, const Address &addr, const Address &usepoint)
Add a new Symbol to this Scope, given a name, data-type, and a single mapping.
Definition: database_ghidra.cc:386
A disjoint set of Ranges, possibly across multiple address spaces.
Definition: address.hh:203
virtual Funcdata * findFunction(const Address &addr) const
Find the function starting at the given address.
Definition: database_ghidra.cc:319
An implementation of the Scope interface by querying a Ghidra client for Symbol information.
Definition: database_ghidra.hh:35
virtual void restrictScope(Funcdata *f)
Convert this to a local Scope.
Definition: database_ghidra.hh:104
virtual void saveXml(ostream &s) const
Write out this as a <scope> XML tag.
Definition: database_ghidra.hh:110
virtual string buildVariableName(const Address &addr, const Address &pc, Datatype *ct, int4 &index, uint4 flags) const
Given an address and data-type, build a suitable generic symbol name.
Definition: database_ghidra.hh:70
virtual void clearUnlocked(void)
Clear all unlocked symbols from this scope.
Definition: database_ghidra.hh:103
virtual void adjustCaches(void)
Let scopes internally adjust any caches.
Definition: database_ghidra.hh:79
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
Container for data structures associated with a single function.
Definition: funcdata.hh:45
The base datatype class for the decompiler.
Definition: type.hh:62
virtual void setAttribute(Symbol *sym, uint4 attr)
Set boolean Varnode properties on a Symbol.
Definition: database.cc:2103
virtual list< SymbolEntry >::iterator endDynamic(void)
Ending iterator to dynamic SymbolEntrys.
Definition: database_ghidra.hh:100
virtual void clear(void)
Clear all symbols from this scope.
Definition: database_ghidra.cc:251
Symbol and Scope objects for the decompiler.
virtual MapIterator end(void) const
Ending iterator to mapped SymbolEntrys.
Definition: database_ghidra.hh:96
virtual int4 getCategorySize(int4 cat) const
Get the number of Symbols in the given category.
Definition: database_ghidra.hh:113
virtual void restoreXml(const Element *el)
Restore this Scope from a <scope> XML tag.
Definition: database_ghidra.hh:111
virtual void retypeSymbol(Symbol *sym, Datatype *ct)
Change the data-type of a Symbol within this Scope.
Definition: database_ghidra.hh:108
virtual string makeNameUnique(const string &nm) const
Produce a version of the given symbol name that won't collide with other names in this Scope.
Definition: database_ghidra.hh:109
A Symbol that labels code internal to a function.
Definition: database.hh:281
A global namespace Scope.
Definition: database_ghidra.hh:127
virtual void clearAttribute(Symbol *sym, uint4 attr)
Clear boolean Varnode properties on a Symbol.
Definition: database.cc:2111
string name
Name of this scope.
Definition: database.hh:414
An implementation of the Architecture interface and connection to a Ghidra client.
Definition: ghidra_arch.hh:60
void lockDefaultProperties(void)
Lock in the default state of the boolean property map.
Definition: database_ghidra.hh:65
virtual string buildVariableName(const Address &addr, const Address &pc, Datatype *ct, int4 &index, uint4 flags) const
Given an address and data-type, build a suitable generic symbol name.
Definition: database.cc:2335
virtual void setAttribute(Symbol *sym, uint4 attr)
Set boolean Varnode properties on a Symbol.
Definition: database_ghidra.hh:75
virtual bool isNameUsed(const string &nm, const Scope *op2) const
Check if the given name is occurs within the given scope path.
Definition: database_ghidra.hh:93
virtual Funcdata * resolveExternalRefFunction(ExternRefSymbol *sym) const
Convert an external reference to the referenced function.
Definition: database_ghidra.cc:356
virtual void removeSymbol(Symbol *symbol)
Remove the given Symbol from this Scope.
Definition: database_ghidra.hh:106
virtual LabSymbol * findCodeLabel(const Address &addr) const
Find a label Symbol at the given address.
Definition: database_ghidra.cc:337
virtual string buildUndefinedName(void) const
Build a formal undefined name, used internally when a Symbol is not given a name.
Definition: database.cc:2421
virtual void findByName(const string &name, vector< Symbol * > &res) const
Find a Symbol by name within this Scope.
Definition: database_ghidra.hh:92
Database * symboltab
Memory map of global variables and functions.
Definition: architecture.hh:140
The base class for a symbol in a symbol table or scope.
Definition: database.hh:152
virtual list< SymbolEntry >::const_iterator beginDynamic(void) const
Beginning iterator to dynamic SymbolEntrys.
Definition: database_ghidra.hh:97
virtual SymbolEntry * findClosestFit(const Address &addr, int4 size, const Address &usepoint) const
Find Symbol which is the closest fit to the given memory range.
Definition: database_ghidra.hh:83
virtual Symbol * getCategorySymbol(int4 cat, int4 ind) const
Retrieve a Symbol by index within a specific category.
Definition: database_ghidra.hh:114
virtual list< SymbolEntry >::const_iterator endDynamic(void) const
Ending iterator to dynamic SymbolEntrys.
Definition: database_ghidra.hh:98
virtual list< SymbolEntry >::iterator beginDynamic(void)
Beginning iterator to dynamic SymbolEntrys.
Definition: database_ghidra.hh:99