ReactOS  0.4.14-dev-1338-g0d187f7
dwarf.h File Reference
#include "compat.h"
Include dependency graph for dwarf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  DwarfBlock
 
struct  DwarfParam
 
struct  DwarfBuf
 
union  DwarfVal
 
struct  DwarfAttrs
 
struct  DwarfExpr
 
struct  DwarfSym
 
struct  DwarfAttr
 
struct  DwarfAbbrev
 
struct  Dwarf
 
struct  DwarfStack
 

Macros

#define MAXIMUM_DWARF_NAME_SIZE   64
 

Typedefs

typedef struct Dwarf Dwarf
 
typedef struct DwarfAttrs DwarfAttrs
 
typedef struct DwarfBlock DwarfBlock
 
typedef struct DwarfBuf DwarfBuf
 
typedef struct DwarfExpr DwarfExpr
 
typedef struct DwarfSym DwarfSym
 
typedef struct DwarfStack DwarfStack
 
typedef struct DwarfParam DwarfParam
 
typedef union DwarfVal DwarfVal
 
typedef struct DwarfAbbrev DwarfAbbrev
 
typedef struct DwarfAttr DwarfAttr
 

Enumerations

enum  {
  TagArrayType = 0x01, TagClassType = 0x02, TagEntryPoint = 0x03, TagEnumerationType = 0x04,
  TagFormalParameter = 0x05, TagImportedDeclaration = 0x08, TagLabel = 0x0A, TagLexDwarfBlock = 0x0B,
  TagMember = 0x0D, TagPointerType = 0x0F, TagReferenceType = 0x10, TagCompileUnit = 0x11,
  TagStringType = 0x12, TagStructType = 0x13, TagSubroutineType = 0x15, TagTypedef = 0x16,
  TagUnionType = 0x17, TagUnspecifiedParameters = 0x18, TagVariant = 0x19, TagCommonDwarfBlock = 0x1A,
  TagCommonInclusion = 0x1B, TagInheritance = 0x1C, TagInlinedSubroutine = 0x1D, TagModule = 0x1E,
  TagPtrToMemberType = 0x1F, TagSetType = 0x20, TagSubrangeType = 0x21, TagWithStmt = 0x22,
  TagAccessDeclaration = 0x23, TagBaseType = 0x24, TagCatchDwarfBlock = 0x25, TagConstType = 0x26,
  TagConstant = 0x27, TagEnumerator = 0x28, TagFileType = 0x29, TagFriend = 0x2A,
  TagNamelist = 0x2B, TagNamelistItem = 0x2C, TagPackedType = 0x2D, TagSubprogram = 0x2E,
  TagTemplateTypeParameter = 0x2F, TagTemplateValueParameter = 0x30, TagThrownType = 0x31, TagTryDwarfBlock = 0x32,
  TagVariantPart = 0x33, TagVariable = 0x34, TagVolatileType = 0x35, TagDwarfProcedure = 0x36,
  TagRestrictType = 0x37, TagInterfaceType = 0x38, TagNamespace = 0x39, TagImportedModule = 0x3A,
  TagUnspecifiedType = 0x3B, TagPartialUnit = 0x3C, TagImportedUnit = 0x3D, TagMutableType = 0x3E,
  TypeAddress = 0x01, TypeBoolean = 0x02, TypeComplexFloat = 0x03, TypeFloat = 0x04,
  TypeSigned = 0x05, TypeSignedChar = 0x06, TypeUnsigned = 0x07, TypeUnsignedChar = 0x08,
  TypeImaginaryFloat = 0x09, AccessPublic = 0x01, AccessProtected = 0x02, AccessPrivate = 0x03,
  VisLocal = 0x01, VisExported = 0x02, VisQualified = 0x03, VirtNone = 0x00,
  VirtVirtual = 0x01, VirtPureVirtual = 0x02, LangC89 = 0x0001, LangC = 0x0002,
  LangAda83 = 0x0003, LangCplusplus = 0x0004, LangCobol74 = 0x0005, LangCobol85 = 0x0006,
  LangFortran77 = 0x0007, LangFortran90 = 0x0008, LangPascal83 = 0x0009, LangModula2 = 0x000A,
  LangJava = 0x000B, LangC99 = 0x000C, LangAda95 = 0x000D, LangFortran95 = 0x000E,
  LangPLI = 0x000F, IdCaseSensitive = 0x00, IdCaseUpper = 0x01, IdCaseLower = 0x02,
  IdCaseInsensitive = 0x03, CallingNormal = 0x01, CallingProgram = 0x02, CallingNocall = 0x03,
  InNone = 0x00, InInlined = 0x01, InDeclaredNotInlined = 0x02, InDeclaredInlined = 0x03,
  OrderRowMajor = 0x00, OrderColumnMajor = 0x01, DiscLabel = 0x00, DiscRange = 0x01,
  TReference = 1<<0, TBlock = 1<<1, TConstant = 1<<2, TString = 1<<3,
  TFlag = 1<<4, TAddress = 1<<5, OpAddr = 0x03, OpDeref = 0x06,
  OpConst1u = 0x08, OpConst1s = 0x09, OpConst2u = 0x0A, OpConst2s = 0x0B,
  OpConst4u = 0x0C, OpConst4s = 0x0D, OpConst8u = 0x0E, OpConst8s = 0x0F,
  OpConstu = 0x10, OpConsts = 0x11, OpDup = 0x12, OpDrop = 0x13,
  OpOver = 0x14, OpPick = 0x15, OpSwap = 0x16, OpRot = 0x17,
  OpXderef = 0x18, OpAbs = 0x19, OpAnd = 0x1A, OpDiv = 0x1B,
  OpMinus = 0x1C, OpMod = 0x1D, OpMul = 0x1E, OpNeg = 0x1F,
  OpNot = 0x20, OpOr = 0x21, OpPlus = 0x22, OpPlusUconst = 0x23,
  OpShl = 0x24, OpShr = 0x25, OpShra = 0x26, OpXor = 0x27,
  OpSkip = 0x2F, OpBra = 0x28, OpEq = 0x29, OpGe = 0x2A,
  OpGt = 0x2B, OpLe = 0x2C, OpLt = 0x2D, OpNe = 0x2E,
  OpLit0 = 0x30, OpReg0 = 0x50, OpBreg0 = 0x70, OpRegx = 0x90,
  OpFbreg = 0x91, OpBregx = 0x92, OpPiece = 0x93, OpDerefSize = 0x94,
  OpXderefSize = 0x95, OpNop = 0x96, OpPushObjAddr = 0x97, OpCall2 = 0x98,
  OpCall4 = 0x99, OpCallRef = 0x9A
}
 
enum  {
  RuleUndef, RuleSame, RuleCfaOffset, RuleRegister,
  RuleRegOff, RuleLocation
}
 

Functions

Dwarfdwarfopen (struct _Pe *elf)
 
void dwarfclose (Dwarf *)
 
int dwarfaddrtounit (Dwarf *, ulong, ulong *)
 
int dwarflookupfn (Dwarf *, ulong, ulong, DwarfSym *)
 
int dwarflookupname (Dwarf *, char *, DwarfSym *)
 
int dwarflookupnameinunit (Dwarf *, ulong, char *, DwarfSym *)
 
int dwarflookupsubname (Dwarf *, DwarfSym *, char *, DwarfSym *)
 
int dwarflookuptag (Dwarf *, ulong, ulong, DwarfSym *)
 
int dwarfenumunit (Dwarf *, ulong, DwarfSym *)
 
int dwarfseeksym (Dwarf *, ulong, ulong, DwarfSym *)
 
int dwarfenum (Dwarf *, DwarfSym *)
 
int dwarfnextsym (Dwarf *, DwarfSym *)
 
int dwarfnextsymat (Dwarf *, DwarfSym *parent, DwarfSym *child)
 
int dwarfpctoline (Dwarf *, DwarfSym *proc, ulong, char **, char **, ulong *)
 
int dwarfgetarg (Dwarf *d, const char *name, DwarfBuf *locbuf, ulong cfa, PROSSYM_REGISTERS registers, ulong *value)
 
int dwarfgettype (Dwarf *d, DwarfSym *param, DwarfSym *type)
 
ulong dwarfget1 (DwarfBuf *)
 
ulong dwarfget2 (DwarfBuf *)
 
ulong dwarfget4 (DwarfBuf *)
 
uvlong dwarfget8 (DwarfBuf *)
 
ulong dwarfget128 (DwarfBuf *)
 
long dwarfget128s (DwarfBuf *)
 
ulong dwarfgetaddr (DwarfBuf *)
 
int dwarfgetn (DwarfBuf *, uchar *, int)
 
uchardwarfgetnref (DwarfBuf *, ulong)
 
chardwarfgetstring (DwarfBuf *)
 
int dwarfcomputecfa (Dwarf *d, DwarfExpr *cfa, PROSSYM_REGISTERS registers, ulong *cfaLocation)
 
int dwarfregunwind (Dwarf *d, ulong pc, ulong fde, DwarfExpr *cfa, PROSSYM_REGISTERS registers)
 
int dwarfargvalue (Dwarf *d, DwarfSym *proc, ulong pc, ulong cfa, PROSSYM_REGISTERS registers, DwarfParam *parameters)
 
int dwarfgetparams (Dwarf *d, DwarfSym *s, ulong pc, int pnum, DwarfParam *paramblocks)
 
DwarfAbbrevdwarfgetabbrev (Dwarf *, ulong, ulong)
 
int dwarfgetinfounit (Dwarf *, ulong, DwarfBlock *)
 
void dwarfdumpsym (Dwarf *d, DwarfSym *s)
 

Macro Definition Documentation

◆ MAXIMUM_DWARF_NAME_SIZE

#define MAXIMUM_DWARF_NAME_SIZE   64

Definition at line 488 of file dwarf.h.

Typedef Documentation

◆ Dwarf

typedef struct Dwarf Dwarf

Definition at line 3 of file dwarf.h.

◆ DwarfAbbrev

Definition at line 430 of file dwarf.h.

◆ DwarfAttr

Definition at line 431 of file dwarf.h.

◆ DwarfAttrs

Definition at line 4 of file dwarf.h.

◆ DwarfBlock

Definition at line 5 of file dwarf.h.

◆ DwarfBuf

Definition at line 6 of file dwarf.h.

◆ DwarfExpr

Definition at line 7 of file dwarf.h.

◆ DwarfParam

Definition at line 10 of file dwarf.h.

◆ DwarfStack

Definition at line 9 of file dwarf.h.

◆ DwarfSym

Definition at line 8 of file dwarf.h.

◆ DwarfVal

typedef union DwarfVal DwarfVal

