Package org.eclipse.cdt.utils.elf
Class Elf
java.lang.Object
org.eclipse.cdt.utils.elf.Elf
- All Implemented Interfaces:
AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclassstatic classException indicating thatElf.ELFhdr.ELFCLASSNONEheader is read.classclassclassclass -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ERandomAccessFileprotected Elf.ELFhdrstatic final intstatic final intstatic final intstatic final intprotected Stringprotected Stringprotected byte[]protected Elf.Section[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voiddispose()protected voidfinalize()Make sure we do not leak the fds.static Elf.AttributegetAttributes(byte[] array) static Elf.AttributegetAttributes(String file) getDynamicSections(Elf.Section section) Elf.PHdr[]getPHdrs()getSectionByName(String name) getSections(int type) Creates a new symbol reader instance on each call.static booleanisElfHeader(byte[] e_ident) voidstatic longmakeUnsignedLong(byte[] val, int offset, boolean isle) protected longprotected Stringstring_from_elf_section(Elf.Section section, int index) org.eclipse.cdt.utils.elf.Elf.ElfSectionIteratorsymbolIterator(Elf.Section section) Get a symbol iterator
-
Field Details
-
ELF32_ADDR_SIZE
public static final int ELF32_ADDR_SIZE- See Also:
-
ELF32_OFF_SIZE
public static final int ELF32_OFF_SIZE- See Also:
-
ELF64_ADDR_SIZE
public static final int ELF64_ADDR_SIZE- See Also:
-
ELF64_OFF_SIZE
public static final int ELF64_OFF_SIZE- See Also:
-
efile
-
ehdr
-
sections
-
file
-
section_strtab
protected byte[] section_strtab -
EMPTY_STRING
-
-
Constructor Details
-
Elf
protected Elf() -
Elf
- Throws:
IOException
-
Elf
- Throws:
IOException
-
-
Method Details
-
string_from_elf_section
- Throws:
IOException
-
getPHdrs
- Throws:
IOException
-
getDynamicSections
- Throws:
IOException
-
getELFhdr
- Throws:
IOException
-
getAttributes
- Throws:
IOException
-
getAttributes
- Throws:
IOException
-
getAttributes
- Throws:
IOException
-
isElfHeader
public static boolean isElfHeader(byte[] e_ident) -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
dispose
public void dispose() -
finalize
Make sure we do not leak the fds. -
getSectionByName
- Throws:
IOException
-
getSections
- Throws:
IOException
-
getSections
- Throws:
Elf.ElfClassNoneException- ifElf.ELFhdr.ELFCLASSNONEheader is readIOException
-
symbolIterator
public org.eclipse.cdt.utils.elf.Elf.ElfSectionIterator symbolIterator(Elf.Section section) throws IOException Get a symbol iterator- Parameters:
section- the section to iterate over- Returns:
- an iterator that returns symbols of a given section
- Throws:
IOException- If the file is corrupt- Since:
- 7.0
-
loadSymbols
- Throws:
IOException
-
getSymbols
-
getDynamicSymbols
-
getSymtabSymbols
-
getSymbol
-
getFilename
-
readUnsignedLong
- Throws:
IOException
-
getSymbolReader
Creates a new symbol reader instance on each call. Caller is responsible for closing the symbol reader- Returns:
- symbol reader or
nullif couldn't create symbol reader
-
makeUnsignedLong
- Throws:
IOException- Since:
- 5.4
-