ReactOS 0.4.15-dev-8231-g29a56f3
rsym.h
Go to the documentation of this file.
1/* rsym.h */
2
3#pragma once
4#include <typedefs.h>
5#include <pecoff.h>
6
7typedef struct {
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 */
15} FILHDR;
16
17typedef struct {
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 */
28} SCNHDR;
29#pragma pack(push, 4)
30
31typedef struct _SYMBOLFILE_HEADER {
37
38typedef 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 */
45
46/* http://www.math.utah.edu/docs/info/stabs_12.html */
47#define N_GYSM 0x20
48#define N_FNAME 0x22
49#define N_FUN 0x24
50#define N_STSYM 0x26
51#define N_LCSYM 0x28
52#define N_MAIN 0x2A
53#define N_PC 0x30
54#define N_NSYMS 0x32
55#define N_NOMAP 0x34
56#define N_RSYM 0x40
57#define N_M2C 0x42
58#define N_SLINE 0x44
59#define N_DSLINE 0x46
60#define N_BSLINE 0x48
61#define N_BROWS 0x48
62#define N_DEFD 0x4A
63#define N_EHDECL 0x50
64#define N_MOD2 0x50
65#define N_CATCH 0x54
66#define N_SSYM 0x60
67#define N_SO 0x64
68#define N_LSYM 0x80
69#define N_BINCL 0x82
70#define N_SOL 0x84
71#define N_PSYM 0xA0
72#define N_EINCL 0xA2
73#define N_ENTRY 0xA4
74#define N_LBRAC 0xC0
75#define N_EXCL 0xC2
76#define N_SCOPE 0xC4
77#define N_RBRAC 0xE0
78#define N_BCOMM 0xE2
79#define N_ECOMM 0xE4
80#define N_ECOML 0xE8
81#define N_LENG 0xFE
82
83/* COFF symbol table */
84
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 */
88
89#define N_BTMASK (0xf)
90#define N_TMASK (0x30)
91#define N_BTSHFT (4)
92#define N_TSHIFT (2)
93
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 */
99
100#define BTYPE(x) ((x) & N_BTMASK)
101
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))
107
108#define C_EFCN 0xff /* physical end of function */
109#define C_NULL 0
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 */
137
138#pragma pack(push, 1)
139typedef struct _COFF_SYMENT
140{
141 union
142 {
144 struct
145 {
148 }
150 }
153 short e_scnum;
158#pragma pack(pop)
159
160#ifdef TARGET_i386
161typedef ULONG TARGET_ULONG_PTR;
162#else
164#endif
165
166typedef struct _ROSSYM_ENTRY {
172
173#pragma pack(pop)
174
175#define ROUND_UP(N, S) (((N) + (S) - 1) & ~((S) - 1))
176
177extern char*
178convert_path(const char* origpath);
179
180extern void*
181load_file ( const char* file_name, size_t* file_size );
static const CHAR s_name[]
Definition: ShowWindow.c:19
static LPCWSTR file_name
Definition: protocol.c:147
unsigned short USHORT
Definition: pedump.c:61
static unsigned int file_size
Definition: regtests2xml.c:47
char * convert_path(const char *origpath)
Definition: hpp.c:39
struct _STAB_ENTRY * PSTAB_ENTRY
struct _SYMBOLFILE_HEADER * PSYMBOLFILE_HEADER
struct _SYMBOLFILE_HEADER SYMBOLFILE_HEADER
ULONGLONG TARGET_ULONG_PTR
Definition: rsym.h:163
struct _ROSSYM_ENTRY * PROSSYM_ENTRY
struct _ROSSYM_ENTRY ROSSYM_ENTRY
struct _COFF_SYMENT COFF_SYMENT
#define E_SYMNMLEN
Definition: rsym.h:85
struct _COFF_SYMENT * PCOFF_SYMENT
void * load_file(const char *file_name, size_t *file_size)
Definition: rsym_common.c:39
struct _STAB_ENTRY STAB_ENTRY
Definition: rsym.h:7
USHORT f_opthdr
Definition: rsym.h:13
ULONG f_nsyms
Definition: rsym.h:12
USHORT f_magic
Definition: rsym.h:8
USHORT f_nscns
Definition: rsym.h:9
ULONG f_timdat
Definition: rsym.h:10
ULONG f_symptr
Definition: rsym.h:11
USHORT f_flags
Definition: rsym.h:14
Definition: rsym.h:17
ULONG s_scnptr
Definition: rsym.h:22
ULONG s_vaddr
Definition: rsym.h:20
ULONG s_paddr
Definition: rsym.h:19
ULONG s_size
Definition: rsym.h:21
ULONG s_lnnoptr
Definition: rsym.h:24
USHORT s_nlnno
Definition: rsym.h:26
ULONG s_relptr
Definition: rsym.h:23
USHORT s_nreloc
Definition: rsym.h:25
ULONG s_flags
Definition: rsym.h:27
USHORT e_type
Definition: rsym.h:154
ULONG e_value
Definition: rsym.h:152
char e_name[E_SYMNMLEN]
Definition: rsym.h:143
ULONG e_zeroes
Definition: rsym.h:146
UCHAR e_numaux
Definition: rsym.h:156
union _COFF_SYMENT::@5027 e
UCHAR e_sclass
Definition: rsym.h:155
ULONG e_offset
Definition: rsym.h:147
struct _COFF_SYMENT::@5027::@5028 e
short e_scnum
Definition: rsym.h:153
Definition: rossym.h:26
ULONG SourceLine
Definition: rossym.h:30
ULONG FileOffset
Definition: rossym.h:29
TARGET_ULONG_PTR Address
Definition: rsym.h:167
ULONG FunctionOffset
Definition: rossym.h:28
Definition: rsym.h:38
USHORT n_desc
Definition: rsym.h:42
UCHAR n_type
Definition: rsym.h:40
ULONG n_value
Definition: rsym.h:43
ULONG n_strx
Definition: rsym.h:39
UCHAR n_other
Definition: rsym.h:41
ULONG StringsOffset
Definition: rsym.h:34
ULONG StringsLength
Definition: rsym.h:35
ULONG SymbolsOffset
Definition: rsym.h:32
ULONG SymbolsLength
Definition: rsym.h:33
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
unsigned char UCHAR
Definition: xmlstorage.h:181