Package org.eclipse.cdt.utils.elf
Class Elf
java.lang.Object
org.eclipse.cdt.utils.elf.Elf
- All Implemented Interfaces:
AutoCloseable
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
class
static class
Exception indicating thatElf.ELFhdr.ELFCLASSNONE
header is read.class
class
class
class
-
Field Summary
Modifier and TypeFieldDescriptionprotected ERandomAccessFile
protected Elf.ELFhdr
static final int
static final int
static final int
static final int
protected String
protected String
protected byte[]
protected Elf.Section[]
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
dispose()
protected void
finalize()
Make sure we do not leak the fds.static Elf.Attribute
getAttributes
(byte[] array) static Elf.Attribute
getAttributes
(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 boolean
isElfHeader
(byte[] e_ident) void
static long
makeUnsignedLong
(byte[] val, int offset, boolean isle) protected long
protected String
string_from_elf_section
(Elf.Section section, int index) org.eclipse.cdt.utils.elf.Elf.ElfSectionIterator
symbolIterator
(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:
close
in 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.ELFCLASSNONE
header 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
null
if couldn't create symbol reader
-
makeUnsignedLong
- Throws:
IOException
- Since:
- 5.4
-