8 USHORT f_magic
; /* magic number */
9 USHORT f_nscns
; /* number of sections */
10 ULONG f_timdat
; /* time & date stamp */
11 ULONG f_symptr
; /* file pointer to symtab */
12 ULONG f_nsyms
; /* number of symtab entries */
13 USHORT f_opthdr
; /* sizeof(optional hdr) */
14 USHORT f_flags
; /* flags */
18 char s_name
[8]; /* section name */
19 ULONG s_paddr
; /* physical address, aliased s_nlib */
20 ULONG s_vaddr
; /* virtual address */
21 ULONG s_size
; /* section size */
22 ULONG s_scnptr
; /* file ptr to raw data for section */
23 ULONG s_relptr
; /* file ptr to relocation */
24 ULONG s_lnnoptr
; /* file ptr to line numbers */
25 USHORT s_nreloc
; /* number of relocation entries */
26 USHORT s_nlnno
; /* number of line number entries */
27 ULONG s_flags
; /* flags */
31 typedef struct _SYMBOLFILE_HEADER
{
36 } SYMBOLFILE_HEADER
, *PSYMBOLFILE_HEADER
;
38 typedef struct _STAB_ENTRY
{
39 ULONG n_strx
; /* index into string table of name */
40 UCHAR n_type
; /* type of symbol */
41 UCHAR n_other
; /* misc info (usually empty) */
42 USHORT n_desc
; /* description field */
43 ULONG n_value
; /* value of symbol */
44 } STAB_ENTRY
, *PSTAB_ENTRY
;
46 /* http://www.math.utah.edu/docs/info/stabs_12.html */
83 /* COFF symbol table */
85 #define E_SYMNMLEN 8 /* # characters in a symbol name */
86 #define E_FILNMLEN 14 /* # characters in a file name */
87 #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
89 #define N_BTMASK (0xf)
90 #define N_TMASK (0x30)
94 /* derived types, in e_type */
95 #define DT_NON (0) /* no derived type */
96 #define DT_PTR (1) /* pointer */
97 #define DT_FCN (2) /* function */
98 #define DT_ARY (3) /* array */
100 #define BTYPE(x) ((x) & N_BTMASK)
102 #define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
103 #define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
104 #define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
105 #define ISTAG(x) ((x)==C_STRTAG||(x)==C_UNTAG||(x)==C_ENTAG)
106 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
108 #define C_EFCN 0xff /* physical end of function */
110 #define C_AUTO 1 /* automatic variable */
111 #define C_EXT 2 /* external symbol */
112 #define C_STAT 3 /* static */
113 #define C_REG 4 /* register variable */
114 #define C_EXTDEF 5 /* external definition */
115 #define C_LABEL 6 /* label */
116 #define C_ULABEL 7 /* undefined label */
117 #define C_MOS 8 /* member of structure */
118 #define C_ARG 9 /* function argument */
119 #define C_STRTAG 10 /* structure tag */
120 #define C_MOU 11 /* member of union */
121 #define C_UNTAG 12 /* union tag */
122 #define C_TPDEF 13 /* type definition */
123 #define C_USTATIC 14 /* undefined static */
124 #define C_ENTAG 15 /* enumeration tag */
125 #define C_MOE 16 /* member of enumeration */
126 #define C_REGPARM 17 /* register parameter */
127 #define C_FIELD 18 /* bit field */
128 #define C_AUTOARG 19 /* auto argument */
129 #define C_LASTENT 20 /* dummy entry (end of block) */
130 #define C_BLOCK 100 /* ".bb" or ".eb" */
131 #define C_FCN 101 /* ".bf" or ".ef" */
132 #define C_EOS 102 /* end of structure */
133 #define C_FILE 103 /* file name */
134 #define C_LINE 104 /* line # reformatted as symbol table entry */
135 #define C_ALIAS 105 /* duplicate tag */
136 #define C_HIDDEN 106 /* ext symbol in dmert public lib */
139 typedef struct _COFF_SYMENT
143 char e_name
[E_SYMNMLEN
];
157 } COFF_SYMENT
, *PCOFF_SYMENT
;
161 typedef ULONG TARGET_ULONG_PTR
;
163 typedef ULONGLONG TARGET_ULONG_PTR
;
166 typedef struct _ROSSYM_ENTRY
{
167 TARGET_ULONG_PTR Address
;
168 ULONG FunctionOffset
;
171 } ROSSYM_ENTRY
, *PROSSYM_ENTRY
;
173 #define ROUND_UP(N, S) (((N) + (S) - 1) & ~((S) - 1))
176 convert_path(const char* origpath
);
179 load_file ( const char* file_name
, size_t* file_size
);