Java Code Examples for ghidra.program.model.address.Address#getPointerSize()
The following examples show how to use
ghidra.program.model.address.Address#getPointerSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DwarfDecoderFactory.java From ghidra with Apache License 2.0 | 6 votes |
@Override public int getDecodeSize(Program program) { AddressSpace defaultAddressSpace = program.getAddressFactory().getDefaultAddressSpace(); Address maxAddress = defaultAddressSpace.getMaxAddress(); int pointerSize = maxAddress.getPointerSize(); switch (pointerSize) { case 3: return 4; // 3 uses 4 bytes case 5: case 6: case 7: return 8; // 5 thru 7 use 8 bytes default: return pointerSize; } }
Example 2
Source File: PseudoData.java From ghidra with Apache License 2.0 | 5 votes |
protected static int computeLength(DataType dataType, Address address) { if (dataType == null) { return 1; } int length = dataType.getLength(); if (length < 1) { if (getBaseDataType(dataType) instanceof Pointer) { length = address.getPointerSize(); } else { length = 1; } } return length; }
Example 3
Source File: DemangledVariable.java From ghidra with Apache License 2.0 | 5 votes |
private boolean createPointer(Program program, Address address, long maximumDataTypeSize) { if (maximumDataTypeSize < address.getPointerSize()) { return false; } PseudoDisassembler pdis = new PseudoDisassembler(program); Address indirectAddress = pdis.getIndirectAddr(address); if (indirectAddress == null) { return false; } if (!program.getMemory().contains(indirectAddress)) { return false; } SymbolTable symbolTable = program.getSymbolTable(); Symbol primarySymbol = symbolTable.getPrimarySymbol(indirectAddress); if (primarySymbol != null && primarySymbol.getSource() != SourceType.DEFAULT) { return createPointer(program, address); } Listing listing = program.getListing(); Data data = listing.getDataAt(indirectAddress); if (data != null && data.isDefined()) { return createPointer(program, address); } return false; }
Example 4
Source File: CreateArrayCmdTest.java From ghidra with Apache License 2.0 | 5 votes |
@Test public void testCreateStructPointerArray() { Address addr = addr(UNDEFINED_AREA); DataType sdt = createStruct(addr); DataType pt = new Pointer32DataType(sdt); int psize = addr.getPointerSize(); createArray(pt, psize); }