|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lib.dwfl.Elf
public class Elf
This class represents an Elf object.
Field Summary | |
---|---|
private FileDescriptor |
fd
|
private long |
pointer
|
Constructor Summary | |
---|---|
Elf(FileDescriptor fd,
ElfCommand command)
Creates a new elf object |
|
Elf(File file,
ElfCommand command)
Creates a new elf object |
|
Elf(long ptr)
|
Method Summary | |
---|---|
void |
close()
Destroy the external elf file object associated with this object. |
ElfEHeader |
createNewEHeader(int wordSize)
Creates a new Elf Header if none exists |
int |
createNewPHeader(long count)
Creates a new program header table if none exists |
ElfSection |
createNewSection()
Creates a new ElfSection at the end of the table and returns it |
protected int |
elf_cntl(int __cmd)
|
protected int |
elf_flagehdr(int __cmd,
int __flags)
|
protected int |
elf_flagelf(int __cmd,
int __flags)
|
protected int |
elf_flagphdr(int __cmd,
int __flags)
|
private static String |
elf_get_last_error_msg()
|
private static int |
elf_get_last_error_no()
|
protected ElfData |
elf_get_raw_data(long offset,
long size)
|
protected int |
elf_get_version()
|
protected ElfArchiveHeader |
elf_getarhdr()
|
protected long |
elf_getaroff()
|
protected long |
elf_getarsym(long __ptr)
|
protected long |
elf_getbase()
|
protected ElfEHeader |
elf_getehdr()
|
protected String |
elf_getident()
|
protected ElfPHeader |
elf_getphdr(int index)
|
protected long |
elf_getscn(long __index)
|
protected long |
elf_getshnum()
|
protected long |
elf_getshstrndx()
|
protected int |
elf_kind()
|
private void |
elf_newehdr(int wordSize)
|
protected int |
elf_newphdr(long __cnt)
|
protected long |
elf_newscn()
|
protected int |
elf_next()
|
protected long |
elf_nextscn(long __scn)
|
protected long |
elf_offscn(long offset)
|
protected long |
elf_rand(int __offset)
|
protected String |
elf_rawfile(long __ptr)
|
protected String |
elf_strptr(long __index,
long __offset)
|
private void |
elf_update(int cmd)
|
private void |
elf_updatehdr(ElfEHeader header)
|
protected int |
elf_updatephdr(int index,
ElfPHeader header)
|
private static long |
elfBegin(FileDescriptor fd,
ElfCommand cmd)
|
private static void |
elfEnd(long elf)
|
protected void |
finalize()
|
ElfFlags |
flag(ElfCommand command,
ElfFlags flags)
Sets or clears flags in the Elf file |
ElfFlags |
flagEHeader(ElfCommand command,
ElfFlags flags)
Sets or clears flags in the Elf header |
ElfFlags |
flagPHeader(ElfCommand command,
ElfFlags flags)
Sets or clears flags in the Elf program header |
long |
getArchiveElement(int offset)
|
ElfArchiveHeader |
getArchiveHeader()
|
long |
getArchiveOffset()
|
ElfArchiveSymbol |
getArchiveSymbol(long ptr)
|
long |
getBase()
|
int |
getControlDescriptor(ElfCommand command)
|
private static FileDescriptor |
getDescriptor(File file,
ElfCommand command)
|
ElfEHeader |
getEHeader()
|
int |
getElfVersion()
|
String |
getIdentification()
|
ElfKind |
getKind()
|
static String |
getLastErrorMsg()
|
static int |
getLastErrorNo()
|
ElfSection |
getNextSection(ElfSection previous)
|
ElfPHeader |
getPHeader(int index)
|
(package private) long |
getPointer()
|
ElfData |
getRawData(long offset,
long size)
|
String |
getRawFileContents(long ptr)
|
ElfSection |
getSection(long index)
Returns the ElfSection at the provided index |
ElfSection |
getSectionByOffset(int offset)
Returns the ElfSection at the given offset |
long |
getSectionCount()
|
long |
getSHeaderStringTableIndex()
|
String |
getStringAtOffset(long index,
long offset)
Returns the string at the provided offset from the provided index |
ElfCommand |
next()
|
void |
update(ElfCommand command)
Update the Elf descriptor and write the file to disk |
void |
updateEHeader(ElfEHeader header)
Update the ELF header |
int |
updatePHeader(int index,
ElfPHeader header)
Update the program header |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private long pointer
private FileDescriptor fd
Constructor Detail |
---|
Elf(long ptr)
public Elf(File file, ElfCommand command)
file
- The file to create the object fromcommand
- The appropriate ElfCommand
public Elf(FileDescriptor fd, ElfCommand command)
file
- The file to create the object fromcommand
- The appropriate ElfCommand
Method Detail |
---|
public void close()
protected void finalize()
finalize
in class Object
private static FileDescriptor getDescriptor(File file, ElfCommand command)
public ElfCommand next()
public int getElfVersion()
public void update(ElfCommand command)
command
- The ElfCommand
public ElfKind getKind()
public long getBase()
public String getIdentification()
ptr
-
public ElfEHeader getEHeader()
public ElfEHeader createNewEHeader(int wordSize)
public void updateEHeader(ElfEHeader header)
header
- public ElfPHeader getPHeader(int index)
public int updatePHeader(int index, ElfPHeader header)
index
- header
-
public int createNewPHeader(long count)
count
-
public ElfSection getSectionByOffset(int offset)
ElfSection
at the given offset
offset
- The offset to get the header at
public ElfSection getSection(long index)
ElfSection
at the provided index
index
- The index
public ElfSection getNextSection(ElfSection previous)
previous
- The current ElfSection
public ElfSection createNewSection()
public long getSectionCount()
dst
-
public long getSHeaderStringTableIndex()
dst
-
public ElfFlags flag(ElfCommand command, ElfFlags flags)
command
- An ElfCommand
flags
- The flags to set/clear
public ElfFlags flagEHeader(ElfCommand command, ElfFlags flags)
command
- An ElfCommand
flags
- The flags to set/clear
public ElfFlags flagPHeader(ElfCommand command, ElfFlags flags)
command
- An ElfCommand
flags
- The flags to set/clear
public String getStringAtOffset(long index, long offset)
index
- The indexoffset
- The offset from index
e* @return The string at index + offsetpublic ElfArchiveHeader getArchiveHeader()
public long getArchiveOffset()
public long getArchiveElement(int offset)
offset
- The offset to get the archive element from
public ElfArchiveSymbol getArchiveSymbol(long ptr)
ptr
-
public int getControlDescriptor(ElfCommand command)
command
- An ElfCommand
public String getRawFileContents(long ptr)
ptr
-
long getPointer()
public static String getLastErrorMsg()
public static int getLastErrorNo()
public ElfData getRawData(long offset, long size)
private static long elfBegin(FileDescriptor fd, ElfCommand cmd) throws ElfException
ElfException
private static void elfEnd(long elf)
protected int elf_next()
protected int elf_get_version()
private void elf_update(int cmd)
protected int elf_kind()
protected long elf_getbase()
protected String elf_getident()
protected ElfEHeader elf_getehdr()
private void elf_newehdr(int wordSize)
private void elf_updatehdr(ElfEHeader header)
protected ElfPHeader elf_getphdr(int index)
protected int elf_updatephdr(int index, ElfPHeader header)
protected int elf_newphdr(long __cnt)
protected long elf_offscn(long offset)
protected long elf_getscn(long __index)
protected long elf_nextscn(long __scn)
protected long elf_newscn()
protected long elf_getshnum()
protected long elf_getshstrndx()
protected int elf_flagelf(int __cmd, int __flags)
protected int elf_flagehdr(int __cmd, int __flags)
protected int elf_flagphdr(int __cmd, int __flags)
protected String elf_strptr(long __index, long __offset)
protected ElfArchiveHeader elf_getarhdr()
protected long elf_getaroff()
protected long elf_rand(int __offset)
protected long elf_getarsym(long __ptr)
protected int elf_cntl(int __cmd)
protected String elf_rawfile(long __ptr)
private static String elf_get_last_error_msg()
private static int elf_get_last_error_no()
protected ElfData elf_get_raw_data(long offset, long size)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |