Return executable information

The exeinfo unit implements some cross-platform routines to examine the contents of an executable: information about sections, mapping addresses to loaded modules etc.

It is mainly used by the lineinfo and lnfodwrf unit to examine the binary for debug info.

Structure describing the binary.

TExeFile is a record used in the various calls of this unit. It contains a file descriptor, and various fields that describe the executable.

The structure of TExeFile is opaque, that is, one shouldn't rely on the exactness of this structure, it may change any time in the future.

File handle to the executable image on disk. Size of the executable Is the file handle f open ? Number of sections in the binary Section header offset Section strings offset. Used on BEOS only Internal variable Image offset Filename of binary file Buffer used in internal read operations Size of internal buffer Number of bytes in the buffer. Open an executable file

OpenExeFile opens the executable file fn and initializes the structure e for subsequent calls to routines in the exeinfo unit.

The function returns True if the file was opened succesfully, false otherwise.

True if the file was opened succesfully, false otherwise. Record to be used in other calls in this unit. Name of file to be opened. Find a section in the binary image.

FindExeSection examines the binary that was opened with (represented by e) and searches for the section named secname. If found, the section offset is returned in secofs and the section length (in bytes) is returned in seclen.

The function returns True if the section was found, False if not.

True if the section was found, False if not Record representing the opened executable image Name of section that must be found Offset of the section in the binary image. Length of the section in bytes. Close a previously opened file.

CloseExeFile closes an executable file image previously opened with , and represented by e.

The function returns True if the file was closed succesfully, or False if something went wrong.

In case of an error, False is returned.
True if the file was closed succesfully, False if not. Executable to be closed Read the location of a debug info filename

ReadDebugLink examines the .gnu_debuglink section to see if the debug information is stored in an external file. If so, then the name of the file with the debug information is returned in the dbgfn parameter.

The function returns false if there is no external debug information file, or if the file with debug information does not exist. It is searched next to the binary file or in the current directory.

True if the file with debug information was found, False if not. Handle on the open application binary. Name of the file with the debug information. Return the module name by address GetModuleByAddr returns the name of the module that contains address addr. If succesful, it returns True and returns the filename in FileName and the base address at which it is loaded in BaseAddr. Address to examine Base address at which module is loaded. FileName of the module at address addr.