-
Notifications
You must be signed in to change notification settings - Fork 0
/
elfmap.h
39 lines (30 loc) · 853 Bytes
/
elfmap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef ELFMAP_H
#define ELFMAP_H
#include <elf.h>
#include <stddef.h> // for size_t
#include <sys/types.h> // for pid_t
typedef struct elf_t {
/** Memory map of executable image.
*/
void *map;
/** Size of memory map.
*/
size_t length;
/** File descriptor associated with memory map.
*/
int fd;
Elf64_Ehdr *header;
Elf64_Shdr *sheader; // array
Elf64_Phdr *pheader; // array
const char *shstrtab;
const char *strtab;
const char *dynstr;
unsigned long plt, plt_size;
Elf64_Shdr *rela_plt, *got_plt;
Elf64_Shdr *symtab, *dynsym;
} elf_t;
void get_elf_info_for_pid(elf_t *elf, pid_t pid);
void get_elf_info_for_file(elf_t *elf, const char *filename);
void parse_elf_info_from_self(elf_t *elf, void *address);
void cleanup_elf_info(elf_t *elf);
#endif