Definition at line 11 of file dwarf.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
TagArrayType 
TagClassType 
TagEntryPoint 
TagEnumerationType 
TagFormalParameter 
TagImportedDeclaration 
TagLabel 
TagLexDwarfBlock 
TagMember 
TagPointerType 
TagReferenceType 
TagCompileUnit 
TagStringType 
TagStructType 
TagSubroutineType 
TagTypedef 
TagUnionType 
TagUnspecifiedParameters 
TagVariant 
TagCommonDwarfBlock 
TagCommonInclusion 
TagInheritance 
TagInlinedSubroutine 
TagModule 
TagPtrToMemberType 
TagSetType 
TagSubrangeType 
TagWithStmt 
TagAccessDeclaration 
TagBaseType 
TagCatchDwarfBlock 
TagConstType 
TagConstant 
TagEnumerator 
TagFileType 
TagFriend 
TagNamelist 
TagNamelistItem 
TagPackedType 
TagSubprogram 
TagTemplateTypeParameter 
TagTemplateValueParameter 
TagThrownType 
TagTryDwarfBlock 
TagVariantPart 
TagVariable 
TagVolatileType 
TagDwarfProcedure 
TagRestrictType 
TagInterfaceType 
TagNamespace 
TagImportedModule 
TagUnspecifiedType 
TagPartialUnit 
TagImportedUnit 
TagMutableType 
TypeAddress 
TypeBoolean 
TypeComplexFloat 
TypeFloat 
TypeSigned 
TypeSignedChar 
TypeUnsigned 
TypeUnsignedChar 
TypeImaginaryFloat 
AccessPublic 
AccessProtected 
AccessPrivate 
VisLocal 
VisExported 
VisQualified 
VirtNone 
VirtVirtual 
VirtPureVirtual 
LangC89 
LangC 
LangAda83 
LangCplusplus 
LangCobol74 
LangCobol85 
LangFortran77 
LangFortran90 
LangPascal83 
LangModula2 
LangJava 
LangC99 
LangAda95 
LangFortran95 
LangPLI 
IdCaseSensitive 
IdCaseUpper 
IdCaseLower 
IdCaseInsensitive 
CallingNormal 
CallingProgram 
CallingNocall 
InNone 
InInlined 
InDeclaredNotInlined 
InDeclaredInlined 
OrderRowMajor 
OrderColumnMajor 
DiscLabel 
DiscRange 
TReference 
TBlock 
TConstant 
TString 
TFlag 
TAddress 
OpAddr 
OpDeref 
OpConst1u 
OpConst1s 
OpConst2u 
OpConst2s 
OpConst4u 
OpConst4s 
OpConst8u 
OpConst8s 
OpConstu 
OpConsts 
OpDup 
OpDrop 
OpOver 
OpPick 
OpSwap 
OpRot 
OpXderef 
OpAbs 
OpAnd 
OpDiv 
OpMinus 
OpMod 
OpMul 
OpNeg 
OpNot 
OpOr 
OpPlus 
OpPlusUconst 
OpShl 
OpShr 
OpShra 
OpXor 
OpSkip 
OpBra 
OpEq 
OpGe 
OpGt 
OpLe 
OpLt 
OpNe 
OpLit0 
OpReg0 
OpBreg0 
OpRegx 
OpFbreg 
OpBregx 
OpPiece 
OpDerefSize 
OpXderefSize 
OpNop 
OpPushObjAddr 
OpCall2 
OpCall4 
OpCallRef 

Definition at line 13 of file dwarf.h.

14 {
15  TagArrayType = 0x01,
16  TagClassType = 0x02,
17  TagEntryPoint = 0x03,
18  TagEnumerationType = 0x04,
19  TagFormalParameter = 0x05,
21  TagLabel = 0x0A,
22  TagLexDwarfBlock = 0x0B,
23  TagMember = 0x0D,
24  TagPointerType = 0x0F,
25  TagReferenceType = 0x10,
26  TagCompileUnit = 0x11,
27  TagStringType = 0x12,
28  TagStructType = 0x13,
29  TagSubroutineType = 0x15,
30  TagTypedef = 0x16,
31  TagUnionType = 0x17,
33  TagVariant = 0x19,
34  TagCommonDwarfBlock = 0x1A,
35  TagCommonInclusion = 0x1B,
36  TagInheritance = 0x1C,
37  TagInlinedSubroutine = 0x1D,
38  TagModule = 0x1E,
39  TagPtrToMemberType = 0x1F,
40  TagSetType = 0x20,
41  TagSubrangeType = 0x21,
42  TagWithStmt = 0x22,
43  TagAccessDeclaration = 0x23,
44  TagBaseType = 0x24,
45  TagCatchDwarfBlock = 0x25,
46  TagConstType = 0x26,
47  TagConstant = 0x27,
48  TagEnumerator = 0x28,
49  TagFileType = 0x29,
50  TagFriend = 0x2A,
51  TagNamelist = 0x2B,
52  TagNamelistItem = 0x2C,
53  TagPackedType = 0x2D,
54  TagSubprogram = 0x2E,
57  TagThrownType = 0x31,
58  TagTryDwarfBlock = 0x32,
59  TagVariantPart = 0x33,
60  TagVariable = 0x34,
61  TagVolatileType = 0x35,
62  TagDwarfProcedure = 0x36,
63  TagRestrictType = 0x37,
64  TagInterfaceType = 0x38,
65  TagNamespace = 0x39,
66  TagImportedModule = 0x3A,
67  TagUnspecifiedType = 0x3B,
68  TagPartialUnit = 0x3C,
69  TagImportedUnit = 0x3D,
70  TagMutableType = 0x3E,
71 
72  TypeAddress = 0x01,
73  TypeBoolean = 0x02,
74  TypeComplexFloat = 0x03,
75  TypeFloat = 0x04,
76  TypeSigned = 0x05,
77  TypeSignedChar = 0x06,
78  TypeUnsigned = 0x07,
79  TypeUnsignedChar = 0x08,
80  TypeImaginaryFloat = 0x09,
81 
82  AccessPublic = 0x01,
83  AccessProtected = 0x02,
84  AccessPrivate = 0x03,
85 
86  VisLocal = 0x01,
87  VisExported = 0x02,
88  VisQualified = 0x03,
89 
90  VirtNone = 0x00,
91  VirtVirtual = 0x01,
92  VirtPureVirtual = 0x02,
93 
94  LangC89 = 0x0001,
95  LangC = 0x0002,
96  LangAda83 = 0x0003,
97  LangCplusplus = 0x0004,
98  LangCobol74 = 0x0005,
99  LangCobol85 = 0x0006,
100  LangFortran77 = 0x0007,
101  LangFortran90 = 0x0008,
102  LangPascal83 = 0x0009,
103  LangModula2 = 0x000A,
104  LangJava = 0x000B,
105  LangC99 = 0x000C,
106  LangAda95 = 0x000D,
107  LangFortran95 = 0x000E,
108  LangPLI = 0x000F,
109  /* 0x8000-0xFFFF reserved */
110 
111  IdCaseSensitive = 0x00,
112  IdCaseUpper = 0x01,
113  IdCaseLower = 0x02,
114  IdCaseInsensitive = 0x03,
115 
116  CallingNormal = 0x01,
117  CallingProgram = 0x02,
118  CallingNocall = 0x03,
119  /* 0x40-0xFF reserved */
120 
121  InNone = 0x00,
122  InInlined = 0x01,
123  InDeclaredNotInlined = 0x02,
124  InDeclaredInlined = 0x03,
125 
126  OrderRowMajor = 0x00,
127  OrderColumnMajor = 0x01,
128 
129  DiscLabel = 0x00,
130  DiscRange = 0x01,
131 
132  TReference = 1<<0,
133  TBlock = 1<<1,
134  TConstant = 1<<2,
135  TString = 1<<3,
136  TFlag = 1<<4,
137  TAddress = 1<<5,
138 
139  OpAddr = 0x03, /* 1 op, const addr */
140  OpDeref = 0x06,
141  OpConst1u = 0x08, /* 1 op, 1 byte const */
142  OpConst1s = 0x09, /* " signed */
143  OpConst2u = 0x0A, /* 1 op, 2 byte const */
144  OpConst2s = 0x0B, /* " signed */
145  OpConst4u = 0x0C, /* 1 op, 4 byte const */
146  OpConst4s = 0x0D, /* " signed */
147  OpConst8u = 0x0E, /* 1 op, 8 byte const */
148  OpConst8s = 0x0F, /* " signed */
149  OpConstu = 0x10, /* 1 op, LEB128 const */
150  OpConsts = 0x11, /* " signed */
151  OpDup = 0x12,
152  OpDrop = 0x13,
153  OpOver = 0x14,
154  OpPick = 0x15, /* 1 op, 1 byte stack index */
155  OpSwap = 0x16,
156  OpRot = 0x17,
157  OpXderef = 0x18,
158  OpAbs = 0x19,
159  OpAnd = 0x1A,
160  OpDiv = 0x1B,
161  OpMinus = 0x1C,
162  OpMod = 0x1D,
163  OpMul = 0x1E,
164  OpNeg = 0x1F,
165  OpNot = 0x20,
166  OpOr = 0x21,
167  OpPlus = 0x22,
168  OpPlusUconst = 0x23, /* 1 op, ULEB128 addend */
169  OpShl = 0x24,
170  OpShr = 0x25,
171  OpShra = 0x26,
172  OpXor = 0x27,
173  OpSkip = 0x2F, /* 1 op, signed 2-byte constant */
174  OpBra = 0x28, /* 1 op, signed 2-byte constant */
175  OpEq = 0x29,
176  OpGe = 0x2A,
177  OpGt = 0x2B,
178  OpLe = 0x2C,
179  OpLt = 0x2D,
180  OpNe = 0x2E,
181  OpLit0 = 0x30,
182  /* OpLitN = OpLit0 + N for N = 0..31 */
183  OpReg0 = 0x50,
184  /* OpRegN = OpReg0 + N for N = 0..31 */
185  OpBreg0 = 0x70, /* 1 op, signed LEB128 constant */
186  /* OpBregN = OpBreg0 + N for N = 0..31 */
187  OpRegx = 0x90, /* 1 op, ULEB128 register */
188  OpFbreg = 0x91, /* 1 op, SLEB128 offset */
189  OpBregx = 0x92, /* 2 op, ULEB128 reg, SLEB128 off */
190  OpPiece = 0x93, /* 1 op, ULEB128 size of piece */
191  OpDerefSize = 0x94, /* 1-byte size of data retrieved */
192  OpXderefSize = 0x95, /* 1-byte size of data retrieved */
193  OpNop = 0x96,
194  /* next four new in Dwarf v3 */
195  OpPushObjAddr = 0x97,
196  OpCall2 = 0x98, /* 2-byte offset of DIE */
197  OpCall4 = 0x99, /* 4-byte offset of DIE */
198  OpCallRef = 0x9A /* 4- or 8- byte offset of DIE */
199  /* 0xE0-0xFF reserved for user-specific */
200 };
Definition: dwarf.h:106
Definition: dwarf.h:158
Definition: dwarf.h:160
Definition: dwarf.h:168
Definition: dwarf.h:152
Definition: dwarf.h:161
Definition: dwarf.h:183
Definition: dwarf.h:176
Definition: dwarf.h:195
Definition: dwarf.h:178
Definition: dwarf.h:119
Definition: dwarf.h:188
Definition: dwarf.h:171
Definition: dwarf.h:103
Definition: dwarf.h:93
Definition: dwarf.h:151
Definition: dwarf.h:88
Definition: dwarf.h:134
Definition: dwarf.h:163
Definition: dwarf.h:186
Definition: dwarf.h:157
Definition: dwarf.h:181
Definition: dwarf.h:138
Definition: dwarf.h:173
Definition: dwarf.h:169
Definition: dwarf.h:179
Definition: dwarf.h:84
Definition: dwarf.h:175
Definition: dwarf.h:159
Definition: dwarf.h:177
Definition: dwarf.h:149
Definition: dwarf.h:172
Definition: dwarf.h:187
Definition: dwarf.h:162
Definition: dwarf.h:156
Definition: dwarf.h:150
Definition: dwarf.h:137
Definition: dwarf.h:133
Definition: dwarf.h:19
Definition: dwarf.h:170
Definition: dwarf.h:194
Definition: dwarf.h:174
Definition: dwarf.h:185
Definition: dwarf.h:92
Definition: dwarf.h:191
Definition: dwarf.h:153
Definition: dwarf.h:167
Definition: dwarf.h:165
Definition: dwarf.h:131
Definition: dwarf.h:154
Definition: dwarf.h:164

