mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
Convert to Scope ids
This commit is contained in:
parent
97b04cac7e
commit
7c0b21f0dc
17 changed files with 394 additions and 327 deletions
|
@ -45,7 +45,15 @@ Funcdata::Funcdata(const string &nm,Scope *scope,const Address &addr,FunctionSym
|
|||
if (nm.size()==0)
|
||||
localmap = (ScopeLocal *)0; // Filled in by restoreXml
|
||||
else {
|
||||
ScopeLocal *newMap = new ScopeLocal(stackid,this,glb);
|
||||
uint8 id;
|
||||
if (sym != (FunctionSymbol *)0)
|
||||
id = sym->getId();
|
||||
else {
|
||||
// Missing a symbol, build unique id based on address
|
||||
id = 0x57AB12CD;
|
||||
id = (id << 32) | (addr.getOffset() & 0xffffffff);
|
||||
}
|
||||
ScopeLocal *newMap = new ScopeLocal(id,stackid,this,glb);
|
||||
glb->symboltab->attachScope(newMap,scope); // This may throw and delete newMap
|
||||
localmap = newMap;
|
||||
funcp.setScope(localmap,baseaddr+ -1);
|
||||
|
@ -735,7 +743,7 @@ uint8 Funcdata::restoreXml(const Element *el)
|
|||
if ((*iter)->getName() == "localdb") {
|
||||
if (localmap != (ScopeLocal *)0)
|
||||
throw LowlevelError("Pre-existing local scope when restoring: "+name);
|
||||
ScopeLocal *newMap = new ScopeLocal(stackid,this,glb);
|
||||
ScopeLocal *newMap = new ScopeLocal(id,stackid,this,glb);
|
||||
glb->symboltab->restoreXmlScope(*iter,newMap); // May delete newMap and throw
|
||||
localmap = newMap;
|
||||
}
|
||||
|
@ -750,7 +758,7 @@ uint8 Funcdata::restoreXml(const Element *el)
|
|||
else if ((*iter)->getName() == "prototype") {
|
||||
if (localmap == (ScopeLocal *)0) {
|
||||
// If we haven't seen a <localdb> tag yet, assume we have a default local scope
|
||||
ScopeLocal *newMap = new ScopeLocal(stackid,this,glb);
|
||||
ScopeLocal *newMap = new ScopeLocal(id,stackid,this,glb);
|
||||
Scope *scope = glb->symboltab->getGlobalScope();
|
||||
glb->symboltab->attachScope(newMap,scope); // May delete newMap and throw
|
||||
localmap = newMap;
|
||||
|
@ -763,7 +771,7 @@ uint8 Funcdata::restoreXml(const Element *el)
|
|||
}
|
||||
if (localmap == (ScopeLocal *)0) { // Seen neither <localdb> or <prototype>
|
||||
// This is a function shell, so we provide default locals
|
||||
ScopeLocal *newMap = new ScopeLocal(stackid,this,glb);
|
||||
ScopeLocal *newMap = new ScopeLocal(id,stackid,this,glb);
|
||||
Scope *scope = glb->symboltab->getGlobalScope();
|
||||
glb->symboltab->attachScope(newMap,scope); // May delete newMap and throw
|
||||
localmap = newMap;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue