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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
/* libxelf - elf_dump.h - human representation of ELF files include file
*
* by scut / teso
*/
#ifndef ELF_DUMP_H
#define ELF_DUMP_H
#include <elf_file.h>
typedef struct {
int value;
char * name;
} dump_elem;
typedef struct {
char * elem_name; /* struct elem name */
char * type; /* type, a/w/o, h, m */
unsigned long int advance; /* how many bytes */
unsigned long int data_val; /* optional: value */
dump_elem * data_tab; /* optional: decode table */
} dump_header;
/* elf_dump_header
*
* dump the Elf32_Ehdr structure of ELF file `elf'
*
* return in any case
*/
void
elf_dump_header (elf_file *elf);
/* elf_dump_phtab
*
* dump the program header table of ELF file `elf'
*
* return in any case
*/
void
elf_dump_phtab (elf_file *elf);
/* elf_dump_shtab
*
* dump the section header table of ELF file `elf'
*
* return in any case
*/
void
elf_dump_shtab (elf_file *elf);
/* elf_dump_desc
*
* dump using dump_header description table `desc', for file `elf', start at
* `src', not exceeding `len' bytes
*
* return in any case
*/
void
elf_dump_desc (elf_file *elf, dump_header *desc, unsigned char *src,
unsigned long int len);
/* elf_dump_print
*
* dump an ELF structure entry associated with file `elf'. dump accordingly
* to the format string `format'. `formatparam' may be an extra parameter to
* the format. `entname' is the symbolic structure name, `val' the pointer to
* the value.
*
* return in any case
*
* `format' is:
* h = Elf32_Half
* m = memory (just dump)
* a/o/w = Elf32_(Addr|Off|Word)
* i = ignore, just advance
* h and w can be prepended with "f", then formatparam denotes a flagtable.
* on "m" formatparam contains the number of bytes to dump. every other case
* can have NULL as formatparam. if it has non-NULL symbols are looked up
* through it.
* everything can be prepended with "s", which shortens output as much as
* possible, also omitting a newline
*/
void
elf_dump_print (elf_file *elf, char *format, void *formatparam, char *entname,
unsigned char *val);
/* elf_dump_tablookup
*
* lookup a small integer `val' to its symbolic representation using `table'
*
* return static string
*/
char *
elf_dump_tablookup (dump_elem *tab, unsigned long int val);
#endif
|