◆ anonymous enum

anonymous enum
Enumerator
RuleUndef 
RuleSame 
RuleCfaOffset 
RuleRegister 
RuleRegOff 
RuleLocation 

Definition at line 368 of file dwarf.h.

369 {
370  RuleUndef,
371  RuleSame,
373  RuleRegister,
374  RuleRegOff,
376 };

Function Documentation

◆ dwarfaddrtounit()

int dwarfaddrtounit ( Dwarf ,
ulong  ,
ulong  
)

Definition at line 17 of file dwarfaranges.c.

18 {
19  DwarfBuf b;
20  int segsize, i;
21  ulong len, id, off, base, size;
22  uchar *start, *end;
23 
24  memset(&b, 0, sizeof b);
25  b.d = d;
26  b.p = d->aranges.data;
27  b.ep = b.p + d->aranges.len;
28 
29  while(b.p < b.ep){
30  start = b.p;
31  len = dwarfget4(&b);
32  if (!len) { b.ep = b.p - 4; return -1; }
33  if((id = dwarfget2(&b)) != 2){
34  if(b.p == nil){
35  underflow:
36  werrstr("buffer underflow reading address ranges header");
37  }else
38  werrstr("bad dwarf version 0x%x in address ranges header", id);
39  return -1;
40  }
41  off = dwarfget4(&b);
42  b.addrsize = dwarfget1(&b);
43  if(d->addrsize == 0)
44  d->addrsize = b.addrsize;
45  segsize = dwarfget1(&b);
46  USED(segsize); /* what am i supposed to do with this? */
47  if(b.p == nil)
48  goto underflow;
49  if((i = (b.p-start) % (2*b.addrsize)) != 0)
50  b.p += 2*b.addrsize - i;
51  end = start+4+len;
52  while(b.p!=nil && b.p<end){
53  base = dwarfgetaddr(&b);
54  size = dwarfgetaddr(&b);
55  if (!size) continue;
56  if(b.p == nil)
57  goto underflow;
58  if(base <= addr && addr < base+size){
59  *unit = off;
60  return 0;
61  }
62  }
63  if(b.p == nil)
64  goto underflow;
65  b.p = end;
66  }
67  werrstr("address 0x%lux is not listed in dwarf debugging symbols", addr);
68  return -1;
69 }
#define werrstr(str,...)
Definition: compat.h:34
unsigned char uchar
Definition: Unfrag.h:59
ulong dwarfget4(DwarfBuf *)
Definition: dwarfget.c:96
GLuint GLuint end
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ulong dwarfget1(DwarfBuf *)
Definition: dwarfget.c:18
GLuint base
Definition: 3dtext.c:35
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLsizeiptr size
Definition: glext.h:5919
#define d
Definition: ke_i.h:81
ulong dwarfget2(DwarfBuf *)
Definition: dwarfget.c:82
GLenum const GLvoid * addr
Definition: glext.h:9621
GLenum GLsizei len
Definition: glext.h:6722
#define USED(x)
Definition: compat.h:38
unsigned long ulong
Definition: linux.h:275
GLuint start
Definition: gl.h:1545
#define nil
Definition: compat.h:23
GLenum GLuint id
Definition: glext.h:5579
#define memset(x, y, z)
Definition: compat.h:39
ulong dwarfgetaddr(DwarfBuf *)
Definition: dwarfget.c:124
off
Definition: i386-dis.c:3909

◆ dwarfargvalue()

int dwarfargvalue ( Dwarf d,
DwarfSym proc,
ulong  pc,
ulong  cfa,
PROSSYM_REGISTERS  registers,
DwarfParam parameters 
)

Definition at line 909 of file dwarfinfo.c.

910 {
911  int gotarg;
912  DwarfSym unit = { };
913 
914  if (dwarfenumunit(d, proc->unit, &unit) == -1)
915  return -1;
916 
917  werrstr("lookup in unit %x-%x, pc %x", unit.attrs.lowpc, unit.attrs.highpc, pc);
918  pc -= unit.attrs.lowpc;
919 
920  werrstr("paramblock %s -> unit %x type %x fde %x len %d registers %x",
921  parameter->name,
922  parameter->unit,
923  parameter->type,
924  parameter->fde,
925  parameter->len,
926  registers);
927 
928  // Seek our range in loc
929  DwarfBuf locbuf;
930  DwarfBuf instream = { };
931 
932  locbuf.d = d;
933  locbuf.addrsize = d->addrsize;
934 
935  if (parameter->loctype == TConstant) {
936  locbuf.p = d->loc.data + parameter->fde;
937  locbuf.ep = d->loc.data + d->loc.len;
938  ulong start, end, len;
939  do {
940  len = 0;
941  start = dwarfget4(&locbuf);
942  end = dwarfget4(&locbuf);
943  if (start && end) {
944  len = dwarfget2(&locbuf);
945  instream = locbuf;
946  instream.ep = instream.p + len;
947  locbuf.p = instream.ep;
948  }
949  werrstr("ip %x s %x e %x (%x bytes)", pc, start, end, len);
950  } while (start && end && (start > pc || end <= pc));
951  } else if (parameter->loctype == TBlock) {
952  instream = locbuf;
953  instream.p = (void *)parameter->fde;
954  instream.ep = instream.p + parameter->len;
955  } else {
956  werrstr("Wrong block type for parameter %s", parameter->name);
957  return -1;
958  }
959 
960  gotarg = dwarfgetarg(d, parameter->name, &instream, cfa, registers, &parameter->value);
961  if (gotarg == -1)
962  return -1;
963 
964  return 0;
965 }
uint addrsize
Definition: dwarf.h:212
#define werrstr(str,...)
Definition: compat.h:34
int dwarfenumunit(Dwarf *d, ulong unit, DwarfSym *s)
Definition: dwarfinfo.c:202
Dwarf * d
Definition: dwarf.h:209
ulong dwarfget4(DwarfBuf *)
Definition: dwarfget.c:96
GLuint GLuint end
Definition: gl.h:1545
static HANDLE proc()
Definition: pdb.c:32
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
static IStream instream
Definition: saxreader.c:2106
int registers[NUMREGS]
#define d
Definition: ke_i.h:81
char * name
Definition: compiler.c:66
uchar * p
Definition: dwarf.h:210
ulong dwarfget2(DwarfBuf *)
Definition: dwarfget.c:82
GLenum GLsizei len
Definition: glext.h:6722
unsigned long ulong
Definition: linux.h:275
GLuint start
Definition: gl.h:1545
uchar * ep
Definition: dwarf.h:211
int dwarfgetarg(Dwarf *d, const char *name, DwarfBuf *buf, ulong cfa, PROSSYM_REGISTERS registers, ulong *result)
Definition: dwarfinfo.c:658
Definition: dwarf.h:131

Referenced by RosSymGetAddressInformation().

◆ dwarfclose()

void dwarfclose ( Dwarf )

Definition at line 57 of file dwarfopen.c.

58 {
59  free(d->abbrev.data);
60  free(d->aranges.data);
61  free(d->frame.data);
62  free(d->line.data);
63  free(d->pubnames.data);
64  free(d->ranges.data);
65  free(d->str.data);
66  free(d->info.data);
67  pefree(d->pe);
68  free(d);
69 }
#define free
Definition: debug_ros.c:5
#define d
Definition: ke_i.h:81
void pefree(Pe *pe)
Definition: pe.c:109

◆ dwarfcomputecfa()

int dwarfcomputecfa ( Dwarf d,
DwarfExpr cfa,
PROSSYM_REGISTERS  registers,
ulong cfaLocation 
)

Definition at line 404 of file dwarfcfa.c.

405 {
406  switch (cfa->type) {
407  case RuleRegOff:
408  *cfaLocation = registers->Registers[cfa->reg] + cfa->offset;
409  werrstr("cfa reg %d (%x) offset %x = %x", cfa->reg, (ulong)registers->Registers[cfa->reg], cfa->offset, cfaLocation);
410  break;
411  default:
412  werrstr("cfa->type %x", cfa->type);
413  return -1;
414  }
415 
416  return 0;
417 }
#define werrstr(str,...)
Definition: compat.h:34
long offset
Definition: dwarf.h:368
int registers[NUMREGS]
ulong reg
Definition: dwarf.h:369
unsigned long ulong
Definition: linux.h:275
int type
Definition: dwarf.h:367

Referenced by dwarfregunwind(), and RosSymGetAddressInformation().

◆ dwarfdumpsym()

void dwarfdumpsym ( Dwarf d,
DwarfSym s 
)

Definition at line 968 of file dwarfinfo.c.

969 {
970  int j;
971  werrstr("tag %x\n", s->attrs.tag);
972  for (j = 0; plist[j].name; j++) {
973  char *have = ((char*)&s->attrs) + plist[j].haveoff;
974  char *attr = ((char*)&s->attrs) + plist[j].off;
975  if (*have == TString) {
976  char *str = *((char **)attr);
977  werrstr("%s: %s\n", plist[j].namestr, str);
978  } else if (*have == TReference) {
979  DwarfVal *val = ((DwarfVal*)attr);
980  werrstr("%s: %x:%x\n", plist[j].namestr, val->b.data, val->b.len);
981  } else if (*have)
982  werrstr("%s: (%x)\n", plist[j].namestr, *have);
983  }
984 }
#define werrstr(str,...)
Definition: compat.h:34
int off
Definition: dwarfinfo.c:333
int name
Definition: dwarfinfo.c:332
const WCHAR * str
GLuint GLfloat * val
Definition: glext.h:7180
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static Parse plist[]
Definition: dwarfinfo.c:337
Definition: cookie.c:201
GLdouble s
Definition: gl.h:2039
Definition: dwarf.h:133
int haveoff
Definition: dwarfinfo.c:334

