mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
GP-2717 Symbol attached to variable declarations
This commit is contained in:
parent
b4de95f4f5
commit
a5ba9e390c
27 changed files with 315 additions and 219 deletions
|
@ -111,7 +111,8 @@ public class HighConstant extends HighVariable {
|
|||
symbol = globalMap.populateSymbol(symref, null, -1);
|
||||
if (symbol == null) {
|
||||
PcodeOp op = ((VarnodeAST) represent).getLoneDescend();
|
||||
Address addr = HighFunctionDBUtil.getSpacebaseReferenceAddress(program, op);
|
||||
Address addr = HighFunctionDBUtil
|
||||
.getSpacebaseReferenceAddress(program.getAddressFactory(), op);
|
||||
if (addr != null) {
|
||||
Data data = program.getListing().getDataAt(addr);
|
||||
DataType dt = data == null ? DataType.DEFAULT : data.getDataType();
|
||||
|
|
|
@ -734,11 +734,11 @@ public class HighFunctionDBUtil {
|
|||
* Get the Address referred to by a spacebase reference. Address-of references are encoded in
|
||||
* the p-code syntax tree as: {@code vn = PTRSUB(<spacebase>, #const)}. This decodes the reference and
|
||||
* returns the Address
|
||||
* @param program is the program containing the Address
|
||||
* @param addrFactory is the factory used to construct the Address
|
||||
* @param op is the PTRSUB op encoding the reference
|
||||
* @return the recovered Address (or null if not correct form)
|
||||
*/
|
||||
public static Address getSpacebaseReferenceAddress(Program program, PcodeOp op) {
|
||||
public static Address getSpacebaseReferenceAddress(AddressFactory addrFactory, PcodeOp op) {
|
||||
Address storageAddress = null;
|
||||
if (op == null) {
|
||||
return storageAddress;
|
||||
|
@ -747,13 +747,13 @@ public class HighFunctionDBUtil {
|
|||
Varnode vnode = op.getInput(0);
|
||||
Varnode cnode = op.getInput(1);
|
||||
if (vnode.isRegister()) {
|
||||
AddressSpace stackspace = program.getAddressFactory().getStackSpace();
|
||||
AddressSpace stackspace = addrFactory.getStackSpace();
|
||||
if (stackspace != null) {
|
||||
storageAddress = stackspace.getAddress(cnode.getOffset());
|
||||
}
|
||||
}
|
||||
else {
|
||||
AddressSpace space = program.getAddressFactory().getDefaultAddressSpace();
|
||||
AddressSpace space = addrFactory.getDefaultAddressSpace();
|
||||
if (space instanceof SegmentedAddressSpace) {
|
||||
// Assume this is a "full" encoding of the offset
|
||||
int innersize = space.getPointerSize();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue