Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendwarfinfo.c
Go to the documentation of this file.
00001 /* 00002 * Dwarf info parse and search. 00003 */ 00004 00005 #define NTOSAPI 00006 #include <ntifs.h> 00007 #include <ndk/ntndk.h> 00008 #include <reactos/rossym.h> 00009 #include "rossympriv.h" 00010 #include <ntimage.h> 00011 00012 #define NDEBUG 00013 #include <debug.h> 00014 00015 #include "dwarf.h" 00016 #include <windef.h> 00017 00018 enum 00019 { 00020 DwarfAttrSibling = 0x01, 00021 DwarfAttrLocation = 0x02, 00022 DwarfAttrName = 0x03, 00023 DwarfAttrOrdering = 0x09, 00024 DwarfAttrByteSize = 0x0B, 00025 DwarfAttrBitOffset = 0x0C, 00026 DwarfAttrBitSize = 0x0D, 00027 DwarfAttrStmtList = 0x10, 00028 DwarfAttrLowpc = 0x11, 00029 DwarfAttrHighpc = 0x12, 00030 DwarfAttrLanguage = 0x13, 00031 DwarfAttrDiscr = 0x15, 00032 DwarfAttrDiscrValue = 0x16, 00033 DwarfAttrVisibility = 0x17, 00034 DwarfAttrImport = 0x18, 00035 DwarfAttrStringLength = 0x19, 00036 DwarfAttrCommonRef = 0x1A, 00037 DwarfAttrCompDir = 0x1B, 00038 DwarfAttrConstValue = 0x1C, 00039 DwarfAttrContainingType = 0x1D, 00040 DwarfAttrDefaultValue = 0x1E, 00041 DwarfAttrInline = 0x20, 00042 DwarfAttrIsOptional = 0x21, 00043 DwarfAttrLowerBound = 0x22, 00044 DwarfAttrProducer = 0x25, 00045 DwarfAttrPrototyped = 0x27, 00046 DwarfAttrReturnAddr = 0x2A, 00047 DwarfAttrStartScope = 0x2C, 00048 DwarfAttrStrideSize = 0x2E, 00049 DwarfAttrUpperBound = 0x2F, 00050 DwarfAttrAbstractOrigin = 0x31, 00051 DwarfAttrAccessibility = 0x32, 00052 DwarfAttrAddrClass = 0x33, 00053 DwarfAttrArtificial = 0x34, 00054 DwarfAttrBaseTypes = 0x35, 00055 DwarfAttrCalling = 0x36, 00056 DwarfAttrCount = 0x37, 00057 DwarfAttrDataMemberLoc = 0x38, 00058 DwarfAttrDeclColumn = 0x39, 00059 DwarfAttrDeclFile = 0x3A, 00060 DwarfAttrDeclLine = 0x3B, 00061 DwarfAttrDeclaration = 0x3C, 00062 DwarfAttrDiscrList = 0x3D, 00063 DwarfAttrEncoding = 0x3E, 00064 DwarfAttrExternal = 0x3F, 00065 DwarfAttrFrameBase = 0x40, 00066 DwarfAttrFriend = 0x41, 00067 DwarfAttrIdentifierCase = 0x42, 00068 DwarfAttrMacroInfo = 0x43, 00069 DwarfAttrNamelistItem = 0x44, 00070 DwarfAttrPriority = 0x45, 00071 DwarfAttrSegment = 0x46, 00072 DwarfAttrSpecification = 0x47, 00073 DwarfAttrStaticLink = 0x48, 00074 DwarfAttrType = 0x49, 00075 DwarfAttrUseLocation = 0x4A, 00076 DwarfAttrVarParam = 0x4B, 00077 DwarfAttrVirtuality = 0x4C, 00078 DwarfAttrVtableElemLoc = 0x4D, 00079 DwarfAttrAllocated = 0x4E, 00080 DwarfAttrAssociated = 0x4F, 00081 DwarfAttrDataLocation = 0x50, 00082 DwarfAttrStride = 0x51, 00083 DwarfAttrEntrypc = 0x52, 00084 DwarfAttrUseUTF8 = 0x53, 00085 DwarfAttrExtension = 0x54, 00086 DwarfAttrRanges = 0x55, 00087 DwarfAttrTrampoline = 0x56, 00088 DwarfAttrCallColumn = 0x57, 00089 DwarfAttrCallFile = 0x58, 00090 DwarfAttrCallLine = 0x59, 00091 DwarfAttrDescription = 0x5A, 00092 DwarfAttrMax, 00093 00094 FormAddr = 0x01, 00095 FormDwarfBlock2 = 0x03, 00096 FormDwarfBlock4 = 0x04, 00097 FormData2 = 0x05, 00098 FormData4 = 0x06, 00099 FormData8 = 0x07, 00100 FormString = 0x08, 00101 FormDwarfBlock = 0x09, 00102 FormDwarfBlock1 = 0x0A, 00103 FormData1 = 0x0B, 00104 FormFlag = 0x0C, 00105 FormSdata = 0x0D, 00106 FormStrp = 0x0E, 00107 FormUdata = 0x0F, 00108 FormRefAddr = 0x10, 00109 FormRef1 = 0x11, 00110 FormRef2 = 0x12, 00111 FormRef4 = 0x13, 00112 FormRef8 = 0x14, 00113 FormRefUdata = 0x15, 00114 FormIndirect = 0x16 00115 }; 00116 00117 static int parseattrs(DwarfBuf*, ulong, DwarfAbbrev*, DwarfAttrs*); 00118 static int getulong(DwarfBuf*, int, ulong, ulong*, int*); 00119 static int getuchar(DwarfBuf*, int, uchar*); 00120 static int getstring(DwarfBuf*, int, char**); 00121 static int getblock(DwarfBuf*, int, DwarfBlock*); 00122 static int skipform(DwarfBuf*, int); 00123 static int constblock(Dwarf*, DwarfBlock*, ulong*); 00124 00125 int 00126 dwarflookupnameinunit(Dwarf *d, ulong unit, char *name, DwarfSym *s) 00127 { 00128 if(dwarfenumunit(d, unit, s) < 0) 00129 return -1; 00130 00131 dwarfnextsymat(d, s, 0); /* s is now the CompileUnit */ 00132 while(dwarfnextsymat(d, s, 1) == 1) 00133 if(s->attrs.name && strcmp(s->attrs.name, name) == 0) 00134 return 0; 00135 werrstr("symbol '%s' not found", name); 00136 return -1; 00137 } 00138 00139 00140 int 00141 dwarflookupsubname(Dwarf *d, DwarfSym *parent, char *name, DwarfSym *s) 00142 { 00143 *s = *parent; 00144 while(dwarfnextsymat(d, s, parent->depth+1)) 00145 if(s->attrs.name && strcmp(s->attrs.name, name) == 0) 00146 return 0; 00147 werrstr("symbol '%s' not found", name); 00148 return -1; 00149 } 00150 00151 int 00152 dwarflookuptag(Dwarf *d, ulong unit, ulong tag, DwarfSym *s) 00153 { 00154 if(dwarfenumunit(d, unit, s) < 0) { 00155 return -1; 00156 } 00157 00158 dwarfnextsymat(d, s, 0); /* s is now the CompileUnit */ 00159 if(s->attrs.tag == tag) { 00160 return 0; 00161 } 00162 while(dwarfnextsymat(d, s, 1) == 1) 00163 if(s->attrs.tag == tag) { 00164 return 0; 00165 } 00166 werrstr("symbol with tag 0x%lux not found", tag); 00167 return -1; 00168 } 00169 00170 int 00171 dwarfseeksym(Dwarf *d, ulong unit, ulong off, DwarfSym *s) 00172 { 00173 if(dwarfenumunit(d, unit, s) < 0) 00174 return -1; 00175 s->b.p = d->info.data + unit + off; 00176 if(dwarfnextsymat(d, s, 0) != 1) 00177 return -1; 00178 return 0; 00179 } 00180 00181 int 00182 dwarflookupfn(Dwarf *d, ulong unit, ulong pc, DwarfSym *s) 00183 { 00184 if(dwarfenumunit(d, unit, s) < 0) 00185 return -1; 00186 00187 if(dwarfnextsymat(d, s, 0) != 1) 00188 return -1; 00189 /* s is now the CompileUnit */ 00190 00191 while(dwarfnextsymat(d, s, 1) == 1){ 00192 if(s->attrs.tag != TagSubprogram) 00193 continue; 00194 if(s->attrs.lowpc <= pc && pc < s->attrs.highpc) 00195 return 0; 00196 } 00197 werrstr("fn containing pc 0x%lux not found", pc); 00198 return -1; 00199 } 00200 00201 int 00202 dwarfenumunit(Dwarf *d, ulong unit, DwarfSym *s) 00203 { 00204 int i; 00205 ulong aoff, len; 00206 00207 if(unit >= d->info.len){ 00208 werrstr("dwarf unit address 0x%x >= 0x%x out of range", unit, d->info.len); 00209 return -1; 00210 } 00211 memset(s, 0, sizeof *s); 00212 memset(&s->b, 0, sizeof s->b); 00213 00214 s->b.d = d; 00215 s->b.p = d->info.data + unit; 00216 s->b.ep = d->info.data + d->info.len; 00217 len = dwarfget4(&s->b); 00218 s->nextunit = unit + 4 + len; 00219 00220 if(s->b.ep - s->b.p < len){ 00221 badheader: 00222 werrstr("bad dwarf unit header at unit 0x%lux", unit); 00223 return -1; 00224 } 00225 s->b.ep = s->b.p+len; 00226 if((i=dwarfget2(&s->b)) != 2) 00227 goto badheader; 00228 aoff = dwarfget4(&s->b); 00229 s->b.addrsize = dwarfget1(&s->b); 00230 if(d->addrsize == 0) 00231 d->addrsize = s->b.addrsize; 00232 if(s->b.p == nil) 00233 goto badheader; 00234 00235 s->aoff = aoff; 00236 s->unit = unit; 00237 s->depth = 0; 00238 return 0; 00239 } 00240 00241 int 00242 dwarfenum(Dwarf *d, DwarfSym *s) 00243 { 00244 if(dwarfenumunit(d, 0, s) < 0) 00245 return -1; 00246 s->allunits = 1; 00247 return 0; 00248 } 00249 00250 int 00251 dwarfnextsym(Dwarf *d, DwarfSym *s) 00252 { 00253 ulong num; 00254 DwarfAbbrev *a; 00255 00256 if(s->attrs.haskids) 00257 s->depth++; 00258 top: 00259 if(s->b.p >= s->b.ep){ 00260 if(s->allunits && s->nextunit < d->info.len){ 00261 if(dwarfenumunit(d, s->nextunit, s) < 0) { 00262 return -1; 00263 } 00264 s->allunits = 1; 00265 goto top; 00266 } 00267 return 0; 00268 } 00269 00270 s->uoff = s->b.p - (d->info.data+s->unit); 00271 num = dwarfget128(&s->b); 00272 if(num == 0){ 00273 if(s->depth == 0) { 00274 return 0; 00275 } 00276 if(s->depth > 0) 00277 s->depth--; 00278 goto top; 00279 } 00280 00281 a = dwarfgetabbrev(d, s->aoff, num); 00282 if(a == nil){ 00283 werrstr("getabbrev %ud %ud for %ud,%ud: %r\n", s->aoff, num, s->unit, s->uoff); 00284 return -1; 00285 } 00286 if(parseattrs(&s->b, s->unit, a, &s->attrs) < 0) { 00287 return -1; 00288 } 00289 return 1; 00290 } 00291 00292 int 00293 dwarfnextsymat(Dwarf *d, DwarfSym *s, int depth) 00294 { 00295 int r; 00296 DwarfSym t; 00297 uint sib; 00298 00299 if(s->depth == depth && s->attrs.have.sibling){ 00300 sib = s->attrs.sibling; 00301 if(sib < d->info.len && d->info.data+sib >= s->b.p) 00302 s->b.p = d->info.data+sib; 00303 s->attrs.haskids = 0; 00304 } 00305 00306 /* 00307 * The funny game with t and s make sure that 00308 * if we get to the end of a run of a particular 00309 * depth, we leave s so that a call to nextsymat with depth-1 00310 * will actually produce the desired guy. We could change 00311 * the interface to dwarfnextsym instead, but I'm scared 00312 * to touch it. 00313 */ 00314 t = *s; 00315 for(;;){ 00316 if((r = dwarfnextsym(d, &t)) != 1) { 00317 return r; 00318 } 00319 if(t.depth < depth){ 00320 /* went too far - nothing to see */ 00321 return 0; 00322 } 00323 *s = t; 00324 if(t.depth == depth) { 00325 return 1; 00326 } 00327 } 00328 } 00329 00330 typedef struct Parse Parse; 00331 struct Parse { 00332 int name; 00333 int off; 00334 int haveoff; 00335 int type; 00336 }; 00337 00338 #define OFFSET(x) offsetof(DwarfAttrs, x), offsetof(DwarfAttrs, have.x) 00339 00340 static Parse plist[] = { /* Font Tab 4 */ 00341 { DwarfAttrAbstractOrigin, OFFSET(abstractorigin), TReference }, 00342 { DwarfAttrAccessibility, OFFSET(accessibility), TConstant }, 00343 { DwarfAttrAddrClass, OFFSET(addrclass), TConstant }, 00344 { DwarfAttrArtificial, OFFSET(isartificial), TFlag }, 00345 { DwarfAttrBaseTypes, OFFSET(basetypes), TReference }, 00346 { DwarfAttrBitOffset, OFFSET(bitoffset), TConstant }, 00347 { DwarfAttrBitSize, OFFSET(bitsize), TConstant }, 00348 { DwarfAttrByteSize, OFFSET(bytesize), TConstant }, 00349 { DwarfAttrCalling, OFFSET(calling), TConstant }, 00350 { DwarfAttrCommonRef, OFFSET(commonref), TReference }, 00351 { DwarfAttrCompDir, OFFSET(compdir), TString }, 00352 { DwarfAttrConstValue, OFFSET(constvalue), TString|TConstant|TBlock }, 00353 { DwarfAttrContainingType, OFFSET(containingtype), TReference }, 00354 { DwarfAttrCount, OFFSET(count), TConstant|TReference }, 00355 { DwarfAttrDataMemberLoc, OFFSET(datamemberloc), TBlock|TConstant|TReference }, 00356 { DwarfAttrDeclColumn, OFFSET(declcolumn), TConstant }, 00357 { DwarfAttrDeclFile, OFFSET(declfile), TConstant }, 00358 { DwarfAttrDeclLine, OFFSET(declline), TConstant }, 00359 { DwarfAttrDeclaration, OFFSET(isdeclaration), TFlag }, 00360 { DwarfAttrDefaultValue, OFFSET(defaultvalue), TReference }, 00361 { DwarfAttrDiscr, OFFSET(discr), TReference }, 00362 { DwarfAttrDiscrList, OFFSET(discrlist), TBlock }, 00363 { DwarfAttrDiscrValue, OFFSET(discrvalue), TConstant }, 00364 { DwarfAttrEncoding, OFFSET(encoding), TConstant }, 00365 { DwarfAttrExternal, OFFSET(isexternal), TFlag }, 00366 { DwarfAttrFrameBase, OFFSET(framebase), TBlock|TConstant }, 00367 { DwarfAttrFriend, OFFSET(friend), TReference }, 00368 { DwarfAttrHighpc, OFFSET(highpc), TAddress }, 00369 { DwarfAttrEntrypc, OFFSET(entrypc), TAddress }, 00370 { DwarfAttrIdentifierCase, OFFSET(identifiercase), TConstant }, 00371 { DwarfAttrImport, OFFSET(import), TReference }, 00372 { DwarfAttrInline, OFFSET(inlined), TConstant }, 00373 { DwarfAttrIsOptional, OFFSET(isoptional), TFlag }, 00374 { DwarfAttrLanguage, OFFSET(language), TConstant }, 00375 { DwarfAttrLocation, OFFSET(location), TBlock|TConstant }, 00376 { DwarfAttrLowerBound, OFFSET(lowerbound), TConstant|TReference }, 00377 { DwarfAttrLowpc, OFFSET(lowpc), TAddress }, 00378 { DwarfAttrMacroInfo, OFFSET(macroinfo), TConstant }, 00379 { DwarfAttrName, OFFSET(name), TString }, 00380 { DwarfAttrNamelistItem, OFFSET(namelistitem), TBlock }, 00381 { DwarfAttrOrdering, OFFSET(ordering), TConstant }, 00382 { DwarfAttrPriority, OFFSET(priority), TReference }, 00383 { DwarfAttrProducer, OFFSET(producer), TString }, 00384 { DwarfAttrPrototyped, OFFSET(isprototyped), TFlag }, 00385 { DwarfAttrRanges, OFFSET(ranges), TReference }, 00386 { DwarfAttrReturnAddr, OFFSET(returnaddr), TBlock|TConstant }, 00387 { DwarfAttrSegment, OFFSET(segment), TBlock|TConstant }, 00388 { DwarfAttrSibling, OFFSET(sibling), TReference }, 00389 { DwarfAttrSpecification, OFFSET(specification), TReference }, 00390 { DwarfAttrStartScope, OFFSET(startscope), TConstant }, 00391 { DwarfAttrStaticLink, OFFSET(staticlink), TBlock|TConstant }, 00392 { DwarfAttrStmtList, OFFSET(stmtlist), TConstant }, 00393 { DwarfAttrStrideSize, OFFSET(stridesize), TConstant }, 00394 { DwarfAttrStringLength, OFFSET(stringlength), TBlock|TConstant }, 00395 { DwarfAttrType, OFFSET(type), TReference }, 00396 { DwarfAttrUpperBound, OFFSET(upperbound), TConstant|TReference }, 00397 { DwarfAttrUseLocation, OFFSET(uselocation), TBlock|TConstant }, 00398 { DwarfAttrVarParam, OFFSET(isvarparam), TFlag }, 00399 { DwarfAttrVirtuality, OFFSET(virtuality), TConstant }, 00400 { DwarfAttrVisibility, OFFSET(visibility), TConstant }, 00401 { DwarfAttrVtableElemLoc, OFFSET(vtableelemloc), TBlock|TReference }, 00402 { } 00403 }; 00404 00405 static Parse ptab[DwarfAttrMax]; 00406 00407 static int 00408 parseattrs(DwarfBuf *b, ulong unit, DwarfAbbrev *a, DwarfAttrs *attrs) 00409 { 00410 int i, f, n, got; 00411 static int nbad; 00412 void *v; 00413 00414 /* initialize ptab first time through for quick access */ 00415 if(ptab[DwarfAttrName].name != DwarfAttrName) 00416 for(i=0; plist[i].name; i++) 00417 ptab[plist[i].name] = plist[i]; 00418 00419 memset(attrs, 0, sizeof *attrs); 00420 attrs->tag = a->tag; 00421 attrs->haskids = a->haskids; 00422 00423 for(i=0; i<a->nattr; i++){ 00424 n = a->attr[i].name; 00425 f = a->attr[i].form; 00426 if(n < 0 || n >= DwarfAttrMax || ptab[n].name==0){ 00427 if(++nbad == 1) 00428 werrstr("dwarf parse attrs: unexpected attribute name 0x%x", n); 00429 continue; //return -1; 00430 } 00431 v = (char*)attrs + ptab[n].off; 00432 got = 0; 00433 if(f == FormIndirect) 00434 f = dwarfget128(b); 00435 if((ptab[n].type&(TConstant|TReference|TAddress)) 00436 && getulong(b, f, unit, v, &got) >= 0) 00437 ; 00438 else if((ptab[n].type&TFlag) && getuchar(b, f, v) >= 0) 00439 got = TFlag; 00440 else if((ptab[n].type&TString) && getstring(b, f, v) >= 0) 00441 got = TString; 00442 else if((ptab[n].type&TBlock) && getblock(b, f, v) >= 0) 00443 got = TBlock; 00444 else{ 00445 if(skipform(b, f) < 0){ 00446 if(++nbad == 1) 00447 werrstr("dwarf parse attrs: cannot skip form %d", f); 00448 return -1; 00449 } 00450 } 00451 if(got == TBlock && (ptab[n].type&TConstant)) 00452 got = constblock(b->d, v, v); 00453 *((uchar*)attrs+ptab[n].haveoff) = got; 00454 } 00455 return 0; 00456 } 00457 00458 static int 00459 getulong(DwarfBuf *b, int form, ulong unit, ulong *u, int *type) 00460 { 00461 static int nbad; 00462 uvlong uv; 00463 00464 switch(form){ 00465 default: 00466 return -1; 00467 00468 /* addresses */ 00469 case FormAddr: 00470 *type = TAddress; 00471 *u = dwarfgetaddr(b); 00472 return 0; 00473 00474 /* references */ 00475 case FormRefAddr: 00476 /* absolute ref in .debug_info */ 00477 *type = TReference; 00478 *u = dwarfgetaddr(b); 00479 return 0; 00480 case FormRef1: 00481 *u = dwarfget1(b); 00482 goto relativeref; 00483 case FormRef2: 00484 *u = dwarfget2(b); 00485 goto relativeref; 00486 case FormRef4: 00487 *u = dwarfget4(b); 00488 goto relativeref; 00489 case FormRef8: 00490 *u = dwarfget8(b); 00491 goto relativeref; 00492 case FormRefUdata: 00493 *u = dwarfget128(b); 00494 relativeref: 00495 *u += unit; 00496 *type = TReference; 00497 return 0; 00498 00499 /* constants */ 00500 case FormData1: 00501 *u = dwarfget1(b); 00502 goto constant; 00503 case FormData2: 00504 *u = dwarfget2(b); 00505 goto constant; 00506 case FormData4: 00507 *u = dwarfget4(b); 00508 goto constant; 00509 case FormData8: 00510 uv = dwarfget8(b); 00511 *u = uv; 00512 if(uv != *u && ++nbad == 1) 00513 werrstr("dwarf: truncating 64-bit attribute constants"); 00514 goto constant; 00515 case FormSdata: 00516 *u = dwarfget128s(b); 00517 goto constant; 00518 case FormUdata: 00519 *u = dwarfget128(b); 00520 constant: 00521 *type = TConstant; 00522 return 0; 00523 } 00524 } 00525 00526 static int 00527 getuchar(DwarfBuf *b, int form, uchar *u) 00528 { 00529 switch(form){ 00530 default: 00531 return -1; 00532 00533 case FormFlag: 00534 *u = dwarfget1(b); 00535 return 0; 00536 } 00537 } 00538 00539 static int 00540 getstring(DwarfBuf *b, int form, char **s) 00541 { 00542 static int nbad; 00543 ulong u; 00544 00545 switch(form){ 00546 default: 00547 return -1; 00548 00549 case FormString: 00550 *s = dwarfgetstring(b); 00551 return 0; 00552 00553 case FormStrp: 00554 u = dwarfget4(b); 00555 if(u >= b->d->str.len){ 00556 if(++nbad == 1) 00557 werrstr("dwarf: bad string pointer 0x%lux in attribute", u); 00558 /* don't return error - maybe can proceed */ 00559 *s = nil; 00560 }else 00561 *s = (char*)b->d->str.data + u; 00562 return 0; 00563 00564 } 00565 } 00566 00567 static int 00568 getblock(DwarfBuf *b, int form, DwarfBlock *bl) 00569 { 00570 ulong n; 00571 00572 switch(form){ 00573 default: 00574 return -1; 00575 case FormDwarfBlock: 00576 n = dwarfget128(b); 00577 goto copyn; 00578 case FormDwarfBlock1: 00579 n = dwarfget1(b); 00580 goto copyn; 00581 case FormDwarfBlock2: 00582 n = dwarfget2(b); 00583 goto copyn; 00584 case FormDwarfBlock4: 00585 n = dwarfget4(b); 00586 copyn: 00587 bl->data = dwarfgetnref(b, n); 00588 bl->len = n; 00589 if(bl->data == nil) 00590 return -1; 00591 return 0; 00592 } 00593 } 00594 00595 static int 00596 constblock(Dwarf *d, DwarfBlock *bl, ulong *pval) 00597 { 00598 DwarfBuf b; 00599 00600 memset(&b, 0, sizeof b); 00601 b.p = bl->data; 00602 b.ep = bl->data+bl->len; 00603 b.d = d; 00604 00605 switch(dwarfget1(&b)){ 00606 case OpAddr: 00607 *pval = dwarfgetaddr(&b); 00608 return TConstant; 00609 case OpConst1u: 00610 *pval = dwarfget1(&b); 00611 return TConstant; 00612 case OpConst1s: 00613 *pval = (schar)dwarfget1(&b); 00614 return TConstant; 00615 case OpConst2u: 00616 *pval = dwarfget2(&b); 00617 return TConstant; 00618 case OpConst2s: 00619 *pval = (s16int)dwarfget2(&b); 00620 return TConstant; 00621 case OpConst4u: 00622 *pval = dwarfget4(&b); 00623 return TConstant; 00624 case OpConst4s: 00625 *pval = (s32int)dwarfget4(&b); 00626 return TConstant; 00627 case OpConst8u: 00628 *pval = (u64int)dwarfget8(&b); 00629 return TConstant; 00630 case OpConst8s: 00631 *pval = (s64int)dwarfget8(&b); 00632 return TConstant; 00633 case OpConstu: 00634 *pval = dwarfget128(&b); 00635 return TConstant; 00636 case OpConsts: 00637 *pval = dwarfget128s(&b); 00638 return TConstant; 00639 case OpPlusUconst: 00640 *pval = dwarfget128(&b); 00641 return TConstant; 00642 default: 00643 return TBlock; 00644 } 00645 } 00646 00647 /* last resort */ 00648 static int 00649 skipform(DwarfBuf *b, int form) 00650 { 00651 int type; 00652 DwarfVal val; 00653 00654 if(getulong(b, form, 0, &val.c, &type) < 0 00655 && getuchar(b, form, (uchar*)&val) < 0 00656 && getstring(b, form, &val.s) < 0 00657 && getblock(b, form, &val.b) < 0) 00658 return -1; 00659 return 0; 00660 } 00661 Generated on Sat May 26 2012 04:35:18 for ReactOS by
1.7.6.1
|