◆ dwarfenum()

int dwarfenum ( Dwarf ,
DwarfSym  
)

Definition at line 242 of file dwarfinfo.c.

243 {
244  if(dwarfenumunit(d, 0, s) < 0)
245  return -1;
246  s->allunits = 1;
247  return 0;
248 }
int dwarfenumunit(Dwarf *d, ulong unit, DwarfSym *s)
Definition: dwarfinfo.c:202
#define d
Definition: ke_i.h:81
GLdouble s
Definition: gl.h:2039

◆ dwarfenumunit()

int dwarfenumunit ( Dwarf ,
ulong  ,
DwarfSym  
)

Definition at line 202 of file dwarfinfo.c.

203 {
204  int i;
205  ulong aoff, len;
206 
207  if(unit >= d->info.len){
208  werrstr("dwarf unit address 0x%x >= 0x%x out of range", unit, d->info.len);
209  return -1;
210  }
211  memset(s, 0, sizeof *s);
212  memset(&s->b, 0, sizeof s->b);
213 
214  s->b.d = d;
215  s->b.p = d->info.data + unit;
216  s->b.ep = d->info.data + d->info.len;
217  len = dwarfget4(&s->b);
218  s->nextunit = unit + 4 + len;
219 
220  if(s->b.ep - s->b.p < len){
221  badheader:
222  werrstr("bad dwarf unit header at unit 0x%lux", unit);
223  return -1;
224  }
225  s->b.ep = s->b.p+len;
226  if((i=dwarfget2(&s->b)) != 2)
227  goto badheader;
228  aoff = dwarfget4(&s->b);
229  s->b.addrsize = dwarfget1(&s->b);
230  if(d->addrsize == 0)
231  d->addrsize = s->b.addrsize;
232  if(s->b.p == nil)
233  goto badheader;
234 
235  s->aoff = aoff;
236  s->unit = unit;
237  s->depth = 0;
238  return 0;
239 }
#define werrstr(str,...)
Definition: compat.h:34
ulong dwarfget4(DwarfBuf *)
Definition: dwarfget.c:96
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ulong dwarfget1(DwarfBuf *)
Definition: dwarfget.c:18
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
#define d
Definition: ke_i.h:81
ulong dwarfget2(DwarfBuf *)
Definition: dwarfget.c:82
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
unsigned long ulong
Definition: linux.h:275
#define nil
Definition: compat.h:23
#define memset(x, y, z)
Definition: compat.h:39

Referenced by dwarfargvalue(), dwarfenum(), dwarflookupfn(), dwarflookupnameinunit(), dwarflookuptag(), dwarfnextsym(), and dwarfseeksym().

◆ dwarfget1()

ulong dwarfget1 ( DwarfBuf )

Definition at line 18 of file dwarfget.c.

