ReactOS  0.4.13-dev-1000-gbfea773
dwarf.h
Go to the documentation of this file.
1 #include "compat.h"
2 
3 typedef struct Dwarf Dwarf;
4 typedef struct DwarfAttrs DwarfAttrs;
5 typedef struct DwarfBlock DwarfBlock;
6 typedef struct DwarfBuf DwarfBuf;
7 typedef struct DwarfExpr DwarfExpr;
8 typedef struct DwarfSym DwarfSym;
9 typedef union DwarfVal DwarfVal;
10 
11 enum
12 {
13  TagArrayType = 0x01,
14  TagClassType = 0x02,
15  TagEntryPoint = 0x03,
19  TagLabel = 0x0A,
21  TagMember = 0x0D,
25  TagStringType = 0x12,
26  TagStructType = 0x13,
28  TagTypedef = 0x16,
29  TagUnionType = 0x17,
31  TagVariant = 0x19,
36  TagModule = 0x1E,
38  TagSetType = 0x20,
40  TagWithStmt = 0x22,
42  TagBaseType = 0x24,
44  TagConstType = 0x26,
45  TagConstant = 0x27,
46  TagEnumerator = 0x28,
47  TagFileType = 0x29,
48  TagFriend = 0x2A,
49  TagNamelist = 0x2B,
51  TagPackedType = 0x2D,
52  TagSubprogram = 0x2E,
55  TagThrownType = 0x31,
58  TagVariable = 0x34,
63  TagNamespace = 0x39,
69 
70  TypeAddress = 0x01,
71  TypeBoolean = 0x02,
73  TypeFloat = 0x04,
74  TypeSigned = 0x05,
76  TypeUnsigned = 0x07,
79 
80  AccessPublic = 0x01,
82  AccessPrivate = 0x03,
83 
84  VisLocal = 0x01,
85  VisExported = 0x02,
86  VisQualified = 0x03,
87 
88  VirtNone = 0x00,
89  VirtVirtual = 0x01,
91 
92  LangC89 = 0x0001,
93  LangC = 0x0002,
94  LangAda83 = 0x0003,
95  LangCplusplus = 0x0004,
96  LangCobol74 = 0x0005,
97  LangCobol85 = 0x0006,
98  LangFortran77 = 0x0007,
99  LangFortran90 = 0x0008,
100  LangPascal83 = 0x0009,
101  LangModula2 = 0x000A,
102  LangJava = 0x000B,
103  LangC99 = 0x000C,
104  LangAda95 = 0x000D,
105  LangFortran95 = 0x000E,
106  LangPLI = 0x000F,
107  /* 0x8000-0xFFFF reserved */
108 
110  IdCaseUpper = 0x01,
111  IdCaseLower = 0x02,
113 
117  /* 0x40-0xFF reserved */
118 
119  InNone = 0x00,
120  InInlined = 0x01,
123 
126 
127  DiscLabel = 0x00,
128  DiscRange = 0x01,
129 
130  TReference = 1<<0,
131  TBlock = 1<<1,
132  TConstant = 1<<2,
133  TString = 1<<3,
134  TFlag = 1<<4,
135  TAddress = 1<<5,
136 
137  OpAddr = 0x03, /* 1 op, const addr */
138  OpDeref = 0x06,
139  OpConst1u = 0x08, /* 1 op, 1 byte const */
140  OpConst1s = 0x09, /* " signed */
141  OpConst2u = 0x0A, /* 1 op, 2 byte const */
142  OpConst2s = 0x0B, /* " signed */
143  OpConst4u = 0x0C, /* 1 op, 4 byte const */
144  OpConst4s = 0x0D, /* " signed */
145  OpConst8u = 0x0E, /* 1 op, 8 byte const */
146  OpConst8s = 0x0F, /* " signed */
147  OpConstu = 0x10, /* 1 op, LEB128 const */
148  OpConsts = 0x11, /* " signed */
149  OpDup = 0x12,
150  OpDrop = 0x13,
151  OpOver = 0x14,
152  OpPick = 0x15, /* 1 op, 1 byte stack index */
153  OpSwap = 0x16,
154  OpRot = 0x17,
155  OpXderef = 0x18,
156  OpAbs = 0x19,
157  OpAnd = 0x1A,
158  OpDiv = 0x1B,
159  OpMinus = 0x1C,
160  OpMod = 0x1D,
161  OpMul = 0x1E,
162  OpNeg = 0x1F,
163  OpNot = 0x20,
164  OpOr = 0x21,
165  OpPlus = 0x22,
166  OpPlusUconst = 0x23, /* 1 op, ULEB128 addend */
167  OpShl = 0x24,
168  OpShr = 0x25,
169  OpShra = 0x26,
170  OpXor = 0x27,
171  OpSkip = 0x2F, /* 1 op, signed 2-byte constant */
172  OpBra = 0x28, /* 1 op, signed 2-byte constant */
173  OpEq = 0x29,
174  OpGe = 0x2A,
175  OpGt = 0x2B,
176  OpLe = 0x2C,
177  OpLt = 0x2D,
178  OpNe = 0x2E,
179  OpLit0 = 0x30,
180  /* OpLitN = OpLit0 + N for N = 0..31 */
181  OpReg0 = 0x50,
182  /* OpRegN = OpReg0 + N for N = 0..31 */
183  OpBreg0 = 0x70, /* 1 op, signed LEB128 constant */
184  /* OpBregN = OpBreg0 + N for N = 0..31 */
185  OpRegx = 0x90, /* 1 op, ULEB128 register */
186  OpFbreg = 0x91, /* 1 op, SLEB128 offset */
187  OpBregx = 0x92, /* 2 op, ULEB128 reg, SLEB128 off */
188  OpPiece = 0x93, /* 1 op, ULEB128 size of piece */
189  OpDerefSize = 0x94, /* 1-byte size of data retrieved */
190  OpXderefSize = 0x95, /* 1-byte size of data retrieved */
191  OpNop = 0x96,
192  /* next four new in Dwarf v3 */
194  OpCall2 = 0x98, /* 2-byte offset of DIE */
195  OpCall4 = 0x99, /* 4-byte offset of DIE */
196  OpCallRef = 0x9A /* 4- or 8- byte offset of DIE */
197  /* 0xE0-0xFF reserved for user-specific */
198 };
199 
201 {
204 };
205 
206 /* not for consumer use */
207 struct DwarfBuf
208 {
213 };
214 
215 union DwarfVal
216 {
217  char *s;
221 };
222 
224 {
227 
228  /* whether we have it, along with type */
229  struct {
253  uchar friend;
257  uchar import;
291  } have;
292 
302  char* compdir;
316  ulong friend;
320  ulong import;
333  char* name;
337  char* producer;
354 };
355 
356 enum
357 {
364 };
365 struct DwarfExpr
366 {
367  int type;
368  long offset;
371 };
372 
373 struct DwarfSym
374 {
376 
377 /* not for consumer use... */
382  int depth;
383  int allunits;
385 };
386 
387 
388 struct _Pe;
389 Dwarf *dwarfopen(struct _Pe *elf);
390 void dwarfclose(Dwarf*);
393 int dwarflookupname(Dwarf*, char*, DwarfSym*);
394 int dwarflookupnameinunit(Dwarf*, ulong, char*, DwarfSym*);
395 int dwarflookupsubname(Dwarf*, DwarfSym*, char*, DwarfSym*);
399 int dwarfenum(Dwarf*, DwarfSym*);
400 int dwarfnextsym(Dwarf*, DwarfSym*);
401 int dwarfnextsymat(Dwarf*, DwarfSym*, int);
402 int dwarfpctoline(Dwarf*, ulong, char**, char**, char**, char **, ulong*, ulong*, ulong*);
409 long dwarfget128s(DwarfBuf*);
411 int dwarfgetn(DwarfBuf*, uchar*, int);
413 char *dwarfgetstring(DwarfBuf*);
414 
415 
416 typedef struct DwarfAbbrev DwarfAbbrev;
417 typedef struct DwarfAttr DwarfAttr;
418 
419 struct DwarfAttr
420 {
423 };
424 
426 {
431  int nattr;
432 };
433 
434 struct _Pe;
435 
436 struct Dwarf
437 {
438  struct _Pe *pe;
439 
440  char **reg;
441  int nreg;
442  int addrsize;
452 
453  /* little cache */
454  struct {
456  int na;
458  } acache;
459 };
460 
462 
464 
465 extern int dwarf386nregs;
466 extern char *dwarf386regs[];
467 extern char *dwarf386fp;
468 
469 #define SYMBOL_SIZE 18
470 #define MAXIMUM_DWARF_NAME_SIZE 64
471 #define MAXIMUM_COFF_SYMBOL_LENGTH 256
uchar lowpc
Definition: dwarf.h:268
int dwarfgetinfounit(Dwarf *, ulong, DwarfBlock *)
uint addrsize
Definition: dwarf.h:212
uchar visibility
Definition: dwarf.h:289
int dwarfaddrtounit(Dwarf *, ulong, ulong *)
Definition: dwarfaranges.c:17
uchar upperbound
Definition: dwarf.h:286
Definition: dwarf.h:183
uchar identifiercase
Definition: dwarf.h:256
uchar location
Definition: dwarf.h:266
uchar bitoffset
Definition: dwarf.h:234
int dwarfnextsym(Dwarf *, DwarfSym *)
Definition: dwarfinfo.c:251
DwarfBlock info
Definition: dwarf.h:446
Definition: dwarf.h:168
uchar stridesize
Definition: dwarf.h:283
uchar namelistitem
Definition: dwarf.h:271
char * producer
Definition: dwarf.h:337
ulong name
Definition: dwarf.h:421
Definition: dwarf.h:134
Definition: dwarf.h:137
Definition: dwarf.h:170
unsigned char uchar
Definition: Unfrag.h:59
Definition: dwarf.h:161
char * compdir
Definition: dwarf.h:302
uchar language
Definition: dwarf.h:265
int dwarfunwind(Dwarf *, ulong, DwarfExpr *, DwarfExpr *, DwarfExpr *, int)
Definition: dwarfcfa.c:48
DwarfBlock frame
Definition: dwarf.h:445
uchar isexternal
Definition: dwarf.h:261
char * dwarfgetstring(DwarfBuf *)
Definition: dwarfget.c:55
Dwarf * dwarfopen(struct _Pe *elf)
Definition: dwarfopen.c:16
Dwarf * d
Definition: dwarf.h:209
Definition: dwarf.h:92
int dwarf386nregs
Definition: dwarf386.c:22
uchar ordering
Definition: dwarf.h:272
uchar vtableelemloc
Definition: dwarf.h:290
Definition: dwarf.h:174
ulong dwarfget4(DwarfBuf *)
Definition: dwarfget.c:96
uchar * data
Definition: dwarf.h:202
int dwarfnextsymat(Dwarf *, DwarfSym *, int)
Definition: dwarfinfo.c:293
Definition: dwarf.h:93
Definition: dwarf.h:188
Definition: dwarf.h:169
Definition: pe.h:14
Definition: dwarf.h:176
Definition: dwarf.h:157
int dwarflookupsubname(Dwarf *, DwarfSym *, char *, DwarfSym *)
Definition: dwarfinfo.c:141
uchar discr
Definition: dwarf.h:248
uchar declcolumn
Definition: dwarf.h:244
DwarfBlock pubnames
Definition: dwarf.h:448
uchar priority
Definition: dwarf.h:273
DwarfBlock line
Definition: dwarf.h:447
Definition: dwarf.h:149
Definition: dwarf.h:131
uchar declline
Definition: dwarf.h:246
uchar isvarparam
Definition: dwarf.h:264
int nattr
Definition: dwarf.h:431
int dwarflookupname(Dwarf *, char *, DwarfSym *)
Definition: dwarfpubnames.c:67
int dwarfpctoline(Dwarf *, ulong, char **, char **, char **, char **, ulong *, ulong *, ulong *)
Definition: dwarfpc.c:49
uchar isartificial
Definition: dwarf.h:259
uint uoff
Definition: dwarf.h:380
Definition: dwarf.h:159
int dwarfseeksym(Dwarf *, ulong, ulong, DwarfSym *)
Definition: dwarfinfo.c:171
int na
Definition: dwarf.h:456
Definition: dwarf.h:138
uchar type
Definition: dwarf.h:285
ulong tag
Definition: dwarf.h:225
ulong dwarfget1(DwarfBuf *)
Definition: dwarfget.c:18
Definition: dwarf.h:103
Definition: dwarf.h:181
int allunits
Definition: dwarf.h:383
int nreg
Definition: dwarf.h:441
Definition: dwarf.h:106
Definition: dwarf.h:164
uchar compdir
Definition: dwarf.h:239
Definition: dwarf.h:191
ulong unit
Definition: dwarf.h:379
DwarfBlock abbrev
Definition: dwarf.h:443
uchar declfile
Definition: dwarf.h:245
uchar virtuality
Definition: dwarf.h:288
uchar stringlength
Definition: dwarf.h:284
ulong tag
Definition: dwarf.h:428
uchar bitsize
Definition: dwarf.h:235
uchar encoding
Definition: dwarf.h:251
long offset
Definition: dwarf.h:368
Definition: dwarf.h:84
uchar containingtype
Definition: dwarf.h:241
int dwarfenumunit(Dwarf *, ulong, DwarfSym *)
Definition: dwarfinfo.c:202
struct Dwarf::@3965 acache
uchar abstractorigin
Definition: dwarf.h:230
Definition: dwarf.h:151
Definition: dwarf.h:133
Definition: dwarf.h:167
uchar addrclass
Definition: dwarf.h:232
int dwarfenum(Dwarf *, DwarfSym *)
Definition: dwarfinfo.c:242
Definition: dwarf.h:165
uchar haskids
Definition: dwarf.h:226
ulong num
Definition: dwarf.h:427
uchar accessibility
Definition: dwarf.h:231
uchar specification
Definition: dwarf.h:279
int addrsize
Definition: dwarf.h:442
DwarfBlock pubtypes
Definition: dwarf.h:449
DwarfBlock b
Definition: dwarf.h:220
ulong len
Definition: dwarf.h:203
Definition: dwarf.h:178
char * dwarf386regs[]
Definition: dwarf386.c:10
ulong reg
Definition: dwarf.h:369
uchar returnaddr
Definition: dwarf.h:276
Definition: dwarf.h:119
uchar calling
Definition: dwarf.h:237
Definition: dwarf.h:154
uchar * p
Definition: dwarf.h:210
Definition: dwarf.h:185
long dwarfget128s(DwarfBuf *)
Definition: dwarfget.c:198
uchar inlined
Definition: dwarf.h:258
ulong dwarfget2(DwarfBuf *)
Definition: dwarfget.c:82
Definition: dwarf.h:162
ulong c
Definition: dwarf.h:218
uchar stmtlist
Definition: dwarf.h:282
ulong nextunit
Definition: dwarf.h:384
Definition: dwarf.h:88
uchar isprototyped
Definition: dwarf.h:263
uchar lowerbound
Definition: dwarf.h:267
Definition: dwarf.h:194
uchar segment
Definition: dwarf.h:277
uchar bytesize
Definition: dwarf.h:236
uchar constvalue
Definition: dwarf.h:240
unsigned long ulong
Definition: linux.h:275
Definition: dwarf.h:186
uchar entrypc
Definition: dwarf.h:255
Definition: dwarf.h:175
DwarfBuf b
Definition: dwarf.h:378
uchar isdeclaration
Definition: dwarf.h:260
ulong dwarfget128(DwarfBuf *)
Definition: dwarfget.c:153
DwarfBlock ranges
Definition: dwarf.h:450
Definition: dwarf.h:179
Definition: dwarf.h:177
Definition: dwarf.h:173
Definition: dwarf.h:436
uchar datamemberloc
Definition: dwarf.h:243
Definition: dwarf.h:171
Definition: dwarf.h:19
DwarfAttr * attr
Definition: dwarf.h:430
struct _Pe * pe
Definition: dwarf.h:438
DwarfAbbrev * a
Definition: dwarf.h:455
char ** reg
Definition: dwarf.h:440
uchar discrlist
Definition: dwarf.h:249
struct DwarfAttrs::@3964 have
uchar highpc
Definition: dwarf.h:254
int dwarfgetn(DwarfBuf *, uchar *, int)
Definition: dwarfget.c:28
DwarfAbbrev * dwarfgetabbrev(Dwarf *, ulong, ulong)
Definition: dwarfabbrev.c:129
uchar basetypes
Definition: dwarf.h:233
int dwarflookupnameinunit(Dwarf *, ulong, char *, DwarfSym *)
Definition: dwarfinfo.c:126
uchar staticlink
Definition: dwarf.h:281
uchar * ep
Definition: dwarf.h:211
unsigned long long uvlong
Definition: compat.h:9
ulong form
Definition: dwarf.h:422
Definition: dwarf.h:163
uchar * dwarfgetnref(DwarfBuf *, ulong)
Definition: dwarfget.c:41
Definition: dwarf.h:187
Definition: dwarf.h:152
uvlong dwarfget8(DwarfBuf *)
Definition: dwarfget.c:110
int depth
Definition: dwarf.h:382
Definition: dwarf.h:195
char * name
Definition: dwarf.h:333
uchar haskids
Definition: dwarf.h:429
uchar name
Definition: dwarf.h:270
DwarfBlock str
Definition: dwarf.h:451
uchar ranges
Definition: dwarf.h:275
Definition: dwarf.h:153
char * dwarf386fp
int dwarflookupfn(Dwarf *, ulong, ulong, DwarfSym *)
Definition: dwarfinfo.c:182
ulong aoff
Definition: dwarf.h:381
ulong off
Definition: dwarf.h:457
uchar count
Definition: dwarf.h:242
UINT32 uint
Definition: types.h:83
DwarfBlock loc
Definition: dwarf.h:370
Definition: dwarf.h:172
int dwarflookuptag(Dwarf *, ulong, ulong, DwarfSym *)
Definition: dwarfinfo.c:152
Definition: dwarf.h:158
ulong r
Definition: dwarf.h:219
uchar sibling
Definition: dwarf.h:278
char * s
Definition: dwarf.h:217
Definition: dwarf.h:160
uchar isoptional
Definition: dwarf.h:262
void dwarfclose(Dwarf *)
Definition: dwarfopen.c:57
uchar uselocation
Definition: dwarf.h:287
uchar discrvalue
Definition: dwarf.h:250
int type
Definition: dwarf.h:367
uchar framebase
Definition: dwarf.h:252
ulong dwarfgetaddr(DwarfBuf *)
Definition: dwarfget.c:124
DwarfAttrs attrs
Definition: dwarf.h:375
uchar defaultvalue
Definition: dwarf.h:247
uchar startscope
Definition: dwarf.h:280
uchar commonref
Definition: dwarf.h:238
uchar macroinfo
Definition: dwarf.h:269
Definition: dwarf.h:156
DwarfBlock aranges
Definition: dwarf.h:444
Definition: dwarf.h:150
uchar producer
Definition: dwarf.h:274