Class AddressFormatter
java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.render.AddressFormatter
A native memory address formatter.
The formatter can generate different types of addresses:
- As an absolute address (always in hexadecimal form)
- As a label (using a
INativeCodeUnit) - As a relative address in hexadecimal/decimal
As an example: loc_400248 -> 400248h -> PC+10h/
PC+16.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCreate an address formatter.AddressFormatter(AddressFormatter.AddressBase base, String pcName, NumberFormatter.HexaNotationType hexNotation) Create an address formatter. -
Method Summary
Modifier and TypeMethodDescriptionformat(int bitsize, long address, IInstructionOperandGeneric opnd) Format an address without a code unit.format(INativeCodeUnit<?> unit, int bitsize, long address, IInstructionOperandGeneric opnd) Format a number using the formatter's current settings.format(INativeCodeUnit<?> unit, int bitsize, long address, IInstructionOperandGeneric opnd, AddressFormatter.AddressBase base) Format an address.getBase()Retrieve the address rendering base.Retrieve the hexadecimal notation style.Retrieve the relative address prefix.voidSet the address rendering base.voidsetHexaNotationType(NumberFormatter.HexaNotationType hexaNotationType) Set the hexadecimal notation style.voidsetRelativePrefix(String relativePrefix) Set the relative address prefix.
-
Constructor Details
-
AddressFormatter
public AddressFormatter()Create an address formatter. -
AddressFormatter
public AddressFormatter(AddressFormatter.AddressBase base, String pcName, NumberFormatter.HexaNotationType hexNotation) Create an address formatter.- Parameters:
base- address rendering basepcName- relative address prefixhexNotation- hexadecimal notation
-
-
Method Details
-
setBase
Set the address rendering base.- Parameters:
base- address rendering base
-
getBase
Retrieve the address rendering base.- Returns:
- address rendering base
-
setRelativePrefix
Set the relative address prefix.- Parameters:
relativePrefix- relative address prefix
-
getRelativePrefix
Retrieve the relative address prefix.- Returns:
- relative address prefix
-
setHexaNotationType
Set the hexadecimal notation style.- Parameters:
hexaNotationType- hexadecimal notation style
-
getHexaNotationType
Retrieve the hexadecimal notation style.- Returns:
- hexadecimal notation style
-
format
public String format(INativeCodeUnit<?> unit, int bitsize, long address, IInstructionOperandGeneric opnd) Format a number using the formatter's current settings.- Parameters:
unit- native code unit used for label resolutionbitsize- address size in bitsaddress- address to formatopnd- operand containing the raw relative value, or null- Returns:
- formatted address
-
format
Format an address without a code unit.- Parameters:
bitsize- address size in bitsaddress- address to formatopnd- operand containing the raw relative value, or null- Returns:
- formatted address
-
format
public String format(INativeCodeUnit<?> unit, int bitsize, long address, IInstructionOperandGeneric opnd, AddressFormatter.AddressBase base) Format an address.- Parameters:
unit- native code unit used for label resolutionbitsize- address size in bitsaddress- address to formatopnd- operand containing the raw relative value, or nullbase- rendering base- Returns:
- formatted address
-