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 *createNewScope(
const string &nm,
Scope *par)
const;
46 Scope *reresolveScope(
const vector<string> &path)
const;
47 virtual void addRange(
AddrSpace *spc,uintb first,uintb last);
48 virtual void removeRange(
AddrSpace *spc,uintb first,uintb last) {
49 throw LowlevelError(
"remove_range should not be performed on ghidra scope");
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 {
83 const Address &usepoint)
const {
91 virtual void findByName(
const string &name,vector<Symbol *> &res)
const {
throw LowlevelError(
"findByName unimplemented"); }
virtual Funcdata * resolveExternalRefFunction(ExternRefSymbol *sym) const
Convert an external reference to the referenced function.
Definition: database_ghidra.cc:358
A region where processor data is stored.
Definition: space.hh:73
virtual LabSymbol * findCodeLabel(const Address &addr) const
Find a label Symbol at the given address.
Definition: database_ghidra.cc:339
The base datatype class for the decompiler.
Definition: type.hh:62
virtual MapIterator begin(void) const
Beginning iterator to mapped SymbolEntrys.
Definition: database_ghidra.hh:94
A storage location for a particular Symbol.
Definition: database.hh:51
virtual list< SymbolEntry >::const_iterator beginDynamic(void) const
Beginning iterator to dynamic SymbolEntrys.
Definition: database_ghidra.hh:96
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:82
virtual list< SymbolEntry >::iterator beginDynamic(void)
Beginning iterator to dynamic SymbolEntrys.
Definition: database_ghidra.hh:98
virtual list< SymbolEntry >::const_iterator endDynamic(void) const
Ending iterator to dynamic SymbolEntrys.
Definition: database_ghidra.hh:97
Container for data structures associated with a single function.
Definition: funcdata.hh:45
virtual void clearCategory(int4 cat)
Clear all symbols of the given category from this scope.
Definition: database_ghidra.hh:100
A function Symbol referring to an external location.
Definition: database.hh:296
virtual void findByName(const string &name, vector< Symbol *> &res) const
Find a Symbol by name within this Scope.
Definition: database_ghidra.hh:91
virtual void setCategory(Symbol *sym, int4 cat, int4 ind)
Set the category and index for the given Symbol.
Definition: database_ghidra.hh:114
virtual void removeSymbolMappings(Symbol *symbol)
Remove all SymbolEntrys from the given Symbol.
Definition: database_ghidra.hh:104
ScopeGhidraNamespace(const string &nm, Architecture *g)
Constructor.
Definition: database_ghidra.hh:130
virtual void clearAttribute(Symbol *sym, uint4 attr)
Clear boolean Varnode properties on a Symbol.
Definition: database_ghidra.hh:76
virtual void setAttribute(Symbol *sym, uint4 attr)
Set boolean Varnode properties on a Symbol.
Definition: database.cc:2065
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:388
virtual SymbolEntry * findOverlap(const Address &addr, int4 size) const
Find first Symbol overlapping the given memory range.
Definition: database_ghidra.hh:90
A disjoint set of Ranges, possibly across multiple address spaces.
Definition: address.hh:203
virtual void printEntries(ostream &s) const
Dump a description of all SymbolEntry objects to a stream.
Definition: database_ghidra.hh:111
virtual SymbolEntry * findAddr(const Address &addr, const Address &usepoint) const
Find a Symbol at a given address and usepoint.
Definition: database_ghidra.cc:264
Database * symboltab
Memory map of global variables and functions.
Definition: architecture.hh:136
virtual void saveXml(ostream &s) const
Write out this as a <scope> XML tag.
Definition: database_ghidra.hh:109
An iterator over SymbolEntry objects in multiple address spaces.
Definition: database.hh:330
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:2289
virtual Funcdata * findFunction(const Address &addr) const
Find the function starting at the given address.
Definition: database_ghidra.cc:321
virtual void setDisplayFormat(Symbol *sym, uint4 attr)
Set the display format for a Symbol.
Definition: database.cc:2081
A Symbol that labels code internal to a function.
Definition: database.hh:281
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
virtual list< SymbolEntry >::iterator endDynamic(void)
Ending iterator to dynamic SymbolEntrys.
Definition: database_ghidra.hh:99
virtual void setDisplayFormat(Symbol *sym, uint4 attr)
Set the display format for a Symbol.
Definition: database_ghidra.hh:77
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
ScopeGhidra(ArchitectureGhidra *g)
Constructor.
Definition: database_ghidra.cc:20
virtual void renameSymbol(Symbol *sym, const string &newname)
Rename a Symbol within this Scope.
Definition: database_ghidra.hh:106
virtual void clearUnlocked(void)
Clear all unlocked symbols from this scope.
Definition: database_ghidra.hh:102
virtual ExternRefSymbol * findExternalRef(const Address &addr) const
Find an external reference at the given address.
Definition: database_ghidra.cc:305
virtual int4 getCategorySize(int4 cat) const
Get the number of Symbols in the given category.
Definition: database_ghidra.hh:112
virtual void clearUnlockedCategory(int4 cat)
Clear unlocked symbols of the given category from this scope.
Definition: database_ghidra.hh:101
Manager for all the major decompiler subsystems.
Definition: architecture.hh:117
virtual void restoreXml(const Element *el)
Restore this Scope from a <scope> XML tag.
Definition: database_ghidra.hh:110
virtual void retypeSymbol(Symbol *sym, Datatype *ct)
Change the data-type of a Symbol within this Scope.
Definition: database_ghidra.hh:107
virtual void restrictScope(Funcdata *f)
Convert this to a local Scope.
Definition: database_ghidra.hh:103
The lowest level error generated by the decompiler.
Definition: error.hh:44
virtual bool isNameUsed(const string &name) const
Check if the given name is used within this scope.
Definition: database_ghidra.hh:92
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:284
string name
Name of this scope.
Definition: database.hh:425
An XML element. A node in the DOM tree.
Definition: xml.hh:150
A complete in-memory XML document.
Definition: xml.hh:206
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 clear(void)
Clear all symbols from this scope.
Definition: database_ghidra.cc:253
An in-memory implementation of the Scope interface.
Definition: database.hh:721
virtual MapIterator end(void) const
Ending iterator to mapped SymbolEntrys.
Definition: database_ghidra.hh:95
virtual void clearAttribute(Symbol *sym, uint4 attr)
Clear boolean Varnode properties on a Symbol.
Definition: database.cc:2073
Symbol and Scope objects for the decompiler.
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:108
The base class for a symbol in a symbol table or scope.
Definition: database.hh:153
An implementation of the Scope interface by querying a Ghidra client for Symbol information.
Definition: database_ghidra.hh:35
Ghidra specific architecture information and connection to a Ghidra client.
virtual void setAttribute(Symbol *sym, uint4 attr)
Set boolean Varnode properties on a Symbol.
Definition: database_ghidra.hh:75
virtual Symbol * getCategorySymbol(int4 cat, int4 ind) const
Retrieve a Symbol by index within a specific category.
Definition: database_ghidra.hh:113
An implementation of the Architecture interface and connection to a Ghidra client.
Definition: ghidra_arch.hh:60
A global namespace Scope.
Definition: database_ghidra.hh:126
virtual void removeSymbol(Symbol *symbol)
Remove the given Symbol from this Scope.
Definition: database_ghidra.hh:105
virtual string buildUndefinedName(void) const
Build a formal undefined name, used internally when a Symbol is not given a name. ...
Definition: database.cc:2375
const partmap< Address, uint4 > & getProperties(void) const
Get the entire property map.
Definition: database.hh:867
A collection of Symbol objects within a single (namespace or functional) scope.
Definition: database.hh:413
void lockDefaultProperties(void)
Lock in the default state of the boolean property map.
Definition: database_ghidra.hh:65