19 {
20  if(b->p==nil || b->p+1 > b->ep){
21  b->p = nil;
22  return 0;
23  }
24  return *b->p++;
25 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define nil
Definition: compat.h:23

Referenced by dwarfgetaddr().

◆ dwarfget128()

ulong dwarfget128 ( DwarfBuf )

Definition at line 153 of file dwarfget.c.

154 {
155  static int nbad;
156  ulong c, d;
157 
158  if(b->p == nil)
159  return 0;
160  c = *b->p++;
161  if(!(c&0x80))
162 {n1++;
163  return c;
164 }
165  c &= ~0x80;
166  d = *b->p++;
167  c |= (d&0x7F)<<7;
168  if(!(d&0x80))
169 {n2++;
170  return c;
171 }
172  d = *b->p++;
173  c |= (d&0x7F)<<14;
174  if(!(d&0x80))
175 {n3++;
176  return c;
177 }
178  d = *b->p++;
179  c |= (d&0x7F)<<21;
180  if(!(d&0x80))
181 {n4++;
182  return c;
183 }
184  d = *b->p++;
185  c |= (d&0x7F)<<28;
186  if(!(d&0x80))
187 {n5++;
188  return c;
189 }
190  while(b->p<b->ep && *b->p&0x80)
191  b->p++;
192  if(++nbad == 1)
193  werrstr("dwarf: overflow during parsing of uleb128 integer\n");
194  return c;
195 }
#define werrstr(str,...)
Definition: compat.h:34
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define d
Definition: ke_i.h:81
int n3
Definition: dwarfget.c:148
const GLubyte * c
Definition: glext.h:8905
int n1
Definition: dwarfget.c:148
unsigned long ulong
Definition: linux.h:275
int n2
Definition: dwarfget.c:148
int n4
Definition: dwarfget.c:148
#define nil
Definition: compat.h:23
int n5
Definition: dwarfget.c:148
#define c
Definition: ke_i.h:80

◆ dwarfget128s()

long dwarfget128s ( DwarfBuf )

Definition at line 198 of file dwarfget.c.

199 {
200  int nb, c;
201  ulong v;
202  static int nbad;
203 
204  v = 0;
205  nb = 0;
206  if(b->p==nil)
207  return 0;
208  while(b->p<b->ep){
209  c = *b->p++;
210  v |= (c & 0x7F)<<nb;
211  nb += 7;
212  if(!(c&0x80))
213  break;
214  }
215  if(v&(1<<(nb-1)))
216  v |= ~(((ulong)1<<nb)-1);
217  if(nb > 8*sizeof(ulong)){
218  if(0)
219  if(++nbad == 1)
220  werrstr("dwarf: overflow during parsing of sleb128 integer: got %d bits", nb);
221  }
222  return v;
223 }
#define werrstr(str,...)
Definition: compat.h:34
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
const GLubyte * c
Definition: glext.h:8905
unsigned long ulong
Definition: linux.h:275
const GLdouble * v
Definition: gl.h:2040
#define nil
Definition: compat.h:23
#define c
Definition: ke_i.h:80

◆ dwarfget2()

ulong dwarfget2 ( DwarfBuf )

Definition at line 82 of file dwarfget.c.

83 {
84  ulong v;
85 
86  if(b->p==nil || b->p+2 > b->ep){
87  b->p = nil;
88  return 0;
89  }
90  v = b->d->pe->e2(b->p);
91  b->p += 2;
92  return v;
93 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
unsigned long ulong
Definition: linux.h:275
const GLdouble * v
Definition: gl.h:2040
#define nil
Definition: compat.h:23

Referenced by dwarfgetaddr().

◆ dwarfget4()

ulong dwarfget4 ( DwarfBuf )

Definition at line 96 of file dwarfget.c.

97 {
98  ulong v;
99 
100  if(b->p==nil || b->p+4 > b->ep){
101  b->p = nil;
102  return 0;
103  }
104  v = b->d->pe->e4(b->p);
105  b->p += 4;
106  return v;
107 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
unsigned long ulong
Definition: linux.h:275
const GLdouble * v
Definition: gl.h:2040
#define nil
Definition: compat.h:23

Referenced by dwarfgetaddr().

◆ dwarfget8()

uvlong dwarfget8 ( DwarfBuf )

Definition at line 110 of file dwarfget.c.

111 {
112  uvlong v;
113 
114  if(b->p==nil || b->p+8 > b->ep){
115  b->p = nil;
116  return 0;
117  }
118  v = b->d->pe->e8(b->p);
119  b->p += 8;
120  return v;
121 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
const GLdouble * v
Definition: gl.h:2040
#define nil
Definition: compat.h:23
unsigned long long uvlong
Definition: compat.h:9

Referenced by dwarfgetaddr().

◆ dwarfgetabbrev()

DwarfAbbrev* dwarfgetabbrev ( Dwarf ,
ulong  ,
ulong   
)

Definition at line 129 of file dwarfabbrev.c.

130 {
131  DwarfAbbrev *a;
132  int na;
133 
134  if((na = loadabbrevs(d, off, &a)) < 0){
135  werrstr("loadabbrevs: %r");
136  return nil;
137  }
138  return findabbrev(a, na, num);
139 }
#define werrstr(str,...)
Definition: compat.h:34
#define a
Definition: ke_i.h:78
#define d
Definition: ke_i.h:81
GLuint GLuint num
Definition: glext.h:9618
static int loadabbrevs(Dwarf *d, ulong off, DwarfAbbrev **aa)
Definition: dwarfabbrev.c:26
#define nil
Definition: compat.h:23
static DwarfAbbrev * findabbrev(DwarfAbbrev *a, int na, ulong num)
Definition: dwarfabbrev.c:117
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
off
Definition: i386-dis.c:3909

◆ dwarfgetaddr()

ulong dwarfgetaddr ( DwarfBuf )

Definition at line 124 of file dwarfget.c.

125 {
126  static int nbad;
127 
128  if(b->addrsize == 0)
129  b->addrsize = b->d->addrsize;
130 
131  switch(b->addrsize){
132  case 1:
133  return dwarfget1(b);
134  case 2:
135  return dwarfget2(b);
136  case 4:
137  return dwarfget4(b);
138  case 8:
139  return dwarfget8(b);
140  default:
141  if(++nbad == 1)
142  werrstr("dwarf: unexpected address size %lud in dwarfgetaddr\n", b->addrsize);
143  b->p = nil;
144  return 0;
145  }
146 }
#define werrstr(str,...)
Definition: compat.h:34
ulong dwarfget2(DwarfBuf *b)
Definition: dwarfget.c:82
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
uvlong dwarfget8(DwarfBuf *b)
Definition: dwarfget.c:110
ulong dwarfget4(DwarfBuf *b)
Definition: dwarfget.c:96
ulong dwarfget1(DwarfBuf *b)
Definition: dwarfget.c:18
#define nil
Definition: compat.h:23

◆ dwarfgetarg()

int dwarfgetarg ( Dwarf d,
const char name,
DwarfBuf locbuf,
ulong  cfa,
PROSSYM_REGISTERS  registers,
ulong value 
)

Definition at line 658 of file dwarfinfo.c.

659 {
660  int ret = 0;
661  DwarfStack stack = { };
662  stackinit(&stack);
663  stackpush(&stack, cfa);
664  while (buf->p < buf->ep) {
665  int opcode = dwarfget1(buf);
666  werrstr("opcode %x", opcode);
667  switch (opcode) {
668  case 0:
669  buf->p = buf->ep;
670  break;
671  case OpAddr:
672  if (d->addrsize == 4) {
674  break;
675  } else {
676  werrstr("%s: we only support 4 byte addrs", name);
677  goto fatal;
678  }
679  case OpConst1s: {
680  signed char c = dwarfget1(buf);
681  stackpush(&stack, c);
682  } break;
683  case OpConst1u:
685  break;
686  case OpConst2s: {
687  signed short s = dwarfget2(buf);
688  stackpush(&stack, s);
689  } break;
690  case OpConst2u:
692  break;
693  case OpConst4s: {
694  signed int i = dwarfget4(buf);
695  stackpush(&stack, i);
696  } break;
697  case OpConst4u:
699  break;
700  case OpConst8s:
701  case OpConst8u:
702  werrstr("const 8 not yet supported");
703  goto fatal;
704  case OpConsts:
706  break;
707  case OpConstu:
709  break;
710  case OpDup: {
711  ulong popped = stackpop(&stack);
712  stackpush(&stack, popped);
713  stackpush(&stack, popped);
714  } break;
715  case OpDrop:
716  stackpop(&stack);
717  break;
718  case OpOver: {
719  if (stack.length < 2) goto fatal;
720  stackpush(&stack, stack.data[stack.length-2]);
721  } break;
722  case OpPick: {
723  ulong arg = dwarfget1(buf);
724  if (arg >= stack.length) goto fatal;
725  arg = stack.data[stack.length-1-arg];
726  stackpush(&stack, arg);
727  } break;
728  case OpSwap: {
729  ulong a = stackpop(&stack), b = stackpop(&stack);
730  stackpush(&stack, b);
731  stackpush(&stack, a);
732  } break;
733  case OpRot: {
735  stackpush(&stack, b);
736  stackpush(&stack, c);
737  stackpush(&stack, a);
738  } break;
739  case OpXderef:
740  case OpXderefSize:
741  werrstr("Xderef not yet supported");
742  goto fatal;
743  case OpAbs: {
744  long a = stackpop(&stack);
745  stackpush(&stack, a < 0 ? -a : a);
746  } break;
747  case OpAnd:
749  break;
750  case OpDiv: {
751  ulong a = stackpop(&stack), b = stackpop(&stack);
752  stackpush(&stack, b / a);
753  } break;
754  case OpMinus: {
755  ulong a = stackpop(&stack), b = stackpop(&stack);
756  stackpush(&stack, b - a);
757  } break;
758  case OpMod: {
759  ulong a = stackpop(&stack), b = stackpop(&stack);
760  stackpush(&stack, b % a);
761  } break;
762  case OpMul:
764  break;
765  case OpNeg:
767  break;
768  case OpNot:
770  break;
771  case OpOr:
773  break;
774  case OpPlus:
776  break;
777  case OpPlusUconst:
779  break;
780  case OpShl: {
781  ulong a = stackpop(&stack), b = stackpop(&stack);
782  stackpush(&stack, b << a);
783  } break;
784  case OpShr: {
785  ulong a = stackpop(&stack), b = stackpop(&stack);
786  stackpush(&stack, b >> a);
787  } break;
788  case OpShra: {
789  ulong a = stackpop(&stack);
790  long b = stackpop(&stack);
791  if (b < 0)
792  b = -(-b >> a);
793  else
794  b = b >> a;
795  stackpush(&stack, b);
796  } break;
797  case OpXor:
799  break;
800  case OpSkip:
801  buf->p += dwarfget2(buf);
802  break;
803  case OpBra: {
804  ulong a = dwarfget2(buf);
805  if (stackpop(&stack))
806  buf->p += a;
807  } break;
808  case OpEq:
810  break;
811  case OpGe: {
812  ulong a = stackpop(&stack), b = stackpop(&stack);
813  stackpush(&stack, b >= a);
814  } break;
815  case OpGt: {
816  ulong a = stackpop(&stack), b = stackpop(&stack);
817  stackpush(&stack, b > a);
818  } break;
819  case OpLe: {
820  ulong a = stackpop(&stack), b = stackpop(&stack);
821  stackpush(&stack, b <= a);
822  } break;
823  case OpLt: {
824  ulong a = stackpop(&stack), b = stackpop(&stack);
825  stackpush(&stack, b < a);
826  } break;
827  case OpNe:
829  break;
830  case OpNop:
831  break;
832  case OpDeref: {
833  ulong val;
834  void* addr = (void*)stackpop(&stack);
836  (d->pe->fd,
837  &val,
838  addr,
839  d->addrsize))
840  goto fatal;
841  stackpush(&stack, val);
842  } break;
843  case OpDerefSize: {
844  ulong val, size = dwarfget1(buf);
845  void* addr = (void*)stackpop(&stack);
847  (d->pe->fd,
848  &val,
849  addr,
850  size))
851  goto fatal;
852  stackpush(&stack, val);
853  } break;
854  case OpFbreg: {
856  void* addr = (void*)cfa;
857  werrstr("FBREG cfa %x offset %x", cfa, offset);
859  (d->pe->fd,
860  &val,
862  d->addrsize))
863  goto fatal;
864  stackpush(&stack, val);
865  } break;
866  case OpPiece:
867  werrstr("OpPiece not supported");
868  goto fatal;
869  default:
870  if (opcode >= OpLit0 && opcode < OpReg0)
871  stackpush(&stack, opcode - OpLit0);
872  else if (opcode >= OpReg0 && opcode < OpBreg0) {
873  ulong reg = opcode - OpReg0;
874  werrstr("REG[%d] value %x", reg, (ulong)registers->Registers[reg]);
875  stackpush(&stack, registers->Registers[reg]);
876  } else if (opcode >= OpBreg0 && opcode < OpRegx) {
877  ulong val,
878  reg = opcode - OpBreg0,
880  void* addr = (void*)(ULONG_PTR)registers->Registers[reg];
881  werrstr("BREG[%d] reg %x offset %x", reg, addr, offset);
883  ((PVOID)d->pe->fd,
884  &val,
885  (PVOID)((ULONG_PTR)addr + offset),
886  d->addrsize))
887  goto fatal;
888  stackpush(&stack, val);
889  } else {
890  werrstr("opcode %x not supported", opcode);
891  goto fatal;
892  }
893  break;
894  }
895  }
896  if (stack.length < 1) goto fatal;
897  *result = stackpop(&stack);
898  werrstr("%s: value %x", name, *result);
899  goto finish;
900 
901 fatal:
902  ret = -1;
903 
904 finish:
905  stackfree(&stack);
906  return ret;
907 }
#define werrstr(str,...)
Definition: compat.h:34
Definition: dwarf.h:158
Definition: dwarf.h:160
Definition: dwarf.h:168
Definition: dwarf.h:152
Definition: dwarf.h:161
Definition: dwarf.h:183
Definition: dwarf.h:176
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
Definition: dwarf.h:178
GLintptr offset
Definition: glext.h:5920
ulong dwarfget4(DwarfBuf *)
Definition: dwarfget.c:96
Definition: dwarf.h:188
void * arg
Definition: msvc.h:10
Definition: dwarf.h:171
uint32_t ULONG_PTR
Definition: typedefs.h:64
void stackinit(DwarfStack *stack)
Definition: dwarfinfo.c:622
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ROSSYM_CALLBACKS RosSymCallbacks
Definition: init.c:14
ulong dwarfget1(DwarfBuf *)
Definition: dwarfget.c:18
Definition: dwarf.h:151
#define a
Definition: ke_i.h:78
Definition: dwarf.h:163
Definition: dwarf.h:186
Definition: dwarf.h:157
Definition: dwarf.h:181
Definition: dwarf.h:138
Definition: dwarf.h:173
GLuint GLfloat * val
Definition: glext.h:7180
Definition: _stack.h:47
Definition: dwarf.h:169
Definition: dwarf.h:179
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
int registers[NUMREGS]
GLsizeiptr size
Definition: glext.h:5919
#define d
Definition: ke_i.h:81
const GLubyte * c
Definition: glext.h:8905
Definition: dwarf.h:175
Definition: dwarf.h:159
Definition: dwarf.h:177
long dwarfget128s(DwarfBuf *)
Definition: dwarfget.c:198
Definition: dwarf.h:149
ulong dwarfget2(DwarfBuf *)
Definition: dwarfget.c:82
int ret
GLenum const GLvoid * addr
Definition: glext.h:9621
Definition: dwarf.h:172
BOOLEAN(* MemGetProc)(PVOID FileContext, ULONG_PTR *Target, PVOID SourceMem, ULONG Size)
Definition: rossym.h:110
Definition: dwarf.h:162
GLdouble s
Definition: gl.h:2039
Definition: dwarf.h:156
Definition: dwarf.h:150
Definition: dwarf.h:137
unsigned long ulong
Definition: linux.h:275
void fatal(const char *msg)
ulong dwarfget128(DwarfBuf *)
Definition: dwarfget.c:153
Definition: dwarf.h:170
static int reg
Definition: i386-dis.c:1275
void stackfree(DwarfStack *stack)
Definition: dwarfinfo.c:651
Definition: dwarf.h:174
ulong stackpop(DwarfStack *stack)
Definition: dwarfinfo.c:643
Definition: dwarf.h:185
Definition: name.c:38
Definition: dwarf.h:191
Definition: dwarf.h:153
void stackpush(DwarfStack *stack, ulong value)
Definition: dwarfinfo.c:629
Definition: dwarf.h:167
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
Definition: dwarf.h:165
GLuint64EXT * result
Definition: glext.h:11304
Definition: dwarf.h:154
Definition: dwarf.h:164

Referenced by dwarfargvalue(), and RosSymAggregate().

◆ dwarfgetinfounit()

int dwarfgetinfounit ( Dwarf ,
ulong  ,
DwarfBlock  
)

◆ dwarfgetn()

int dwarfgetn ( DwarfBuf ,
uchar ,
int   
)

Definition at line 28 of file dwarfget.c.

