# Interface: com.pnfsoftware.jeb.core.units.codeobject.ICodeObjectUnit

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".

## Method: convertFileOffsetToRelativeAddress
- parameter: `offset`, type: `long`
- return type: `long`

Description: Convert a file offset to a memory address, relative to the base.
parameter: offset: a file offset
return: a base\-relative memory address, or \-1 if unsupported or if the offset does not map to         anywhere in memory

## Method: convertRelativeAddressToFileOffset
- parameter: `rel`, type: `long`
- return type: `long`

Description: Convert a memory address \(relative to the base\) to a file offset.
parameter: rel: the base\-relative memory address
return: a file offset, or \-1 if unsupported or if the address does not map to anywhere in the         file

## Method: getExportedSymbols
- return type: `java.util.Collection<? extends com.pnfsoftware.jeb.core.units.codeobject.ISymbolInformation>`

Description: Retrieve the list of exported symbols.
return: the list \(possibly empty\) of exported symbols, or null if unsupported

## Method: getImportedSymbols
- return type: `java.util.Collection<? extends com.pnfsoftware.jeb.core.units.codeobject.ISymbolInformation>`

Description: Retrieve the list of imported symbols.
return: the list \(possibly empty\) of imported symbols, or null if unsupported

## Method: getLoaderInformation
- return type: `com.pnfsoftware.jeb.core.units.codeobject.ILoaderInformation`

Description: Retrieve basic information about the object file.
return: the object file information, never null

## Method: getRawMemoryMappedImage
- return type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`

Description: 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.
return: 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

## Method: getSection
- parameter: `i`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation`

Description: Retrieve a section by index.
parameter: i: section index
return: the section

## Method: getSectionCount
- return type: `int`

Description: Retrieve the number of sections.
return: section count

## Method: getSections
- return type: `java.util.Collection<? extends com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation>`

Description: 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.
return: the list of sections, or null if unsupported

## Method: getSections
- parameter: `wflags`, type: `int`
- parameter: `bflags`, type: `int`
- return type: `java.util.Collection<? extends com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation>`

Description: Retrieve a list of sections.
parameter: wflags: must\-have flags
parameter: bflags: must\-not\-have flags
return: the matching sections, or null if unsupported

## Method: getSegment
- parameter: `i`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation`

Description: Retrieve a segment by index.
parameter: i: segment index
return: the segment

## Method: getSegmentCount
- return type: `int`

Description: Retrieve the number of segments.
return: segment count

## Method: getSegments
- return type: `java.util.Collection<? extends com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation>`

Description: 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.
return: the list of segments, or null if unsupported

## Method: getSegments
- parameter: `wflags`, type: `int`
- parameter: `bflags`, type: `int`
- return type: `java.util.Collection<? extends com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation>`

Description: Retrieve a list of segments.
parameter: wflags: must\-have flags
parameter: bflags: must\-not\-have flags
return: the matching segments, or null if unsupported

## Method: getSymbols
- return type: `java.util.Collection<? extends com.pnfsoftware.jeb.core.units.codeobject.ISymbolInformation>`

Description: Retrieve the symbols defined in the object file.
return: the symbols, or null if unsupported

## Method: getSymbols
- parameter: `mustHaveFlags`, type: `int`
- parameter: `mustNotHaveFlags`, type: `int`
- return type: `java.util.Collection<? extends com.pnfsoftware.jeb.core.units.codeobject.ISymbolInformation>`

Description: Retrieve symbols filtered by flags.
parameter: mustHaveFlags: mask of flags that must be present
parameter: mustNotHaveFlags: mask of flags that must be absent
return: the matching symbols, or null if unsupported

## Method: getValidSections
- return type: `java.util.Collection<? extends com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation>`

Description: Retrieve the list of sections that are not marked INVALID.
return: the valid sections, or null if unsupported

## Method: getValidSegments
- return type: `java.util.Collection<? extends com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation>`

Description: Retrieve the list of segments that are not marked INVALID.
return: the valid segments, or null if unsupported

## Method: map
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `wantedBase`, type: `long`
- parameter: `applyRelocations`, type: `boolean`
- parameter: `linkInfoPrv`, type: `com.pnfsoftware.jeb.core.units.codeobject.ILinkInfoProvider`
- return type: `boolean`

Description: Map this object file onto virtual memory.
parameter: mem: memory image onto which the mapping should be done
parameter: wantedBase: wanted base; set to \-1L to request mapping at the normal base
parameter: applyRelocations: true to apply relocations after mapping
parameter: linkInfoPrv: optional link information provider
return: success indicator

