TEMU  2
The Terma Emulator
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Loader.h
Go to the documentation of this file.
1 //===-- temu-c/Loader.h - Binary image loading ------------------*- C++ -*-===//
2 //
3 // T-EMU: The Terma Emulator
4 // (c) Terma 2015
5 // Authors: Mattias Holm <maho (at) terma.com>
6 //
7 //===----------------------------------------------------------------------===//
8 #include <stdint.h>
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 
29 TEMU_API int temu_loadImage(void *mem, const char *file);
30 
31 
52 TEMU_API int temu_loadImageAndStartAddr(void *Mem, const char *FileName, uint64_t *StartAddr TEMU_NONNULL);
53 
54 TEMU_API int temu_loadRelocatedImage(void *mem, const char *file, uint64_t pa)
55  __attribute__((deprecated));
56 
69 TEMU_API int temu_loadBinaryImage(void *mem, const char *file, uint64_t pa);
70 
71 typedef void temu_DebugInfoCtxt;
72 typedef void temu_Symtab;
73 
82 TEMU_API int temu_loadElfImage(void *mem, const char *file, uint64_t pa);
83 
94 TEMU_API int temu_loadElfImageAndStartAddr(void *Mem, const char *FileName,
95  uint64_t *StartAddr TEMU_NONNULL);
102 TEMU_API int temu_imageIsELF(const char *file);
103 
104 
116 TEMU_API int temu_loadSymtab(const char *FileName, temu_Symtab **Sym TEMU_NONNULL);
117 
118 
146 TEMU_API void temu_symtabGetFuncName(temu_Symtab *Sym TEMU_NONNULL,
147  const char **LocalFile TEMU_NONNULL,
148  const char **Symbol TEMU_NONNULL,
149  uint64_t Addr);
150 
179 TEMU_API void temu_symtabGetObjName(temu_Symtab *Sym TEMU_NONNULL,
180  const char **LocalFile TEMU_NONNULL,
181  const char **Symbol TEMU_NONNULL,
182  uint64_t Addr);
183 
184 
198  const char *FuncName TEMU_NONNULL,
199  uint64_t *Addr TEMU_NONNULL,
200  uint64_t *Size);
201 
218  const char *FileName TEMU_NONNULL,
219  const char *FuncName TEMU_NONNULL,
220  uint64_t *Addr TEMU_NONNULL,
221  uint64_t *Size TEMU_NONNULL);
222 
237  const char *ObjectName TEMU_NONNULL,
238  uint64_t *Addr TEMU_NONNULL,
239  uint64_t *Size TEMU_NONNULL);
240 
241 
257  const char *FileName TEMU_NONNULL,
258  const char *ObjectName TEMU_NONNULL,
259  uint64_t *Addr TEMU_NONNULL,
260  uint64_t *Size TEMU_NONNULL);
261 
266 TEMU_API void temu_disposeSymtab(temu_Symtab *Sym);
267 
268 
282 TEMU_API int temu_loadDebugInfo(const char *File, temu_DebugInfoCtxt **DICtxt);
283 
289 TEMU_API void temu_disposeDebugInfo(temu_DebugInfoCtxt *DICtxt);
290 
291 TEMU_API int
292 temu_debugGetAddressRange(temu_DebugInfoCtxt *DICtxt,
293  const char *FuncName,
294  uint64_t *Start, uint64_t *End);
295 
296 TEMU_API int
297 temu_debugGetEntryPoint(temu_DebugInfoCtxt *DICtxt,
298  const char *FuncName,
299  uint64_t *Entry);
300 
301 
311 TEMU_API int temu_loadSrecImage(void *mem, const char *file, uint64_t pa);
312 TEMU_API int temu_loadSrecImageAndStartAddr(void *Mem, const char *FileName,
313  uint32_t *StartAddr TEMU_NONNULL);
314 #ifdef __cplusplus
315 }
316 #endif
TEMU_API int temu_loadDebugInfo(const char *File, temu_DebugInfoCtxt **DICtxt)
Loads a debug info context from the given file.
TEMU_API int temu_debugGetEntryPoint(temu_DebugInfoCtxt *DICtxt, const char *FuncName, uint64_t *Entry)
TEMU_API int temu_loadSymtab(const char *FileName, temu_Symtab **Sym TEMU_NONNULL)
Loads the symbol table from a given ELF file.
void temu_DebugInfoCtxt
Definition: Loader.h:71
TEMU_API void temu_disposeDebugInfo(temu_DebugInfoCtxt *DICtxt)
Delete loaded debug info.
TEMU_API void temu_disposeSymtab(temu_Symtab *Sym)
Dispose (deallocate) the symbol table.
TEMU_API void TEMU_API void __attribute__((deprecated))
TEMU_API int temu_loadSrecImageAndStartAddr(void *Mem, const char *FileName, uint32_t *StartAddr TEMU_NONNULL)
TEMU_API int temu_imageIsELF(const char *file)
Return non-zero if file is an ELF file.
TEMU_API int temu_loadBinaryImage(void *mem, const char *file, uint64_t pa)
Loads a raw binary image to the memory object at the given address.
#define TEMU_NONNULL
Definition: Attributes.h:48
TEMU_API void temu_symtabGetFuncName(temu_Symtab *Sym TEMU_NONNULL, const char **LocalFile TEMU_NONNULL, const char **Symbol TEMU_NONNULL, uint64_t Addr)
Get the function name associated with the given address.
TEMU_API int temu_symtabGetLocalObjRange(temu_Symtab *Sym TEMU_NONNULL, const char *FileName TEMU_NONNULL, const char *ObjectName TEMU_NONNULL, uint64_t *Addr TEMU_NONNULL, uint64_t *Size TEMU_NONNULL)
Get the range of a local/static object.
TEMU_API int temu_loadElfImage(void *mem, const char *file, uint64_t pa)
Loads an ELF file without going through filetype detection.
TEMU_API int temu_loadImage(void *mem, const char *file)
Loads a binary image to the memory object.
TEMU_API int temu_symtabGetLocalFuncRange(temu_Symtab *Sym TEMU_NONNULL, const char *FileName TEMU_NONNULL, const char *FuncName TEMU_NONNULL, uint64_t *Addr TEMU_NONNULL, uint64_t *Size TEMU_NONNULL)
Get the range of a local/static function.
TEMU_API int temu_loadImageAndStartAddr(void *Mem, const char *FileName, uint64_t *StartAddr TEMU_NONNULL)
Loads a binary image to the memory object.
TEMU_API int temu_loadElfImageAndStartAddr(void *Mem, const char *FileName, uint64_t *StartAddr TEMU_NONNULL)
Loads an ELF file without going through filetype detection.
TEMU_API int temu_symtabGetGlobalObjRange(temu_Symtab *Sym TEMU_NONNULL, const char *ObjectName TEMU_NONNULL, uint64_t *Addr TEMU_NONNULL, uint64_t *Size TEMU_NONNULL)
Get the range of a global object.
TEMU_API int temu_debugGetAddressRange(temu_DebugInfoCtxt *DICtxt, const char *FuncName, uint64_t *Start, uint64_t *End)
void temu_Symtab
Definition: Loader.h:72
TEMU_API int temu_loadSrecImage(void *mem, const char *file, uint64_t pa)
Loads an SREC file without going through filetype detection.
TEMU_API int temu_symtabGetGlobalFuncRange(temu_Symtab *Sym TEMU_NONNULL, const char *FuncName TEMU_NONNULL, uint64_t *Addr TEMU_NONNULL, uint64_t *Size)
Get the range of a global function.
TEMU_API void temu_symtabGetObjName(temu_Symtab *Sym TEMU_NONNULL, const char **LocalFile TEMU_NONNULL, const char **Symbol TEMU_NONNULL, uint64_t Addr)
Get the object name associated with the given address.
TEMU_API int temu_loadRelocatedImage(void *mem, const char *file, uint64_t pa) __attribute__((deprecated))
#define TEMU_API
Definition: Attributes.h:53