29 {
30  if(b->p==nil || b->p+n > b->ep){
31  b->p = nil;
32  memset(a, 0, n);
33  return -1;
34  }
35  memmove(a, b->p, n);
36  b->p += n;
37  return 0;
38 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
GLdouble n
Definition: glext.h:7729
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define nil
Definition: compat.h:23
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define memset(x, y, z)
Definition: compat.h:39

◆ dwarfgetnref()

uchar* dwarfgetnref ( DwarfBuf ,
ulong   
)

Definition at line 41 of file dwarfget.c.

42 {
43  uchar *p;
44 
45  if(b->p==nil || b->p+n > b->ep){
46  b->p = nil;
47  return nil;
48  }
49  p = b->p;
50  b->p += n;
51  return p;
52 }
unsigned char uchar
Definition: Unfrag.h:59
GLdouble n
Definition: glext.h:7729
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define nil
Definition: compat.h:23
GLfloat GLfloat p
Definition: glext.h:8902

◆ dwarfgetparams()

int dwarfgetparams ( Dwarf d,
DwarfSym s,
ulong  pc,
int  pnum,
DwarfParam paramblocks 
)

Definition at line 987 of file dwarfinfo.c.

988 {
989  int ip = 0;
990  DwarfSym param = { };
991  int res = dwarfnextsymat(d, s, &param);
992  while (res == 0 && ip < pnum) {
993  if (param.attrs.tag == TagFormalParameter &&
994  param.attrs.have.name &&
995  param.attrs.have.location) {
996  paramblocks[ip].name = malloc(strlen(param.attrs.name)+1);
997  strcpy(paramblocks[ip].name, param.attrs.name);
998  paramblocks[ip].unit = param.unit;
999  paramblocks[ip].type = param.attrs.type;
1000  paramblocks[ip].loctype = param.attrs.have.location;
1001  paramblocks[ip].len = param.attrs.location.b.len;
1002  paramblocks[ip].fde = (ulong)param.attrs.location.b.data;
1003  werrstr("param[%d] block %s -> type %x loctype %x fde %x len %x",
1004  ip,
1005  paramblocks[ip].name,
1006  paramblocks[ip].type,
1007  paramblocks[ip].loctype,
1008  paramblocks[ip].fde,
1009  paramblocks[ip].len);
1010  ip++;
1011  }
1012  res = dwarfnextsymat(d, s, &param);
1013  }
1014  return ip;
1015 }
#define werrstr(str,...)
Definition: compat.h:34
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
ulong fde
Definition: dwarf.h:214
int ip[4]
Definition: rtl.c:1176
char * name
Definition: dwarf.h:210
#define d
Definition: ke_i.h:81
Definition: dhcpd.h:61
GLfloat param
Definition: glext.h:5796
ulong len
Definition: dwarf.h:214
int dwarfnextsymat(Dwarf *d, DwarfSym *s, int depth)
Definition: dwarfinfo.c:293
ulong loctype
Definition: dwarf.h:213
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
ulong unit
Definition: dwarf.h:211
unsigned long ulong
Definition: linux.h:275
ulong type
Definition: dwarf.h:212
Definition: name.c:38
GLuint res
Definition: glext.h:9613
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define malloc
Definition: debug_ros.c:4
WCHAR * name
Definition: name.c:42

Referenced by RosSymGetAddressInformation().

◆ dwarfgetstring()

char* dwarfgetstring ( DwarfBuf )

Definition at line 55 of file dwarfget.c.

56 {
57  char *s;
58 
59  if(b->p == nil)
60  return nil;
61  s = (char*)b->p;
62  while(b->p < b->ep && *b->p)
63  b->p++;
64  if(b->p >= b->ep){
65  b->p = nil;
66  return nil;
67  }
68  b->p++;
69  return s;
70 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLdouble s
Definition: gl.h:2039
#define nil
Definition: compat.h:23

◆ dwarfgettype()

int dwarfgettype ( Dwarf d,
DwarfSym param,
DwarfSym type 
)

◆ dwarflookupfn()

int dwarflookupfn ( Dwarf ,
ulong  ,
ulong  ,
DwarfSym  
)

Definition at line 182 of file dwarfinfo.c.

183 {
184  if(dwarfenumunit(d, unit, s) < 0)
185  return -1;
186 
187  if(dwarfnextsymat(d, s, 0) != 1)
188  return -1;
189  /* s is now the CompileUnit */
190 
191  while(dwarfnextsymat(d, s, 1) == 1){
192  if(s->attrs.tag != TagSubprogram)
193  continue;
194  if(s->attrs.lowpc <= pc && pc < s->attrs.highpc)
195  return 0;
196  }
197  werrstr("fn containing pc 0x%lux not found", pc);
198  return -1;
199 }
#define werrstr(str,...)
Definition: compat.h:34
int dwarfenumunit(Dwarf *d, ulong unit, DwarfSym *s)
Definition: dwarfinfo.c:202
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
#define d
Definition: ke_i.h:81
int dwarfnextsymat(Dwarf *d, DwarfSym *s, int depth)
Definition: dwarfinfo.c:293
GLdouble s
Definition: gl.h:2039

◆ dwarflookupname()

int dwarflookupname ( Dwarf ,
char ,
DwarfSym  
)

Definition at line 67 of file dwarfpubnames.c.

68 {
69  return _dwarfnametounit(d, name, &d->pubnames, sym);
70 }
#define d
Definition: ke_i.h:81
Definition: name.c:38
static int _dwarfnametounit(Dwarf *d, char *name, DwarfBlock *bl, DwarfSym *s)
Definition: dwarfpubnames.c:12

◆ dwarflookupnameinunit()

int dwarflookupnameinunit ( Dwarf ,
ulong  ,
char ,
DwarfSym  
)

Definition at line 126 of file dwarfinfo.c.

127 {
128  if(dwarfenumunit(d, unit, s) < 0)
129  return -1;
130 
131  dwarfnextsymat(d, s, 0); /* s is now the CompileUnit */
132  while(dwarfnextsymat(d, s, 1) == 1)
133  if(s->attrs.name && strcmp(s->attrs.name, name) == 0)
134  return 0;
135  werrstr("symbol '%s' not found", name);
136  return -1;
137 }
#define werrstr(str,...)
Definition: compat.h:34
int dwarfenumunit(Dwarf *d, ulong unit, DwarfSym *s)
Definition: dwarfinfo.c:202
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
#define d
Definition: ke_i.h:81
int dwarfnextsymat(Dwarf *d, DwarfSym *s, int depth)
Definition: dwarfinfo.c:293
GLdouble s
Definition: gl.h:2039
Definition: name.c:38
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

◆ dwarflookupsubname()

int dwarflookupsubname ( Dwarf ,
DwarfSym ,
char ,
DwarfSym  
)

Definition at line 141 of file dwarfinfo.c.

142 {
143  *s = *parent;
144  while(dwarfnextsymat(d, s, parent->depth+1))
145  if(s->attrs.name && strcmp(s->attrs.name, name) == 0)
146  return 0;
147  werrstr("symbol '%s' not found", name);
148  return -1;
149 }
#define werrstr(str,...)
Definition: compat.h:34
#define d
Definition: ke_i.h:81
r parent
Definition: btrfs.c:2869
int dwarfnextsymat(Dwarf *d, DwarfSym *s, int depth)
Definition: dwarfinfo.c:293
GLdouble s
Definition: gl.h:2039
Definition: name.c:38
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

◆ dwarflookuptag()

int dwarflookuptag ( Dwarf ,
ulong  ,
ulong  ,
DwarfSym  
)

Definition at line 152 of file dwarfinfo.c.

153 {
154  if(dwarfenumunit(d, unit, s) < 0) {
155  return -1;
156  }
157 
158  dwarfnextsymat(d, s, 0); /* s is now the CompileUnit */
159  if(s->attrs.tag == tag) {
160  return 0;
161  }
162  while(dwarfnextsymat(d, s, 1) == 1)
163  if(s->attrs.tag == tag) {
164  return 0;
165  }
166  werrstr("symbol with tag 0x%lux not found", tag);
167  return -1;
168 }
#define werrstr(str,...)
Definition: compat.h:34
int dwarfenumunit(Dwarf *d, ulong unit, DwarfSym *s)
Definition: dwarfinfo.c:202
Definition: ecma_167.h:138
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
#define d
Definition: ke_i.h:81
int dwarfnextsymat(Dwarf *d, DwarfSym *s, int depth)
Definition: dwarfinfo.c:293
GLdouble s
Definition: gl.h:2039

◆ dwarfnextsym()

int dwarfnextsym ( Dwarf ,
DwarfSym  
)

Definition at line 251 of file dwarfinfo.c.

252 {
253  ulong num;
254  DwarfAbbrev *a;
255 
256  if(s->attrs.haskids)
257  s->depth++;
258 top:
259  if(s->b.p >= s->b.ep){
260  if(s->allunits && s->nextunit < d->info.len){
261  if(dwarfenumunit(d, s->nextunit, s) < 0) {
262  return -1;
263  }
264  s->allunits = 1;
265  goto top;
266  }
267  return 0;
268  }
269 
270  s->uoff = s->b.p - (d->info.data+s->unit);
271  num = dwarfget128(&s->b);
272  if(num == 0){
273  if(s->depth == 0) {
274  return 0;
275  }
276  if(s->depth > 0)
277  s->depth--;
278  goto top;
279  }
280 
281  a = dwarfgetabbrev(d, s->aoff, num);
282  if(a == nil){
283  werrstr("getabbrev %ud %ud for %ud,%ud: %r\n", s->aoff, num, s->unit, s->uoff);
284  return -1;
285  }
286  if(parseattrs(&s->b, s->unit, a, &s->attrs) < 0) {
287  return -1;
288  }
289  return 1;
290 }
#define werrstr(str,...)
Definition: compat.h:34
int dwarfenumunit(Dwarf *d, ulong unit, DwarfSym *s)
Definition: dwarfinfo.c:202
#define a
Definition: ke_i.h:78
#define d
Definition: ke_i.h:81
GLuint GLuint num
Definition: glext.h:9618
GLdouble s
Definition: gl.h:2039
unsigned long ulong
Definition: linux.h:275
ulong dwarfget128(DwarfBuf *)
Definition: dwarfget.c:153
DwarfAbbrev * dwarfgetabbrev(Dwarf *, ulong, ulong)
Definition: dwarfabbrev.c:129
#define nil
Definition: compat.h:23
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
static int parseattrs(DwarfBuf *, ulong, DwarfAbbrev *, DwarfAttrs *)
Definition: dwarfinfo.c:408

Referenced by dwarfenumunit(), dwarflookupchildtag(), dwarflookuptag(), dwarfnextsym(), and dwarfnextsymat().

◆ dwarfnextsymat()

int dwarfnextsymat ( Dwarf ,
DwarfSym parent,
DwarfSym child 
)

Definition at line 292 of file dwarfinfo.c.

293 {
294  uint sib;
295 
296  if (!parent->attrs.haskids || !parent->childoff)
297  return -1;
298 
299  child->unit = parent->unit;
300  child->aoff = parent->aoff;
301  child->depth = parent->depth + 1;
302  if(child->attrs.have.sibling){
303  sib = child->attrs.sibling;
304  if(sib < d->info.len && d->info.data+sib > child->b.p)
305  child->b.p = d->info.data+sib;
306  else if (sib >= d->info.len) {
307  werrstr("sibling reported as out of bounds %d vs %d", sib, d->info.len);
308  return -1;
309  } else if (d->info.data+sib+parent->unit < child->b.p) {
310  werrstr("subsequent sibling is listed before prev %d vs %d", sib+parent->unit, child->b.p - d->info.data);
311  return -1;
312  }
313  }
314 
315  // Uninitialized
316  if (!child->b.d) {
317  child->b = parent->b;
318  child->b.p = parent->childoff + parent->b.d->info.data;
319  werrstr("Rewound to childoff %x\n", parent->childoff);
320  }
321 
322  return dwarfnextsym(d, child);
323 }
#define werrstr(str,...)
Definition: compat.h:34
int dwarfnextsym(Dwarf *d, DwarfSym *s)
Definition: dwarfinfo.c:251
static HWND child
Definition: cursoricon.c:298
#define d
Definition: ke_i.h:81
r parent
Definition: btrfs.c:2869
UINT32 uint
Definition: types.h:83

◆ dwarfopen()

Dwarf* dwarfopen ( struct _Pe elf)

Definition at line 16 of file dwarfopen.c.

17 {
18  Dwarf *d;
19 
20  if(pe == nil){
21  werrstr("nil pe passed to dwarfopen");
22  return nil;
23  }
24 
25  d = mallocz(sizeof(Dwarf), 1);
26  if(d == nil)
27  return nil;
28 
29  d->pe = pe;
30  if(pe->loadsection(pe, ".debug_abbrev", &d->abbrev) < 0
31  || pe->loadsection(pe, ".debug_aranges", &d->aranges) < 0
32  || pe->loadsection(pe, ".debug_line", &d->line) < 0
33  || pe->loadsection(pe, ".debug_pubnames", &d->pubnames) < 0
34  || pe->loadsection(pe, ".debug_info", &d->info) < 0)
35  goto err;
36  pe->loadsection(pe, ".debug_frame", &d->frame);
37  pe->loadsection(pe, ".debug_ranges", &d->ranges);
38  pe->loadsection(pe, ".debug_str", &d->str);
39 
40  return d;
41 
42 err:
43  DPRINT("Failed to open dwarf\n");
44  free(d->abbrev.data);
45  free(d->aranges.data);
46  free(d->frame.data);
47  free(d->line.data);
48  free(d->pubnames.data);
49  free(d->ranges.data);
50  free(d->str.data);
51  free(d->info.data);
52  free(d);
53  return nil;
54 }
#define werrstr(str,...)
Definition: compat.h:34
#define free
Definition: debug_ros.c:5
#define mallocz(x, y)
Definition: compat.h:36
void DPRINT(...)
Definition: polytest.cpp:61
#define d
Definition: ke_i.h:81
#define err(...)
Definition: dwarf.h:436
#define nil
Definition: compat.h:23

◆ dwarfpctoline()

int dwarfpctoline ( Dwarf ,
DwarfSym proc,
ulong  ,
char **  ,
char **  ,
ulong  
)

Definition at line 41 of file dwarfpc.c.

42 {
43  char *cdir;
44  uchar *prog, *opcount, *end, *dirs;
45  ulong off, unit, len, vers, x, start, lastline;
46  int i, first, firstline, op, a, l, quantum, isstmt, linebase, linerange, opcodebase, nf;
47  char *files, *s;
48  DwarfBuf b;
49  DwarfSym sym;
50  State emit, cur, reset;
51  char **f, **newf;
52 
53  f = nil;
54  memset(proc, 0, sizeof(*proc));
55 
56  int runit = dwarfaddrtounit(d, pc, &unit);
57  if (runit < 0)
58  return -1;
59  int rtag = dwarflookuptag(d, unit, TagCompileUnit, &sym);
60  if (rtag < 0)
61  return -1;
62 
63  if(!sym.attrs.have.stmtlist){
64  werrstr("no line mapping information for 0x%x", pc);
65  return -1;
66  }
67  off = sym.attrs.stmtlist;
68  if(off >= d->line.len){
69  werrstr("bad stmtlist");
70  goto bad;
71  }
72 
73  if(trace) werrstr("unit 0x%x stmtlist 0x%x", unit, sym.attrs.stmtlist);
74 
75  memset(&b, 0, sizeof b);
76  b.d = d;
77  b.p = d->line.data + off;
78  b.ep = b.p + d->line.len;
79  b.addrsize = sym.b.addrsize; /* should i get this from somewhere else? */
80 
81  len = dwarfget4(&b);
82  if(b.p==nil || b.p+len > b.ep || b.p+len < b.p){
83  werrstr("bad len");
84  goto bad;
85  }
86 
87  b.ep = b.p+len;
88  vers = dwarfget2(&b);
89  if(vers != 2){
90  werrstr("bad dwarf version 0x%x", vers);
91  return -1;
92  }
93 
94  len = dwarfget4(&b);
95  if(b.p==nil || b.p+len > b.ep || b.p+len < b.p){
96  werrstr("another bad len");
97  goto bad;
98  }
99  prog = b.p+len;
100 
101  quantum = dwarfget1(&b);
102  isstmt = dwarfget1(&b);
103  linebase = (schar)dwarfget1(&b);
104  linerange = (schar)dwarfget1(&b);
105  opcodebase = dwarfget1(&b);
106 
107  opcount = b.p-1;
108  dwarfgetnref(&b, opcodebase-1);
109  if(b.p == nil){
110  werrstr("bad opcode chart");
111  goto bad;
112  }
113 
114  /* just skip the files and dirs for now; we'll come back */
115  dirs = b.p;
116  while (b.p && *b.p)
117  dwarfgetstring(&b);
118  dwarfget1(&b);
119 
120  files = (char*)b.p;
121  while(b.p!=nil && *b.p!=0){
122  dwarfgetstring(&b);
123  dwarfget128(&b);
124  dwarfget128(&b);
125  dwarfget128(&b);
126  }
127  dwarfget1(&b);
128 
129  /* move on to the program */
130  if(b.p == nil || b.p > prog){
131  werrstr("bad header");
132  goto bad;
133  }
134  b.p = prog;
135 
136  reset.addr = 0;
137  reset.file = 1;
138  reset.line = 1;
139  reset.column = 0;
140  reset.flags = isstmt ? Isstmt : 0;
141  reset.isa = 0;
142 
143  cur = reset;
144  emit = reset;
145  nf = 0;
146  start = 0;
147  if(trace) werrstr("program @ %lu ... %.*H opbase = %d", b.p - d->line.data, b.ep-b.p, b.p, opcodebase);
148  first = 1;
149  while(b.p != nil){
150  firstline = 0;
151  op = dwarfget1(&b);
152  if(trace) werrstr("\tline %lu, addr 0x%x, op %d %.10H", cur.line, cur.addr, op, b.p);
153  if(op >= opcodebase){
154  a = (op - opcodebase) / linerange;
155  l = (op - opcodebase) % linerange + linebase;
156  cur.line += l;
157  cur.addr += a * quantum;
158  if(trace) werrstr(" +%d,%d", a, l);
159  emit:
160  if(first){
161  if(cur.addr > pc){
162  werrstr("found wrong line mapping 0x%x for pc 0x%x", cur.addr, pc);
163  /* This is an overzealous check. gcc can produce discontiguous ranges
164  and reorder statements, so it's possible for a future line to start
165  ahead of pc and still find a matching one. */
166  /*goto out;*/
167  firstline = 1;
168  }
169  first = 0;
170  start = cur.addr;
171  }
172  if(cur.addr > pc && !firstline)
173  break;
174  if(b.p == nil){
175  werrstr("buffer underflow in line mapping");
176  goto out;
177  }
178  emit = cur;
179  if(emit.flags & EndSequence){
180  werrstr("found wrong line mapping 0x%x-0x%x for pc 0x%x", start, cur.addr, pc);
181  goto out;
182  }
184  }else{
185  switch(op){
186  case 0: /* extended op code */
187  if(trace) werrstr(" ext");
188  len = dwarfget128(&b);
189  end = b.p+len;
190  if(b.p == nil || end > b.ep || end < b.p || len < 1)
191  goto bad;
192  switch(dwarfget1(&b)){
193  case 1: /* end sequence */
194  if(trace) werrstr(" end");
195  cur.flags |= EndSequence;
196  goto emit;
197  case 2: /* set address */
198  cur.addr = dwarfgetaddr(&b);
199  if(trace) werrstr(" set pc 0x%x", cur.addr);
200  break;
201  case 3: /* define file */
202  newf = malloc(nf+1*sizeof(f[0]));
203  if (newf)
204  RtlMoveMemory(newf, f, nf*sizeof(f[0]));
205  if(newf == nil)
206  goto out;
207  free(f);
208  f = newf;
209  f[nf++] = s = dwarfgetstring(&b);
210  DPRINT1("str %s", s);
211  dwarfget128(&b);
212  dwarfget128(&b);
213  dwarfget128(&b);
214  if(trace) werrstr(" def file %s", s);
215  break;
216  }
217  if(b.p == nil || b.p > end)
218  goto bad;
219  b.p = end;
220  break;
221  case 1: /* emit */
222  if(trace) werrstr(" emit");
223  goto emit;
224  case 2: /* advance pc */
225  a = dwarfget128(&b);
226  if(trace) werrstr(" advance pc + %lu", a*quantum);
227  cur.addr += a * quantum;
228  break;
229  case 3: /* advance line */
230  l = dwarfget128s(&b);
231  if(trace) werrstr(" advance line + %ld", l);
232  cur.line += l;
233  break;
234  case 4: /* set file */
235  if(trace) werrstr(" set file");
236  cur.file = dwarfget128s(&b);
237  break;
238  case 5: /* set column */
239  if(trace) werrstr(" set column");
240  cur.column = dwarfget128(&b);
241  break;
242  case 6: /* negate stmt */
243  if(trace) werrstr(" negate stmt");
244  cur.flags ^= Isstmt;
245  break;
246  case 7: /* set basic block */
247  if(trace) werrstr(" set basic block");
248  cur.flags |= BasicDwarfBlock;
249  break;
250  case 8: /* const add pc */
251  a = (255 - opcodebase) / linerange * quantum;
252  if(trace) werrstr(" const add pc + %d", a);
253  cur.addr += a;
254  break;
255  case 9: /* fixed advance pc */
256  a = dwarfget2(&b);
257  if(trace) werrstr(" fixed advance pc + %d", a);
258  cur.addr += a;
259  break;
260  case 10: /* set prologue end */
261  if(trace) werrstr(" set prologue end");
262  cur.flags |= PrologueEnd;
263  break;
264  case 11: /* set epilogue begin */
265  if(trace) werrstr(" set epilogue begin");
266  cur.flags |= EpilogueBegin;
267  break;
268  case 12: /* set isa */
269  if(trace) werrstr(" set isa");
270  cur.isa = dwarfget128(&b);
271  break;
272  default: /* something new - skip it */
273  if(trace) werrstr(" unknown %d", opcount[op]);
274  for(i=0; i<opcount[op]; i++)
275  dwarfget128(&b);
276  break;
277  }
278  }
279  }
280  if(b.p == nil)
281  goto bad;
282 
283  /* finally! the data we seek is in "emit" */
284 
285  if(emit.file == 0){
286  werrstr("invalid file index in mapping data");
287  goto out;
288  }
289  if(line)
290  *line = emit.line;
291 
292  /* skip over first emit.file-2 guys */
293  b.p = (uchar*)files;
294  for(i=emit.file-1; i > 0 && b.p!=nil && *b.p!=0; i--){
295  dwarfgetstring(&b);
296  dwarfget128(&b);
297  dwarfget128(&b);
298  dwarfget128(&b);
299  }
300  if(b.p == nil){
301  werrstr("problem parsing file data second time (cannot happen)");
302  goto bad;
303  }
304  if(*b.p == 0){
305  if(i >= nf){
306  werrstr("bad file index in mapping data");
307  goto bad;
308  }
309  b.p = (uchar*)f[i];
310  }
311  s = dwarfgetstring(&b);
312  *file = s;
313  i = dwarfget128(&b); /* directory */
314  x = dwarfget128(&b);
315  x = dwarfget128(&b);
316 
317  /* fetch dir name */
318  cdir = sym.attrs.have.compdir ? sym.attrs.compdir : 0;
319 
320  char *dwarfdir;
321  dwarfdir = nil;
322  b.p = dirs;
323  for (x = 1; b.p && *b.p; x++) {
324  dwarfdir = dwarfgetstring(&b);
325  if (x == i) break;
326  }
327 
328  if (!cdir && dwarfdir)
329  cdir = dwarfdir;
330 
331  char *filefull = malloc(strlen(cdir) + strlen(*file) + 2);
332  strcpy(filefull, cdir);
333  strcat(filefull, "/");
334  strcat(filefull, *file);
335  *file = filefull;
336 
337  *function = nil;
338  lastline = 0;
339 
340  runit = dwarfaddrtounit(d, pc, &unit);
341  if (runit == 0) {
342  DwarfSym compunit = { };
343  int renum = dwarfenumunit(d, unit, &compunit);
344  if (renum < 0)
345  return -1;
346  renum = dwarfnextsymat(d, &compunit, proc);
347  while (renum == 0) {
348  if (proc->attrs.tag == TagSubprogram &&
349  proc->attrs.have.name)
350  {
351  if (proc->attrs.lowpc <= pc && proc->attrs.highpc > pc) {
352  *function = malloc(strlen(proc->attrs.name)+1);
353  strcpy(*function, proc->attrs.name);
354  goto done;
355  }
356  }
357  renum = dwarfnextsym(d, proc);
358  }
359  }
360 
361  // Next search by declaration
362  runit = dwarfaddrtounit(d, pc, &unit);
363  if (runit == 0) {
364  DwarfSym compunit = { };
365  int renum = dwarfenumunit(d, unit, &compunit);
366  if (renum < 0)
367  return -1;
368  renum = dwarfnextsymat(d, &compunit, proc);
369  while (renum == 0) {
370  if (proc->attrs.tag == TagSubprogram &&
371  proc->attrs.have.name &&
372  proc->attrs.declfile == emit.file)
373  {
374  if (proc->attrs.declline <= *line &&
375  proc->attrs.declline > lastline) {
376  free(*function);
377  *function = malloc(strlen(proc->attrs.name)+1);
378  strcpy(*function, proc->attrs.name);
379  goto done;
380  }
381  lastline = proc->attrs.declline;
382  }
383  renum = dwarfnextsym(d, proc);
384  }
385  }
386 
387  /* free at last, free at last */
388 done:
389  free(f);
390  return 0;
391 bad:
392  werrstr("corrupted line mapping for 0x%x", pc);
393 out:
394  free(f);
395  return -1;
396 }
uint addrsize
Definition: dwarf.h:212
int dwarfaddrtounit(Dwarf *, ulong, ulong *)
Definition: dwarfaranges.c:17
#define werrstr(str,...)
Definition: compat.h:34
int dwarfnextsym(Dwarf *, DwarfSym *)
Definition: dwarfinfo.c:251
#define trace
Definition: dwarfpc.c:18
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
unsigned char uchar
Definition: Unfrag.h:59
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * dwarfgetstring(DwarfBuf *)
Definition: dwarfget.c:55
char * prog
Definition: isohybrid.c:47
#define free
Definition: debug_ros.c:5
const GLint * first
Definition: glext.h:5794
ulong dwarfget4(DwarfBuf *)
Definition: dwarfget.c:96
int dwarfnextsymat(Dwarf *, DwarfSym *, int)
Definition: dwarfinfo.c:293
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
signed char schar
Definition: compat.h:5
GLuint GLuint end
Definition: gl.h:1545
static HANDLE proc()
Definition: pdb.c:32
ulong addr
Definition: dwarfpc.c:40
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ulong dwarfget1(DwarfBuf *)
Definition: dwarfget.c:18
#define a
Definition: ke_i.h:78
uchar compdir
Definition: dwarf.h:239
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
Definition: parser.c:48
Definition: dwarfpc.c:30
int dwarfenumunit(Dwarf *, ulong, DwarfSym *)
Definition: dwarfinfo.c:202
#define b
Definition: ke_i.h:79
r l[0]
Definition: byte_order.h:167
GLfloat f
Definition: glext.h:7540
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define d
Definition: ke_i.h:81
static FILE * out
Definition: regtests2xml.c:44
ulong flags
Definition: dwarfpc.c:44
UINT op
Definition: effect.c:224
ulong column
Definition: dwarfpc.c:43
long dwarfget128s(DwarfBuf *)
Definition: dwarfget.c:198
ulong dwarfget2(DwarfBuf *)
Definition: dwarfget.c:82
uchar stmtlist
Definition: dwarf.h:282
ulong file
Definition: dwarfpc.c:41
struct DwarfAttrs::@4013 have
ulong line
Definition: dwarfpc.c:42
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
unsigned long ulong
Definition: linux.h:275
DwarfBuf b
Definition: dwarf.h:378
GLboolean reset
Definition: glext.h:5666
ulong dwarfget128(DwarfBuf *)
Definition: dwarfget.c:153
GLuint start
Definition: gl.h:1545
#define f
Definition: ke_i.h:83
#define DPRINT1
Definition: precomp.h:8
#define nil
Definition: compat.h:23
ulong isa
Definition: dwarfpc.c:45
uchar * dwarfgetnref(DwarfBuf *, ulong)
Definition: dwarfget.c:41
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define malloc
Definition: debug_ros.c:4
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
int dwarflookuptag(Dwarf *, ulong, ulong, DwarfSym *)
Definition: dwarfinfo.c:152
#define memset(x, y, z)
Definition: compat.h:39
ulong dwarfgetaddr(DwarfBuf *)
Definition: dwarfget.c:124
DwarfAttrs attrs
Definition: dwarf.h:375
off
Definition: i386-dis.c:3909
Definition: fci.c:126

◆ dwarfregunwind()

int dwarfregunwind ( Dwarf d,
ulong  pc,
ulong  fde,
DwarfExpr cfa,
PROSSYM_REGISTERS  registers 
)

Definition at line 419 of file dwarfcfa.c.

420 {
421  int i;
422  State s = { };
423  DwarfExpr initr[sizeof(registers->Registers) / sizeof(registers->Registers[0])] = { };
424  DwarfExpr r[sizeof(registers->Registers) / sizeof(registers->Registers[0])] = { };
425  DwarfExpr ra;
426 
427  int nr = s.nr = sizeof(registers->Registers) / sizeof(registers->Registers[0]);
428  s.initr = initr;
429  s.r = r;
430  for (i = 0; i < sizeof(r) / sizeof(r[0]); i++) {
431  r[i].type = RuleRegister;
432  r[i].offset = registers->Registers[i];
433  r[i].reg = i;
434  }
435 
436  int res = dwarfunwind(d, pc, cfa, &ra, initr, sizeof(initr) / sizeof(initr[0]));
437  if (res == -1) return -1;
438 
439  ulong cfaLocation;
440 
441  if (dwarfcomputecfa(d, cfa, registers, &cfaLocation) == -1)
442  return -1;
443 
444  for (i = 0; i < nr; i++) {
445  switch (r[i].type) {
446  case RuleUndef:
447  werrstr("Undefined register slot %d", i);
448  assert(FALSE);
449  break;
450  case RuleSame:
451  break;
452  case RuleRegister:
453  registers->Registers[i] = registers->Registers[r[i].reg];
454  break;
455  case RuleRegOff: {
456  BOOLEAN success =
458  (d->pe->fd,
459  &registers->Registers[i],
460  r[i].offset + registers->Registers[r[i].reg],
461  d->addrsize);
462  if (!success) return -1;
463  } break;
464  case RuleCfaOffset:
465  {
466  BOOLEAN success =
468  (d->pe->fd,
469  &registers->Registers[i],
470  r[i].offset + cfaLocation,
471  d->addrsize);
472  werrstr("reg[%d] = %x: cfa offset (cfa %x, offset %x) -> @%x", i, (ulong)registers->Registers[i], cfaLocation, initr[i].offset, r[i].offset + cfaLocation);
473  if (!success) return -1;
474  } break;
475  default:
476  werrstr("We don't yet support cfa rule %d in slot %d", r[i].type, i);
477  assert(FALSE);
478  break;
479  }
480  }
481 
482  ulong cfaSpace[4];
483  for (i = 0; i < sizeof(cfaSpace) / sizeof(cfaSpace[0]); i++) {
485  (d->pe->fd, &cfaSpace[i], cfaLocation + (i * 4), d->addrsize);
486  }
487  werrstr("CFA(%x) [%08x, %08x, %08x, %08x]",
488  cfaLocation, cfaSpace[0], cfaSpace[1], cfaSpace[2], cfaSpace[3]);
489 
490  return 0;
491 }
#define werrstr(str,...)
Definition: compat.h:34
ULONG nr
Definition: thread.c:7
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
int dwarfcomputecfa(Dwarf *d, DwarfExpr *cfa, PROSSYM_REGISTERS registers, ulong *cfaLocation)
Definition: dwarfcfa.c:404
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define assert(x)
Definition: debug.h:53
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ROSSYM_CALLBACKS RosSymCallbacks
Definition: init.c:14
unsigned char BOOLEAN
int registers[NUMREGS]
#define d
Definition: ke_i.h:81
#define success(from, fromstr, to, tostr)
BOOLEAN(* MemGetProc)(PVOID FileContext, ULONG_PTR *Target, PVOID SourceMem, ULONG Size)
Definition: rossym.h:110
GLdouble s
Definition: gl.h:2039
int dwarfunwind(Dwarf *d, ulong pc, DwarfExpr *cfa, DwarfExpr *ra, DwarfExpr *r, int nr)
Definition: dwarfcfa.c:48
unsigned long ulong
Definition: linux.h:275
GLuint res
Definition: glext.h:9613

Referenced by RosSymGetAddressInformation().

◆ dwarfseeksym()

int dwarfseeksym ( Dwarf ,
ulong  ,
ulong  ,
DwarfSym  
)

Definition at line 171 of file dwarfinfo.c.

172 {
173  if(dwarfenumunit(d, unit, s) < 0)
174  return -1;
175  s->b.p = d->info.data + unit + off;
176  if(dwarfnextsymat(d, s, 0) != 1)
177  return -1;
178  return 0;
179 }
int dwarfenumunit(Dwarf *d, ulong unit, DwarfSym *s)
Definition: dwarfinfo.c:202
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
#define d
Definition: ke_i.h:81
int dwarfnextsymat(Dwarf *d, DwarfSym *s, int depth)
Definition: dwarfinfo.c:293
GLdouble s
Definition: gl.h:2039
off
Definition: i386-dis.c:3909