ReactOS  0.4.14-dev-358-gbef841c
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 
7 typedef 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 
17 typedef 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(4)
30 
31 typedef struct _SYMBOLFILE_HEADER {
37 
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 */
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(1)
139 typedef struct _COFF_SYMENT
140 {
141  union
142  {
144  struct
145  {
148  }
149  e;
150  }
151  e;
153  short e_scnum;
158 #pragma pack(4)
159 
160 #ifdef TARGET_i386
161 typedef ULONG TARGET_ULONG_PTR;
162 #else
164 #endif
165 
166 typedef struct _ROSSYM_ENTRY {
172 
173 #define ROUND_UP(N, S) (((N) + (S) - 1) & ~((S) - 1))
174 
175 extern char*
176 convert_path(const char* origpath);
177 
178 extern void*
179 load_file ( const char* file_name, size_t* file_size );
ULONG SourceLine
Definition: rossym.h:30
USHORT n_desc
Definition: rsym.h:42
ULONG s_relptr
Definition: rsym.h:23
ULONG e_value
Definition: rsym.h:152
struct _STAB_ENTRY * PSTAB_ENTRY
ULONG s_flags
Definition: rsym.h:27
ULONG f_timdat
Definition: rsym.h:10
ULONG StringsOffset
Definition: rsym.h:34
struct _COFF_SYMENT COFF_SYMENT
Definition: rossym.h:26
char * convert_path(const char *origpath)
Definition: hpp.c:39
struct _SYMBOLFILE_HEADER * PSYMBOLFILE_HEADER
USHORT f_opthdr
Definition: rsym.h:13
UCHAR n_type
Definition: rsym.h:40
UCHAR n_other
Definition: rsym.h:41
struct _ROSSYM_ENTRY ROSSYM_ENTRY
ULONG FileOffset
Definition: rossym.h:29
ULONG e_offset
Definition: rsym.h:147
TARGET_ULONG_PTR Address
Definition: rsym.h:167
ULONG n_value
Definition: rsym.h:43
struct _STAB_ENTRY STAB_ENTRY
ULONG f_symptr
Definition: rsym.h:11
USHORT f_flags
Definition: rsym.h:14
ULONG s_vaddr
Definition: rsym.h:20
USHORT f_magic
Definition: rsym.h:8
USHORT s_nreloc
Definition: rsym.h:25
struct _SYMBOLFILE_HEADER SYMBOLFILE_HEADER
ULONG s_size
Definition: rsym.h:21
ULONG s_lnnoptr
Definition: rsym.h:24
short e_scnum
Definition: rsym.h:153
USHORT f_nscns
Definition: rsym.h:9
struct _ROSSYM_ENTRY * PROSSYM_ENTRY
UCHAR e_numaux
Definition: rsym.h:156
uint64_t ULONGLONG
Definition: typedefs.h:65
UCHAR e_sclass
Definition: rsym.h:155
struct _COFF_SYMENT * PCOFF_SYMENT
USHORT e_type
Definition: rsym.h:154
void * load_file(const char *file_name, size_t *file_size)
Definition: rsym_common.c:39
unsigned char UCHAR
Definition: xmlstorage.h:181
ULONG s_paddr
Definition: rsym.h:19
ULONG s_scnptr
Definition: rsym.h:22
#define E_SYMNMLEN
Definition: rsym.h:85
USHORT s_nlnno
Definition: rsym.h:26
Definition: shared.h:92
ULONG SymbolsOffset
Definition: rsym.h:32
ULONG StringsLength
Definition: rsym.h:35
char e_name[E_SYMNMLEN]
Definition: rsym.h:143
unsigned short USHORT
Definition: pedump.c:61
Definition: rsym.h:17
ULONG e_zeroes
Definition: rsym.h:146
static LPCWSTR file_name
Definition: protocol.c:146
struct _COFF_SYMENT::@4037::@4038 e
ULONGLONG TARGET_ULONG_PTR
Definition: rsym.h:163
ULONG SymbolsLength
Definition: rsym.h:33
ULONG f_nsyms
Definition: rsym.h:12
Definition: rsym.h:7
unsigned int ULONG
Definition: retypes.h:1
ULONG FunctionOffset
Definition: rossym.h:28
#define file_size(inode)
Definition: reiserfs_fs.h:1869
ULONG n_strx
Definition: rsym.h:39