public interface

ICodeObjectUnit

implements IBinaryUnit
com.pnfsoftware.jeb.core.units.codeobject.ICodeObjectUnit
Known Indirect Subclasses

Class Overview

A common interface for object files that hold machine code such as ELF, PE, or Mach-O.

Code objects are used to store program information, data, and code, at various stages of the program's life - compilation, linkage, execution. Popular loaders include Linux ELF, Microsoft PE/COFF, and Apple Mach-O.

This interface provides a unified representation for such files. Clients (such as the official RCP client) should be aware of this interface and use it to display additional details about the unit - without the unit implementor having to generate documents (although documents may be generated to represent unit-specific bits of data).

All methods return values are "optional".

Summary

Public Methods
abstract long convertFileOffsetToRelativeAddress(long offset)
Convert a file offset to a memory address, relative to the base.
abstract long convertRelativeAddressToFileOffset(long rel)
Convert a memory address (relative to the base) to a file offset.
abstract Collection<? extends ISymbolInformation> getExportedSymbols()
Retrieve the list of exported symbols.
abstract Collection<? extends ISymbolInformation> getImportedSymbols()
Retrieve the list of imported symbols.
abstract ILoaderInformation getLoaderInformation()
Retrieve basic information about the object file.
abstract IVirtualMemory getRawMemoryMappedImage()
Retrieve a raw mapping of the code object.
abstract ISegmentInformation getSection(int i)
abstract int getSectionCount()
abstract Collection<? extends ISegmentInformation> getSections()
Retrieve the list of sections defined in the object file.
abstract Collection<? extends ISegmentInformation> getSections(int wflags, int bflags)
Retrieve a list of sections.
abstract ISegmentInformation getSegment(int i)
abstract int getSegmentCount()
abstract Collection<? extends ISegmentInformation> getSegments()
Retrieve the list of segments defined in the object file.
abstract Collection<? extends ISegmentInformation> getSegments(int wflags, int bflags)
Retrieve a list of segments.
abstract Collection<? extends ISymbolInformation> getSymbols()
abstract Collection<? extends ISymbolInformation> getSymbols(int mustHaveFlags, int mustNotHaveFlags)
abstract Collection<? extends ISegmentInformation> getValidSections()
Retrieve the list of sections that are not marked INVALID.
abstract Collection<? extends ISegmentInformation> getValidSegments()
Retrieve the list of segments that are not marked INVALID.
abstract boolean map(IVirtualMemory mem, long wantedBase, boolean applyRelocations, ILinkInfoProvider linkInfoPrv)
Map this object file onto virtual memory.
[Expand]
Inherited Methods
From interface com.pnfsoftware.jeb.core.IUnitCreator
From interface com.pnfsoftware.jeb.core.IUserDataSupport
From interface com.pnfsoftware.jeb.core.units.IBinaryUnit
From interface com.pnfsoftware.jeb.core.units.IUnit
From interface com.pnfsoftware.jeb.util.events.IEventSource

Public Methods

public abstract long convertFileOffsetToRelativeAddress (long offset)

Convert a file offset to a memory address, relative to the base.

Parameters
offset a file offset
Returns
  • a base-relative memory address, or -1 if unsupported or if the offset does not map to anywhere in memory

public abstract long convertRelativeAddressToFileOffset (long rel)

Convert a memory address (relative to the base) to a file offset.

Parameters
rel the base-relative memory address
Returns
  • a file offset, or -1 if unsupported or if the address does not map to anywhere in the file

public abstract Collection<? extends ISymbolInformation> getExportedSymbols ()

Retrieve the list of exported symbols.

Returns
  • the list (possibly empty) of exported symbols, or null if unsupported

public abstract Collection<? extends ISymbolInformation> getImportedSymbols ()

Retrieve the list of imported symbols.

Returns
  • the list (possibly empty) of imported symbols, or null if unsupported

public abstract ILoaderInformation getLoaderInformation ()

Retrieve basic information about the object file.

Returns
  • the object file information, never null

public abstract IVirtualMemory getRawMemoryMappedImage ()

Retrieve a raw mapping of the code object. No relocations are applied. Do not attempt to modify the returned VM object; it should be considered read-only.

Returns
  • the virtual memory containing the mapped, unresolved code object; null on error or if the code object unit decided to not map the object file

public abstract ISegmentInformation getSection (int i)

public abstract int getSectionCount ()

public abstract Collection<? extends ISegmentInformation> getSections ()

Retrieve the list of sections defined in the object file. Typically, sections are used to point to areas of interest. Sections and segments may overlap.

Returns
  • the list of sections, or null if unsupported

public abstract Collection<? extends ISegmentInformation> getSections (int wflags, int bflags)

Retrieve a list of sections.

Parameters
wflags must-have flags
bflags must-not-have flags

public abstract ISegmentInformation getSegment (int i)

public abstract int getSegmentCount ()

public abstract Collection<? extends ISegmentInformation> getSegments ()

Retrieve the list of segments defined in the object file. Typically, segments are mapped to memory by a code object loader. Segments and sections may overlap.

Returns
  • the list of segments, or null if unsupported

public abstract Collection<? extends ISegmentInformation> getSegments (int wflags, int bflags)

Retrieve a list of segments.

Parameters
wflags must-have flags
bflags must-not-have flags

public abstract Collection<? extends ISymbolInformation> getSymbols ()

public abstract Collection<? extends ISymbolInformation> getSymbols (int mustHaveFlags, int mustNotHaveFlags)

public abstract Collection<? extends ISegmentInformation> getValidSections ()

Retrieve the list of sections that are not marked INVALID.

public abstract Collection<? extends ISegmentInformation> getValidSegments ()

Retrieve the list of segments that are not marked INVALID.

public abstract boolean map (IVirtualMemory mem, long wantedBase, boolean applyRelocations, ILinkInfoProvider linkInfoPrv)

Map this object file onto virtual memory.

Parameters
mem memory image onto which the mapping should be done
wantedBase wanted base; set to -1L to request mapping at the normal base
linkInfoPrv optional
Returns
  • success indicator