ReactOS 0.4.16-dev-297-gc569aee
dwarf.h
Go to the documentation of this file.
1#include "compat.h"
2
3typedef struct Dwarf Dwarf;
4typedef struct DwarfAttrs DwarfAttrs;
5typedef struct DwarfBlock DwarfBlock;
6typedef struct DwarfBuf DwarfBuf;
7typedef struct DwarfExpr DwarfExpr;
8typedef struct DwarfSym DwarfSym;
9typedef union DwarfVal DwarfVal;
10
11enum
12{
19 TagLabel = 0x0A,
21 TagMember = 0x0D,
28 TagTypedef = 0x16,
31 TagVariant = 0x19,
36 TagModule = 0x1E,
38 TagSetType = 0x20,
48 TagFriend = 0x2A,
69
73 TypeFloat = 0x04,
74 TypeSigned = 0x05,
79
83
84 VisLocal = 0x01,
87
88 VirtNone = 0x00,
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,
106 LangPLI = 0x000F,
107 /* 0x8000-0xFFFF reserved */
108
113
117 /* 0x40-0xFF reserved */
118
119 InNone = 0x00,
120 InInlined = 0x01,
123
126
127 DiscLabel = 0x00,
128 DiscRange = 0x01,
129
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 */
199
201{
204};
205
206/* not for consumer use */
208{
213};
214
216{
217 char *s;
221};
222
224{
227
228 /* whether we have it, along with type */
229 struct {
253 uchar friend;
257 uchar import;
292
302 char* compdir;
316 ulong friend;
320 ulong import;
333 char* name;
337 char* producer;
354};
355
356enum
357{
366{
367 int type;
368 long offset;
371};
372
374{
376
377/* not for consumer use... */
382 int depth;
385};
386
387
388struct _Pe;
389Dwarf *dwarfopen(struct _Pe *elf);
390void dwarfclose(Dwarf*);
393int dwarflookupname(Dwarf*, char*, DwarfSym*);
399int dwarfenum(Dwarf*, DwarfSym*);
401int dwarfnextsymat(Dwarf*, DwarfSym*, int);
402int dwarfpctoline(Dwarf*, ulong, char**, char**, char**, char **, ulong*, ulong*, ulong*);
411int dwarfgetn(DwarfBuf*, uchar*, int);
414
415
417typedef struct DwarfAttr DwarfAttr;
418
420{
423};
424
426{
431 int nattr;
432};
433
434struct _Pe;
435
436struct Dwarf
437{
438 struct _Pe *pe;
439
440 char **reg;
441 int nreg;
452
453 /* little cache */
454 struct {
456 int na;
459};
460
462
464
465extern int dwarf386nregs;
466extern char *dwarf386regs[];
467extern char *dwarf386fp;
468
469#define SYMBOL_SIZE 18
470#define MAXIMUM_DWARF_NAME_SIZE 64
471#define MAXIMUM_COFF_SYMBOL_LENGTH 256
unsigned char uchar
Definition: Unfrag.h:59
UINT32 uint
Definition: types.h:83
unsigned long ulong
Definition: linux.h:275
unsigned long long uvlong
Definition: compat.h:9
int dwarfgetn(DwarfBuf *, uchar *, int)
Definition: dwarfget.c:27
ulong dwarfget128(DwarfBuf *)
Definition: dwarfget.c:152
ulong dwarfget2(DwarfBuf *)
Definition: dwarfget.c:81
int dwarfenumunit(Dwarf *, ulong, DwarfSym *)
Definition: dwarfinfo.c:201
int dwarfgetinfounit(Dwarf *, ulong, DwarfBlock *)
int dwarfpctoline(Dwarf *, ulong, char **, char **, char **, char **, ulong *, ulong *, ulong *)
Definition: dwarfpc.c:48
Dwarf * dwarfopen(struct _Pe *elf)
Definition: dwarfopen.c:16
int dwarflookuptag(Dwarf *, ulong, ulong, DwarfSym *)
Definition: dwarfinfo.c:151
int dwarflookupfn(Dwarf *, ulong, ulong, DwarfSym *)
Definition: dwarfinfo.c:181
char * dwarfgetstring(DwarfBuf *)
Definition: dwarfget.c:54
char * dwarf386fp
ulong dwarfget1(DwarfBuf *)
Definition: dwarfget.c:17
void dwarfclose(Dwarf *)
Definition: dwarfopen.c:57
long dwarfget128s(DwarfBuf *)
Definition: dwarfget.c:197
int dwarfseeksym(Dwarf *, ulong, ulong, DwarfSym *)
Definition: dwarfinfo.c:170
int dwarflookupnameinunit(Dwarf *, ulong, char *, DwarfSym *)
Definition: dwarfinfo.c:125
int dwarflookupsubname(Dwarf *, DwarfSym *, char *, DwarfSym *)
Definition: dwarfinfo.c:140
int dwarfnextsym(Dwarf *, DwarfSym *)
Definition: dwarfinfo.c:250
ulong dwarfgetaddr(DwarfBuf *)
Definition: dwarfget.c:123
@ LangC
Definition: dwarf.h:93
@ TagSetType
Definition: dwarf.h:38
@ TypeAddress
Definition: dwarf.h:70
@ TagNamelist
Definition: dwarf.h:49
@ OpLit0
Definition: dwarf.h:179
@ LangC99
Definition: dwarf.h:103
@ OpConst4s
Definition: dwarf.h:144
@ OpCall4
Definition: dwarf.h:195
@ TagLabel
Definition: dwarf.h:19
@ TagTryDwarfBlock
Definition: dwarf.h:56
@ TagCompileUnit
Definition: dwarf.h:24
@ VirtNone
Definition: dwarf.h:88
@ TagStringType
Definition: dwarf.h:25
@ LangPLI
Definition: dwarf.h:106
@ OpLe
Definition: dwarf.h:176
@ TagStructType
Definition: dwarf.h:26
@ TagVariantPart
Definition: dwarf.h:57
@ TagVariable
Definition: dwarf.h:58
@ TagFormalParameter
Definition: dwarf.h:17
@ TagPtrToMemberType
Definition: dwarf.h:37
@ CallingNocall
Definition: dwarf.h:116
@ LangAda95
Definition: dwarf.h:104
@ OpGt
Definition: dwarf.h:175
@ OpConst4u
Definition: dwarf.h:143
@ LangJava
Definition: dwarf.h:102
@ OpConsts
Definition: dwarf.h:148
@ TypeUnsignedChar
Definition: dwarf.h:77
@ TypeUnsigned
Definition: dwarf.h:76
@ OpConst2u
Definition: dwarf.h:141
@ TypeFloat
Definition: dwarf.h:73
@ OpMul
Definition: dwarf.h:161
@ TagCommonDwarfBlock
Definition: dwarf.h:32
@ TagVolatileType
Definition: dwarf.h:59
@ AccessPublic
Definition: dwarf.h:80
@ TAddress
Definition: dwarf.h:135
@ OpConst8u
Definition: dwarf.h:145
@ TagConstant
Definition: dwarf.h:45
@ OpSwap
Definition: dwarf.h:153
@ DiscRange
Definition: dwarf.h:128
@ OpNeg
Definition: dwarf.h:162
@ TypeSigned
Definition: dwarf.h:74
@ TagTemplateTypeParameter
Definition: dwarf.h:53
@ OpReg0
Definition: dwarf.h:181
@ OpRegx
Definition: dwarf.h:185
@ LangPascal83
Definition: dwarf.h:100
@ TString
Definition: dwarf.h:133
@ TagInterfaceType
Definition: dwarf.h:62
@ LangCplusplus
Definition: dwarf.h:95
@ VisQualified
Definition: dwarf.h:86
@ OpDrop
Definition: dwarf.h:150
@ TagVariant
Definition: dwarf.h:31
@ OpPlus
Definition: dwarf.h:165
@ LangCobol74
Definition: dwarf.h:96
@ OpDup
Definition: dwarf.h:149
@ TagInheritance
Definition: dwarf.h:34
@ TReference
Definition: dwarf.h:130
@ TagImportedUnit
Definition: dwarf.h:67
@ TagDwarfProcedure
Definition: dwarf.h:60
@ TagUnionType
Definition: dwarf.h:29
@ TagNamespace
Definition: dwarf.h:63
@ TConstant
Definition: dwarf.h:132
@ OpCallRef
Definition: dwarf.h:196
@ OpMod
Definition: dwarf.h:160
@ CallingProgram
Definition: dwarf.h:115
@ OpDiv
Definition: dwarf.h:158
@ OpPlusUconst
Definition: dwarf.h:166
@ OpAddr
Definition: dwarf.h:137
@ OpLt
Definition: dwarf.h:177
@ OpXor
Definition: dwarf.h:170
@ TypeSignedChar
Definition: dwarf.h:75
@ TagEnumerationType
Definition: dwarf.h:16
@ OpRot
Definition: dwarf.h:154
@ TagMember
Definition: dwarf.h:21
@ TagLexDwarfBlock
Definition: dwarf.h:20
@ InDeclaredNotInlined
Definition: dwarf.h:121
@ TagPartialUnit
Definition: dwarf.h:66
@ TagCatchDwarfBlock
Definition: dwarf.h:43
@ OpFbreg
Definition: dwarf.h:186
@ AccessProtected
Definition: dwarf.h:81
@ DiscLabel
Definition: dwarf.h:127
@ TagNamelistItem
Definition: dwarf.h:50
@ OpNe
Definition: dwarf.h:178
@ InDeclaredInlined
Definition: dwarf.h:122
@ IdCaseUpper
Definition: dwarf.h:110
@ VirtVirtual
Definition: dwarf.h:89
@ OpBregx
Definition: dwarf.h:187
@ OpEq
Definition: dwarf.h:173
@ IdCaseSensitive
Definition: dwarf.h:109
@ TypeComplexFloat
Definition: dwarf.h:72
@ TagBaseType
Definition: dwarf.h:42
@ TagEntryPoint
Definition: dwarf.h:15
@ OpOr
Definition: dwarf.h:164
@ VisLocal
Definition: dwarf.h:84
@ OpConst1s
Definition: dwarf.h:140
@ TagTypedef
Definition: dwarf.h:28
@ LangFortran90
Definition: dwarf.h:99
@ TypeBoolean
Definition: dwarf.h:71
@ TagPackedType
Definition: dwarf.h:51
@ TagMutableType
Definition: dwarf.h:68
@ OrderRowMajor
Definition: dwarf.h:124
@ OpBreg0
Definition: dwarf.h:183
@ OpNop
Definition: dwarf.h:191
@ TagImportedModule
Definition: dwarf.h:64
@ InNone
Definition: dwarf.h:119
@ TagTemplateValueParameter
Definition: dwarf.h:54
@ OpXderef
Definition: dwarf.h:155
@ LangModula2
Definition: dwarf.h:101
@ OpPiece
Definition: dwarf.h:188
@ OpBra
Definition: dwarf.h:172
@ TagReferenceType
Definition: dwarf.h:23
@ OpMinus
Definition: dwarf.h:159
@ LangCobol85
Definition: dwarf.h:97
@ TagWithStmt
Definition: dwarf.h:40
@ TagConstType
Definition: dwarf.h:44
@ OpAnd
Definition: dwarf.h:157
@ OpXderefSize
Definition: dwarf.h:190
@ IdCaseLower
Definition: dwarf.h:111
@ TypeImaginaryFloat
Definition: dwarf.h:78
@ TagSubprogram
Definition: dwarf.h:52
@ VirtPureVirtual
Definition: dwarf.h:90
@ TagEnumerator
Definition: dwarf.h:46
@ OpConst2s
Definition: dwarf.h:142
@ OpPushObjAddr
Definition: dwarf.h:193
@ OpConstu
Definition: dwarf.h:147
@ OpGe
Definition: dwarf.h:174
@ OpShra
Definition: dwarf.h:169
@ OpPick
Definition: dwarf.h:152
@ TagThrownType
Definition: dwarf.h:55
@ TBlock
Definition: dwarf.h:131
@ TagSubrangeType
Definition: dwarf.h:39
@ TagArrayType
Definition: dwarf.h:13
@ OpConst8s
Definition: dwarf.h:146
@ OpNot
Definition: dwarf.h:163
@ TagInlinedSubroutine
Definition: dwarf.h:35
@ TagFileType
Definition: dwarf.h:47
@ TagClassType
Definition: dwarf.h:14
@ AccessPrivate
Definition: dwarf.h:82
@ OpAbs
Definition: dwarf.h:156
@ TagSubroutineType
Definition: dwarf.h:27
@ OpConst1u
Definition: dwarf.h:139
@ OpDerefSize
Definition: dwarf.h:189
@ TagUnspecifiedParameters
Definition: dwarf.h:30
@ TagUnspecifiedType
Definition: dwarf.h:65
@ OpShr
Definition: dwarf.h:168
@ OpSkip
Definition: dwarf.h:171
@ LangAda83
Definition: dwarf.h:94
@ InInlined
Definition: dwarf.h:120
@ TagAccessDeclaration
Definition: dwarf.h:41
@ LangC89
Definition: dwarf.h:92
@ OpShl
Definition: dwarf.h:167
@ LangFortran95
Definition: dwarf.h:105
@ TagRestrictType
Definition: dwarf.h:61
@ OpOver
Definition: dwarf.h:151
@ IdCaseInsensitive
Definition: dwarf.h:112
@ OpCall2
Definition: dwarf.h:194
@ TagCommonInclusion
Definition: dwarf.h:33
@ TagPointerType
Definition: dwarf.h:22
@ OrderColumnMajor
Definition: dwarf.h:125
@ OpDeref
Definition: dwarf.h:138
@ TFlag
Definition: dwarf.h:134
@ TagImportedDeclaration
Definition: dwarf.h:18
@ CallingNormal
Definition: dwarf.h:114
@ VisExported
Definition: dwarf.h:85
@ TagModule
Definition: dwarf.h:36
@ TagFriend
Definition: dwarf.h:48
@ LangFortran77
Definition: dwarf.h:98
int dwarfenum(Dwarf *, DwarfSym *)
Definition: dwarfinfo.c:241
uchar * dwarfgetnref(DwarfBuf *, ulong)
Definition: dwarfget.c:40
char * dwarf386regs[]
Definition: dwarf386.c:10
int dwarfaddrtounit(Dwarf *, ulong, ulong *)
Definition: dwarfaranges.c:16
int dwarf386nregs
Definition: dwarf386.c:22
int dwarfnextsymat(Dwarf *, DwarfSym *, int)
Definition: dwarfinfo.c:292
@ RuleLocation
Definition: dwarf.h:363
@ RuleRegOff
Definition: dwarf.h:362
@ RuleRegister
Definition: dwarf.h:361
@ RuleSame
Definition: dwarf.h:359
@ RuleCfaOffset
Definition: dwarf.h:360
@ RuleUndef
Definition: dwarf.h:358
ulong dwarfget4(DwarfBuf *)
Definition: dwarfget.c:95
uvlong dwarfget8(DwarfBuf *)
Definition: dwarfget.c:109
int dwarflookupname(Dwarf *, char *, DwarfSym *)
Definition: dwarfpubnames.c:67
int dwarfunwind(Dwarf *, ulong, DwarfExpr *, DwarfExpr *, DwarfExpr *, int)
Definition: dwarfcfa.c:47
DwarfAbbrev * dwarfgetabbrev(Dwarf *, ulong, ulong)
Definition: dwarfabbrev.c:128
int nattr
Definition: dwarf.h:431
ulong num
Definition: dwarf.h:427
ulong tag
Definition: dwarf.h:428
uchar haskids
Definition: dwarf.h:429
DwarfAttr * attr
Definition: dwarf.h:430
ulong form
Definition: dwarf.h:422
ulong name
Definition: dwarf.h:421
uchar haskids
Definition: dwarf.h:226
uchar lowerbound
Definition: dwarf.h:267
uchar bytesize
Definition: dwarf.h:236
uchar containingtype
Definition: dwarf.h:241
struct DwarfAttrs::@4963 have
ulong tag
Definition: dwarf.h:225
uchar isvarparam
Definition: dwarf.h:264
uchar datamemberloc
Definition: dwarf.h:243
uchar returnaddr
Definition: dwarf.h:276
uchar startscope
Definition: dwarf.h:280
uchar macroinfo
Definition: dwarf.h:269
uchar namelistitem
Definition: dwarf.h:271
uchar declline
Definition: dwarf.h:246
uchar defaultvalue
Definition: dwarf.h:247
uchar accessibility
Definition: dwarf.h:231
uchar identifiercase
Definition: dwarf.h:256
uchar addrclass
Definition: dwarf.h:232
char * compdir
Definition: dwarf.h:302
char * producer
Definition: dwarf.h:337
uchar abstractorigin
Definition: dwarf.h:230
uchar isoptional
Definition: dwarf.h:262
uchar stmtlist
Definition: dwarf.h:282
uchar declfile
Definition: dwarf.h:245
uchar priority
Definition: dwarf.h:273
uchar count
Definition: dwarf.h:242
uchar discr
Definition: dwarf.h:248
uchar name
Definition: dwarf.h:270
uchar basetypes
Definition: dwarf.h:233
uchar uselocation
Definition: dwarf.h:287
uchar ordering
Definition: dwarf.h:272
uchar specification
Definition: dwarf.h:279
uchar isdeclaration
Definition: dwarf.h:260
uchar sibling
Definition: dwarf.h:278
uchar vtableelemloc
Definition: dwarf.h:290
uchar type
Definition: dwarf.h:285
uchar entrypc
Definition: dwarf.h:255
uchar visibility
Definition: dwarf.h:289
uchar commonref
Definition: dwarf.h:238
uchar highpc
Definition: dwarf.h:254
uchar constvalue
Definition: dwarf.h:240
uchar isprototyped
Definition: dwarf.h:263
uchar stringlength
Definition: dwarf.h:284
uchar producer
Definition: dwarf.h:274
uchar compdir
Definition: dwarf.h:239
uchar lowpc
Definition: dwarf.h:268
uchar discrvalue
Definition: dwarf.h:250
uchar bitsize
Definition: dwarf.h:235
uchar declcolumn
Definition: dwarf.h:244
uchar isexternal
Definition: dwarf.h:261
uchar bitoffset
Definition: dwarf.h:234
uchar virtuality
Definition: dwarf.h:288
uchar calling
Definition: dwarf.h:237
uchar upperbound
Definition: dwarf.h:286
uchar location
Definition: dwarf.h:266
uchar discrlist
Definition: dwarf.h:249
uchar stridesize
Definition: dwarf.h:283
uchar segment
Definition: dwarf.h:277
uchar encoding
Definition: dwarf.h:251
char * name
Definition: dwarf.h:333
uchar ranges
Definition: dwarf.h:275
uchar framebase
Definition: dwarf.h:252
uchar language
Definition: dwarf.h:265
uchar inlined
Definition: dwarf.h:258
uchar isartificial
Definition: dwarf.h:259
uchar staticlink
Definition: dwarf.h:281
uchar * data
Definition: dwarf.h:202
ulong len
Definition: dwarf.h:203
uint addrsize
Definition: dwarf.h:212
Dwarf * d
Definition: dwarf.h:209
uchar * p
Definition: dwarf.h:210
uchar * ep
Definition: dwarf.h:211
int type
Definition: dwarf.h:367
ulong reg
Definition: dwarf.h:369
DwarfBlock loc
Definition: dwarf.h:370
long offset
Definition: dwarf.h:368
DwarfAttrs attrs
Definition: dwarf.h:375
int allunits
Definition: dwarf.h:383
ulong aoff
Definition: dwarf.h:381
ulong nextunit
Definition: dwarf.h:384
DwarfBuf b
Definition: dwarf.h:378
int depth
Definition: dwarf.h:382
ulong unit
Definition: dwarf.h:379
uint uoff
Definition: dwarf.h:380
Definition: dwarf.h:437
ulong off
Definition: dwarf.h:457
int na
Definition: dwarf.h:456
DwarfBlock aranges
Definition: dwarf.h:444
DwarfBlock line
Definition: dwarf.h:447
DwarfBlock ranges
Definition: dwarf.h:450
DwarfBlock info
Definition: dwarf.h:446
DwarfBlock str
Definition: dwarf.h:451
DwarfBlock pubnames
Definition: dwarf.h:448
struct Dwarf::@4964 acache
struct _Pe * pe
Definition: dwarf.h:438
DwarfAbbrev * a
Definition: dwarf.h:455
int addrsize
Definition: dwarf.h:442
DwarfBlock frame
Definition: dwarf.h:445
char ** reg
Definition: dwarf.h:440
int nreg
Definition: dwarf.h:441
DwarfBlock pubtypes
Definition: dwarf.h:449
DwarfBlock abbrev
Definition: dwarf.h:443
Definition: pe.h:14
char * s
Definition: dwarf.h:217
ulong r
Definition: dwarf.h:219
DwarfBlock b
Definition: dwarf.h:220
ulong c
Definition: dwarf.h:218