这篇教程C++ symbol_debug函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中symbol_debug函数的典型用法代码示例。如果您正苦于以下问题:C++ symbol_debug函数的具体用法?C++ symbol_debug怎么用?C++ symbol_debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了symbol_debug函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: errorsymbol *except_gentables(){ //printf("except_gentables()/n"); if (config.ehmethod == EH_DM) { // BUG: alloca() changes the stack size, which is not reflected // in the fixed eh tables. if (Alloca.size) error(NULL, 0, 0, "cannot mix core.std.stdlib.alloca() and exception handling in %s()", funcsym_p->Sident); char name[13+5+1]; static int tmpnum; sprintf(name,"_HandlerTable%d",tmpnum++); symbol *s = symbol_name(name,SCstatic,tsint); symbol_keep(s); symbol_debug(s); except_fillInEHTable(s); outdata(s); // output the scope table objmod->ehtables(funcsym_p,funcsym_p->Ssize,s); } return NULL;}
开发者ID:TungstenHeart,项目名称:dmd,代码行数:26,
示例2: nteh_declarvarsvoid nteh_declarvars(Blockx *bx){ symbol *s;#if MARS if (!(bx->funcsym->Sfunc->Fflags3 & Fnteh)) // if haven't already done it { bx->funcsym->Sfunc->Fflags3 |= Fnteh; s = symbol_name(s_name_context,SCbprel,tsint); s->Soffset = -5 * 4; // -6 * 4 for C __try, __except, __finally s->Sflags |= SFLfree | SFLnodebug; type_setty(&s->Stype,mTYvolatile | TYint); symbol_add(s); bx->context = s; }#else if (!(funcsym_p->Sfunc->Fflags3 & Fnteh)) // if haven't already done it { funcsym_p->Sfunc->Fflags3 |= Fnteh; if (!s_context) s_context = scope_search(s_name_context_tag,CPP ? SCTglobal : SCTglobaltag); symbol_debug(s_context); s = symbol_name(s_name_context,SCbprel,s_context->Stype); s->Soffset = -6 * 4; // -5 * 4 for C++ s->Sflags |= SFLfree; symbol_add(s); type_setty(&s->Stype,mTYvolatile | TYstruct); s = symbol_name(s_name_ecode,SCauto,type_alloc(mTYvolatile | TYint)); s->Sflags |= SFLfree; symbol_add(s); }#endif}
开发者ID:spott,项目名称:dmd,代码行数:32,
示例3: win64_pdatavoid win64_pdata(Symbol *sf){// return; // doesn't work yet //printf("win64_pdata()/n"); assert(config.exe == EX_WIN64); // Generate the pdata name, which is $pdata$funcname size_t sflen = strlen(sf->Sident); char *pdata_name = (char *)alloca(7 + sflen + 1); assert(pdata_name); memcpy(pdata_name, "$pdata$", 7); memcpy(pdata_name + 7, sf->Sident, sflen + 1); // include terminating 0 symbol *spdata = symbol_name(pdata_name,SCstatic,tsint); symbol_keep(spdata); symbol_debug(spdata); symbol *sunwind = win64_unwind(sf); /* 3 pointers are emitted: * 1. pointer to start of function sf * 2. pointer past end of function sf * 3. pointer to unwind data */ dt_t **pdt = &spdata->Sdt; pdt = dtxoff(pdt,sf,0,TYint); // Note the TYint, these are 32 bit fixups pdt = dtxoff(pdt,sf,retoffset + retsize,TYint); pdt = dtxoff(pdt,sunwind,0,TYint); spdata->Sseg = symbol_iscomdat(sf) ? MsCoffObj::seg_pdata_comdat(sf) : MsCoffObj::seg_pdata(); spdata->Salignment = 4; outdata(spdata);}
开发者ID:AlexBezzubenko,项目名称:dmd,代码行数:35,
示例4: cpp_scopeSTATIC void cpp_scope(symbol *s){ /* scope ::= zname [ scope ] '?' decorated_name [ scope ] '?' lexical_frame [ scope ] '?' '$' template_name [ scope ] */ while (s) { char *p; symbol_debug(s); switch (s->Sclass) { case SCnamespace: cpp_zname(s->Sident); break; case SCstruct: cpp_zname(symbol_ident(s)); break; default: STR("?1?"); // Why? Who knows. cpp_decorated_name(s); break; }#if SCPP || MARS s = s->Sscope;#else break;#endif }}
开发者ID:AlbertLkn,项目名称:dmd,代码行数:34,
示例5: assertsymbol *except_gentables(){ //printf("except_gentables()/n"); if (OUREH) { // BUG: alloca() changes the stack size, which is not reflected // in the fixed eh tables. assert(!usedalloca); char name[13+5+1]; static int tmpnum; sprintf(name,"_HandlerTable%d",tmpnum++); symbol *s = symbol_name(name,SCstatic,tsint); symbol_keep(s); symbol_debug(s); except_fillInEHTable(s); outdata(s); // output the scope table objmod->ehtables(funcsym_p,funcsym_p->Ssize,s); } return NULL;}
开发者ID:Govelius,项目名称:dmd,代码行数:25,
示例6: symbol_debugchar *cpp_mangle(symbol *s){ symbol_debug(s); //printf("cpp_mangle(s = %p, '%s')/n", s, s->Sident); //type_print(s->Stype);#if SCPP if (!CPP) return symbol_ident(s);#endif if (type_mangle(s->Stype) != mTYman_cpp) return symbol_ident(s); else { MangleInuse m; mangle.znamei = 0; mangle.argi = 0; mangle.np = mangle.buf; mangle.buf[BUFIDMAX + 1] = 0x55; cpp_decorated_name(s); *mangle.np = 0; // 0-terminate cpp_name[] //dbg_printf("cpp_mangle() = '%s'/n", mangle.buf); assert(strlen(mangle.buf) <= BUFIDMAX); assert(mangle.buf[BUFIDMAX + 1] == 0x55); return mangle.buf; }}
开发者ID:AlbertLkn,项目名称:dmd,代码行数:29,
示例7: nteh_filltablesvoid nteh_filltables(){#if MARS symbol *s = s_table; symbol_debug(s); except_fillInEHTable(s);#endif}
开发者ID:spott,项目名称:dmd,代码行数:8,
示例8: type_hydratevoid type_hydrate(type **pt){ type *t; assert(pt); while (isdehydrated(*pt)) { t = (type *) ph_hydrate(pt); type_debug(t);#if !TX86 if (t->Tflags & TFhydrated) return;#if SOURCE_4TYPES t->Tsrcpos.Sfilnum += File_Hydrate_Num; /* file number relative header build */#endif t->Tflags |= TFhydrated;#endif switch (tybasic(t->Tty)) { case TYstruct: case TYenum: case TYmemptr: case TYvtshape: // Cannot assume symbol is hydrated, because entire HX file // may not have been hydrated. Classsym_hydrate(&t->Ttag); symbol_debug(t->Ttag); break; case TYident: ph_hydrate(&t->Tident); break; case TYtemplate: symbol_hydrate(&((typetemp_t *)t)->Tsym); param_hydrate(&t->Tparamtypes); break; case TYarray: if (t->Tflags & TFvla) el_hydrate(&t->Tel); break; default: if (tyfunc(t->Tty)) { param_hydrate(&t->Tparamtypes); list_hydrate(&t->Texcspec, (list_free_fp)type_hydrate); }#if SCPP else if (t->Talternate && typtr(t->Tty)) type_hydrate(&t->Talternate);#endif#if MARS else if (t->Tkey && typtr(t->Tty)) type_hydrate(&t->Tkey);#endif break; } pt = &t->Tnext; }}
开发者ID:michelf,项目名称:dmd,代码行数:57,
示例9: nteh_gentablesvoid nteh_gentables(Symbol *sfunc){ symbol *s = s_table; symbol_debug(s);#if MARS //except_fillInEHTable(s);#else /* NTEH table for C. * The table consists of triples: * parent index * filter address * handler address */ unsigned fsize = 4; // target size of function pointer DtBuilder dtb; int sz = 0; // size so far for (block *b = startblock; b; b = b->Bnext) { if (b->BC == BC_try) { block *bhandler; dtb.dword(b->Blast_index); // parent index // If try-finally if (b->numSucc() == 2) { dtb.dword(0); // filter address bhandler = b->nthSucc(1); assert(bhandler->BC == BC_finally); // To successor of BC_finally block bhandler = bhandler->nthSucc(0); } else // try-except { bhandler = b->nthSucc(1); assert(bhandler->BC == BC_filter); dtb.coff(bhandler->Boffset); // filter address bhandler = b->nthSucc(2); assert(bhandler->BC == BC_except); } dtb.coff(bhandler->Boffset); // handler address sz += 4 + fsize * 2; } } assert(sz != 0); s->Sdt = dtb.finish();#endif outdata(s); // output the scope table#if MARS nteh_framehandler(sfunc, s);#endif s_table = NULL;}
开发者ID:klickverbot,项目名称:dmd,代码行数:56,
示例10: nteh_gentablesvoid nteh_gentables(){ symbol *s = s_table; symbol_debug(s);#if MARS //except_fillInEHTable(s);#else /* NTEH table for C. * The table consists of triples: * parent index * filter address * handler address */ unsigned fsize = 4; // target size of function pointer dt_t **pdt = &s->Sdt; int sz = 0; // size so far for (block *b = startblock; b; b = b->Bnext) { if (b->BC == BC_try) { dt_t *dt; block *bhandler; pdt = dtdword(pdt,b->Blast_index); // parent index // If try-finally if (list_nitems(b->Bsucc) == 2) { pdt = dtdword(pdt,0); // filter address bhandler = list_block(list_next(b->Bsucc)); assert(bhandler->BC == BC_finally); // To successor of BC_finally block bhandler = list_block(bhandler->Bsucc); } else // try-except { bhandler = list_block(list_next(b->Bsucc)); assert(bhandler->BC == BC_filter); pdt = dtcoff(pdt,bhandler->Boffset); // filter address bhandler = list_block(list_next(list_next(b->Bsucc))); assert(bhandler->BC == BC_except); } pdt = dtcoff(pdt,bhandler->Boffset); // handler address sz += 4 + fsize * 2; } } assert(sz != 0);#endif outdata(s); // output the scope table#if MARS nteh_framehandler(s);#endif s_table = NULL;}
开发者ID:spott,项目名称:dmd,代码行数:55,
示例11: symbol_debugtype *type_allocmemptr(Classsym *stag,type *tn){ type *t; symbol_debug(stag); assert(stag->Sclass == SCstruct || tybasic(stag->Stype->Tty) == TYident); t = type_allocn(TYmemptr,tn); t->Ttag = stag; //printf("type_allocmemptr() = %p/n", t); //type_print(t); return t;}
开发者ID:michelf,项目名称:dmd,代码行数:11,
示例12: symbol_debugelem *nteh_setScopeTableIndex(Blockx *blx, int scope_index){ elem *e; Symbol *s; s = blx->context; symbol_debug(s); e = el_var(s); e->EV.sp.Voffset = nteh_offset_sindex(); return el_bin(OPeq, TYint, e, el_long(TYint, scope_index));}
开发者ID:spott,项目名称:dmd,代码行数:11,
示例13: assertsymbol *nteh_ecodesym(){ SYMIDX si; symbol *sp; for (si = 0; 1; si++) { assert(si < globsym.top); sp = globsym.tab[si]; symbol_debug(sp); if (strcmp(sp->Sident,s_name_ecode) == 0) return sp; }}
开发者ID:spott,项目名称:dmd,代码行数:12,
示例14: cpp_this_typeSTATIC void cpp_this_type(type *tfunc,Classsym *stag){ type *t; type_debug(tfunc); symbol_debug(stag);#if MARS t = type_pointer(stag->Stype);#else t = cpp_thistype(tfunc,stag);#endif //cpp_data_indirect_type(t); cpp_ecsu_data_indirect_type(t); type_free(t);}
开发者ID:AlbertLkn,项目名称:dmd,代码行数:14,
示例15: cpp_this_typeSTATIC void cpp_this_type(type *tfunc,Classsym *stag){ type *t; type_debug(tfunc); symbol_debug(stag);#if MARS t = type_allocn(TYnptr, stag->Stype); t->Tcount++;#else t = cpp_thistype(tfunc,stag);#endif //cpp_data_indirect_type(t); cpp_ecsu_data_indirect_type(t); type_free(t);}
开发者ID:ckamm,项目名称:dmd,代码行数:15,
示例16: type_hydratevoid type_hydrate(type **pt){ type *t; assert(pt); while (isdehydrated(*pt)) { t = (type *) ph_hydrate(pt); type_debug(t); switch (tybasic(t->Tty)) { case TYstruct: case TYenum: case TYmemptr: case TYvtshape: // Cannot assume symbol is hydrated, because entire HX file // may not have been hydrated. Classsym_hydrate(&t->Ttag); symbol_debug(t->Ttag); break; case TYident: ph_hydrate(&t->Tident); break; case TYtemplate: symbol_hydrate(&((typetemp_t *)t)->Tsym); param_hydrate(&t->Tparamtypes); break; case TYarray: if (t->Tflags & TFvla) el_hydrate(&t->Tel); break; default: if (tyfunc(t->Tty)) { param_hydrate(&t->Tparamtypes); list_hydrate(&t->Texcspec, (list_free_fp)type_hydrate); } else if (t->Talternate && typtr(t->Tty)) type_hydrate(&t->Talternate); else if (t->Tkey && typtr(t->Tty)) type_hydrate(&t->Tkey); break; } pt = &t->Tnext; }}
开发者ID:marler8997,项目名称:dmd,代码行数:45,
示例17: nteh_framehandlervoid nteh_framehandler(symbol *scopetable){ code *c; // Generate: // MOV EAX,&scope_table // JMP __cpp_framehandler if (scopetable) { symbol_debug(scopetable); c = gencs(NULL,0xB8+AX,0,FLextern,scopetable); // MOV EAX,&scope_table gencs(c,0xE9,0,FLfunc,rtlsym[RTLSYM_CPP_HANDLER]); // JMP __cpp_framehandler pinholeopt(c,NULL); codout(c); code_free(c); }}
开发者ID:spott,项目名称:dmd,代码行数:18,
示例18: strlenSymbol *win64_unwind(Symbol *sf){ // Generate the unwind name, which is $unwind$funcname size_t sflen = strlen(sf->Sident); char *unwind_name = (char *)alloca(8 + sflen + 1); assert(unwind_name); memcpy(unwind_name, "$unwind$", 8); memcpy(unwind_name + 8, sf->Sident, sflen + 1); // include terminating 0 symbol *sunwind = symbol_name(unwind_name,SCstatic,tsint); symbol_keep(sunwind); symbol_debug(sunwind); sunwind->Sdt = unwind_data(); sunwind->Sseg = symbol_iscomdat(sf) ? MsCoffObj::seg_xdata_comdat(sf) : MsCoffObj::seg_xdata(); sunwind->Salignment = 1; outdata(sunwind); return sunwind;}
开发者ID:AlexBezzubenko,项目名称:dmd,代码行数:19,
示例19: nteh_framehandlervoid nteh_framehandler(symbol *scopetable){ // Generate: // MOV EAX,&scope_table // JMP __cpp_framehandler if (scopetable) { symbol_debug(scopetable); code *c = gencs(NULL,0xB8+AX,0,FLextern,scopetable); // MOV EAX,&scope_table#if MARS gencs(c,0xE9,0,FLfunc,getRtlsym(RTLSYM_D_HANDLER)); // JMP _d_framehandler#else gencs(c,0xE9,0,FLfunc,getRtlsym(RTLSYM_CPP_HANDLER)); // JMP __cpp_framehandler#endif pinholeopt(c,NULL); codout(c); code_free(c); }}
开发者ID:TungstenHeart,项目名称:dmd,代码行数:21,
示例20: assertsymbol *except_gentables(){ //printf("except_gentables()/n");#if OUREH // BUG: alloca() changes the stack size, which is not reflected // in the fixed eh tables. assert(!usedalloca); symbol *s = symbol_generate(SCstatic,tsint); s->Sseg = UNKNOWN; symbol_keep(s); symbol_debug(s); except_fillInEHTable(s); outdata(s); // output the scope table obj_ehtables(funcsym_p,funcsym_p->Ssize,s);#endif return NULL;}
开发者ID:nischu7,项目名称:dmd,代码行数:22,
示例21: nteh_framehandlervoid nteh_framehandler(Symbol *sfunc, Symbol *scopetable){ // Generate: // MOV EAX,&scope_table // JMP __cpp_framehandler if (scopetable) { symbol_debug(scopetable); CodeBuilder cdb; cdb.gencs(0xB8+AX,0,FLextern,scopetable); // MOV EAX,&scope_table#if MARS cdb.gencs(0xE9,0,FLfunc,getRtlsym(RTLSYM_D_HANDLER)); // JMP _d_framehandler#else cdb.gencs(0xE9,0,FLfunc,getRtlsym(RTLSYM_CPP_HANDLER)); // JMP __cpp_framehandler#endif code *c = cdb.finish(); pinholeopt(c,NULL); codout(sfunc->Sseg,c); code_free(c); }}
开发者ID:klickverbot,项目名称:dmd,代码行数:23,
示例22: assertsymbol *except_gentables(){ //printf("except_gentables()/n");#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_SOLARIS symbol *s; int sz; // size so far dt_t **pdt; unsigned fsize; // target size of function pointer long spoff; block *b; int guarddim; int i; // BUG: alloca() changes the stack size, which is not reflected // in the fixed eh tables. assert(!usedalloca); s = symbol_generate(SCstatic,tsint); s->Sseg = UNKNOWN; symbol_keep(s); symbol_debug(s); fsize = 4; pdt = &s->Sdt; sz = 0; /* void* pointer to start of function unsigned offset of ESP from EBP unsigned offset from start of function to return code unsigned nguards; // dimension of guard[] { unsigned offset; // offset of start of guarded section unsigned endoffset; // ending offset of guarded section int last_index; // previous index (enclosing guarded section) unsigned catchoffset; // offset to catch block from symbol void *finally; // finally code to execute } guard[]; catchoffset: unsigned ncatches; // number of catch blocks { void *type; // symbol representing type unsigned bpoffset; // EBP offset of catch variable void *handler; // catch handler code } catch[]; */#define GUARD_SIZE 5 // number of 4 byte values in one guard sz = 0; // Address of start of function symbol_debug(funcsym_p); pdt = dtxoff(pdt,funcsym_p,0,TYnptr); sz += fsize; //printf("ehtables: func = %s, offset = x%x, startblock->Boffset = x%x/n", funcsym_p->Sident, funcsym_p->Soffset, startblock->Boffset); // Get offset of ESP from EBP spoff = cod3_spoff(); pdt = dtdword(pdt,spoff); sz += 4; // Offset from start of function to return code pdt = dtdword(pdt,retoffset); sz += 4; // First, calculate starting catch offset guarddim = 0; // max dimension of guard[] for (b = startblock; b; b = b->Bnext) { if (b->BC == BC_try && b->Bscope_index >= guarddim) guarddim = b->Bscope_index + 1;// printf("b->BC = %2d, Bscope_index = %2d, last_index = %2d, offset = x%x/n",// b->BC, b->Bscope_index, b->Blast_index, b->Boffset); } pdt = dtdword(pdt,guarddim); sz += 4; unsigned catchoffset = sz + guarddim * (GUARD_SIZE * 4); // Generate guard[] i = 0; for (b = startblock; b; b = b->Bnext) { //printf("b = %p, b->Btry = %p, b->offset = %x/n", b, b->Btry, b->Boffset); if (b->BC == BC_try) { dt_t *dt; block *bhandler; int nsucc; unsigned endoffset; block *bn; assert(b->Bscope_index >= i); if (i < b->Bscope_index) { int fillsize = (b->Bscope_index - i) * (GUARD_SIZE * 4); pdt = dtnzeros(pdt, fillsize); sz += fillsize; } i = b->Bscope_index + 1; nsucc = list_nitems(b->Bsucc);//.........这里部分代码省略.........
开发者ID:Geod24,项目名称:dnet,代码行数:101,
示例23: dtsymsizevoid dtsymsize(symbol *s){ symbol_debug(s); s->Sdt = dt_calloc(DT_symsize);}
开发者ID:Govelius,项目名称:dmd,代码行数:5,
示例24: outdatavoid outdata(symbol *s){#if HTOD return;#endif dt_t *dtstart,*dt; targ_size_t datasize,a; int seg; targ_size_t offset; int flags; char *p; tym_t ty; int tls; symbol_debug(s);#ifdef DEBUG debugy && dbg_printf("outdata('%s')/n",s->Sident);#endif //printf("outdata('%s', ty=x%x)/n",s->Sident,s->Stype->Tty); //symbol_print(s); // Data segment variables are always live on exit from a function s->Sflags |= SFLlivexit; dtstart = s->Sdt; s->Sdt = NULL; // it will be free'd#if SCPP && TARGET_WINDOS if (eecontext.EEcompile) { s->Sfl = (s->ty() & mTYfar) ? FLfardata : FLextern; s->Sseg = UNKNOWN; goto Lret; // don't output any data }#endif datasize = 0; tls = 0; ty = s->ty(); if (ty & mTYexport && config.wflags & WFexpdef && s->Sclass != SCstatic) obj_export(s,0); // export data definition for (dt = dtstart; dt; dt = dt->DTnext) { //printf("dt = %p, dt = %d/n",dt,dt->dt); switch (dt->dt) { case DT_abytes: { // Put out the data for the string, and // reserve a spot for a pointer to that string#if ELFOBJ || MACHOBJ datasize += size(dt->Dty); dt->DTabytes += elf_data_cdata(dt->DTpbytes,dt->DTnbytes,&dt->DTseg);#else targ_size_t *poffset; datasize += size(dt->Dty); if (tybasic(dt->Dty) == TYcptr) { seg = cseg; poffset = &Coffset; }#if SCPP else if (tybasic(dt->Dty) == TYfptr && dt->DTnbytes > config.threshold) { seg = obj_fardata(s->Sident,dt->DTnbytes,&offset); poffset = &offset; }#endif else { seg = DATA; poffset = &Doffset; } dt->DTseg = seg; dt->DTabytes += *poffset; obj_bytes(seg,*poffset,dt->DTnbytes,dt->DTpbytes); *poffset += dt->DTnbytes;#endif break; } case DT_ibytes: datasize += dt->DTn; break; case DT_nbytes: //printf("DT_nbytes %d/n", dt->DTnbytes); datasize += dt->DTnbytes; break; case DT_symsize:#if MARS assert(0);#else dt->DTazeros = type_size(s->Stype);#endif goto case_azeros; case DT_azeros: /* A block of zeros */ //printf("DT_azeros %d/n", dt->DTazeros); case_azeros: datasize += dt->DTazeros; if (dt == dtstart && !dt->DTnext && s->Sclass != SCcomdat) { /* first and only, so put in BSS segment */ switch (ty & mTYLINK) {#if OMFOBJ//.........这里部分代码省略.........
开发者ID:DinrusGroup,项目名称:DRC,代码行数:101,
示例25: except_fillInEHTablevoid except_fillInEHTable(symbol *s){ unsigned fsize = NPTRSIZE; // target size of function pointer dt_t **pdt = &s->Sdt; /* void* pointer to start of function unsigned offset of ESP from EBP unsigned offset from start of function to return code unsigned nguards; // dimension of guard[] (Linux) Guard guard[]; catchoffset: unsigned ncatches; // number of catch blocks { void *type; // symbol representing type unsigned bpoffset; // EBP offset of catch variable void *handler; // catch handler code } catch[]; *//* Be careful of this, as we need the sizeof Guard on the target, not * in the compiler. */#if OUREH#define GUARD_SIZE (I64 ? 3*8 : 5*4) // sizeof(Guard)#else#define GUARD_SIZE (sizeof(Guard))#endif int sz = 0; // Address of start of function symbol_debug(funcsym_p); pdt = dtxoff(pdt,funcsym_p,0,TYnptr); sz += fsize; //printf("ehtables: func = %s, offset = x%x, startblock->Boffset = x%x/n", funcsym_p->Sident, funcsym_p->Soffset, startblock->Boffset); // Get offset of ESP from EBP long spoff = cod3_spoff(); pdt = dtdword(pdt,spoff); sz += 4; // Offset from start of function to return code pdt = dtdword(pdt,retoffset); sz += 4; // First, calculate starting catch offset int guarddim = 0; // max dimension of guard[] for (block *b = startblock; b; b = b->Bnext) { if (b->BC == BC_try && b->Bscope_index >= guarddim) guarddim = b->Bscope_index + 1;// printf("b->BC = %2d, Bscope_index = %2d, last_index = %2d, offset = x%x/n",// b->BC, b->Bscope_index, b->Blast_index, b->Boffset); }#if OUREH pdt = dtsize_t(pdt,guarddim); sz += NPTRSIZE;#endif unsigned catchoffset = sz + guarddim * GUARD_SIZE; // Generate guard[] int i = 0; for (block *b = startblock; b; b = b->Bnext) { //printf("b = %p, b->Btry = %p, b->offset = %x/n", b, b->Btry, b->Boffset); if (b->BC == BC_try) { assert(b->Bscope_index >= i); if (i < b->Bscope_index) { int fillsize = (b->Bscope_index - i) * GUARD_SIZE; pdt = dtnzeros(pdt, fillsize); sz += fillsize; } i = b->Bscope_index + 1; int nsucc = list_nitems(b->Bsucc);#if OUREH //printf("DHandlerInfo: offset = %x", (int)(b->Boffset - startblock->Boffset)); pdt = dtdword(pdt,b->Boffset - startblock->Boffset); // offset to start of block // Compute ending offset unsigned endoffset; for (block *bn = b->Bnext; 1; bn = bn->Bnext) { //printf("/tbn = %p, bn->Btry = %p, bn->offset = %x/n", bn, bn->Btry, bn->Boffset); assert(bn); if (bn->Btry == b->Btry) { endoffset = bn->Boffset - startblock->Boffset; break; } } //printf(" endoffset = %x, prev_index = %d/n", endoffset, b->Blast_index); pdt = dtdword(pdt,endoffset); // offset past end of guarded block#endif pdt = dtdword(pdt,b->Blast_index); // parent index//.........这里部分代码省略.........
开发者ID:nischu7,项目名称:dmd,代码行数:101,
示例26: outdatavoid outdata(symbol *s){#if HTOD return;#endif int seg; targ_size_t offset; int flags; const int codeseg = cseg; symbol_debug(s);#ifdef DEBUG debugy && dbg_printf("outdata('%s')/n",s->Sident);#endif //printf("outdata('%s', ty=x%x)/n",s->Sident,s->Stype->Tty); //symbol_print(s); // Data segment variables are always live on exit from a function s->Sflags |= SFLlivexit; dt_t *dtstart = s->Sdt; s->Sdt = NULL; // it will be free'd targ_size_t datasize = 0; tym_t ty = s->ty();#if SCPP && TARGET_WINDOS if (eecontext.EEcompile) { s->Sfl = (s->ty() & mTYfar) ? FLfardata : FLextern; s->Sseg = UNKNOWN; goto Lret; // don't output any data }#endif if (ty & mTYexport && config.wflags & WFexpdef && s->Sclass != SCstatic) objmod->export_symbol(s,0); // export data definition for (dt_t *dt = dtstart; dt; dt = dt->DTnext) { //printf("/tdt = %p, dt = %d/n",dt,dt->dt); switch (dt->dt) { case DT_abytes: { // Put out the data for the string, and // reserve a spot for a pointer to that string datasize += size(dt->Dty); // reserve spot for pointer to string#if TARGET_SEGMENTED if (tybasic(dt->Dty) == TYcptr) { dt->DTseg = codeseg; dt->DTabytes += Offset(codeseg); goto L1; } else if (tybasic(dt->Dty) == TYfptr && dt->DTnbytes > config.threshold) { targ_size_t foffset; dt->DTseg = objmod->fardata(s->Sident,dt->DTnbytes,&foffset); dt->DTabytes += foffset; L1: objmod->write_bytes(SegData[dt->DTseg],dt->DTnbytes,dt->DTpbytes); break; } else#endif { dt->DTabytes += objmod->data_readonly(dt->DTpbytes,dt->DTnbytes,&dt->DTseg); } break; } case DT_ibytes: datasize += dt->DTn; break; case DT_nbytes: //printf("DT_nbytes %d/n", dt->DTnbytes); datasize += dt->DTnbytes; break; case DT_azeros: /* A block of zeros */ //printf("DT_azeros %d/n", dt->DTazeros); case_azeros: datasize += dt->DTazeros; if (dt == dtstart && !dt->DTnext && s->Sclass != SCcomdat && (s->Sseg == UNKNOWN || s->Sseg <= UDATA)) { /* first and only, so put in BSS segment */ switch (ty & mTYLINK) {#if TARGET_SEGMENTED case mTYfar: // if far data s->Sseg = objmod->fardata(s->Sident,datasize,&s->Soffset); s->Sfl = FLfardata; break; case mTYcs: s->Sseg = codeseg; Offset(codeseg) = _align(datasize,Offset(codeseg)); s->Soffset = Offset(codeseg); Offset(codeseg) += datasize; s->Sfl = FLcsdata; break;#endif case mTYthreadData: assert(config.objfmt == OBJ_MACH && I64);//.........这里部分代码省略.........
开发者ID:DmitryOlshansky,项目名称:dmd,代码行数:101,
示例27: except_fillInEHTablevoid except_fillInEHTable(symbol *s){ unsigned fsize = NPTRSIZE; // target size of function pointer dt_t **pdt = &s->Sdt; /* void* pointer to start of function (Windows) unsigned offset of ESP from EBP unsigned offset from start of function to return code unsigned nguards; // dimension of guard[] (Linux) Guard guard[]; // sorted such that the enclosing guarded sections come first catchoffset: unsigned ncatches; // number of catch blocks { void *type; // symbol representing type unsigned bpoffset; // EBP offset of catch variable void *handler; // catch handler code } catch[]; *//* Be careful of this, as we need the sizeof Guard on the target, not * in the compiler. */ unsigned GUARD_SIZE; if (config.ehmethod == EH_DM) GUARD_SIZE = (I64 ? 3*8 : 5*4); else if (config.ehmethod == EH_WIN32) GUARD_SIZE = 3*4; else assert(0); int sz = 0; // Address of start of function if (config.ehmethod == EH_WIN32) { symbol_debug(funcsym_p); pdt = dtxoff(pdt,funcsym_p,0,TYnptr); sz += fsize; } //printf("ehtables: func = %s, offset = x%x, startblock->Boffset = x%x/n", funcsym_p->Sident, funcsym_p->Soffset, startblock->Boffset); // Get offset of ESP from EBP long spoff = cod3_spoff(); pdt = dtdword(pdt,spoff); sz += 4; // Offset from start of function to return code pdt = dtdword(pdt,retoffset); sz += 4; // First, calculate starting catch offset int guarddim = 0; // max dimension of guard[] int ndctors = 0; // number of ESCdctor's for (block *b = startblock; b; b = b->Bnext) { if (b->BC == BC_try && b->Bscope_index >= guarddim) guarddim = b->Bscope_index + 1;// printf("b->BC = %2d, Bscope_index = %2d, last_index = %2d, offset = x%x/n",// b->BC, b->Bscope_index, b->Blast_index, b->Boffset); if (usednteh & EHcleanup) for (code *c = b->Bcode; c; c = code_next(c)) { if (c->Iop == (ESCAPE | ESCddtor)) ndctors++; } } //printf("guarddim = %d, ndctors = %d/n", guarddim, ndctors); if (config.ehmethod == EH_DM) { pdt = dtsize_t(pdt,guarddim + ndctors); sz += NPTRSIZE; } unsigned catchoffset = sz + (guarddim + ndctors) * GUARD_SIZE; // Generate guard[] int i = 0; for (block *b = startblock; b; b = b->Bnext) { //printf("b = %p, b->Btry = %p, b->offset = %x/n", b, b->Btry, b->Boffset); if (b->BC == BC_try) { assert(b->Bscope_index >= i); if (i < b->Bscope_index) { int fillsize = (b->Bscope_index - i) * GUARD_SIZE; pdt = dtnzeros(pdt, fillsize); sz += fillsize; } i = b->Bscope_index + 1; int nsucc = b->numSucc(); if (config.ehmethod == EH_DM) { //printf("DHandlerInfo: offset = %x", (int)(b->Boffset - startblock->Boffset)); pdt = dtdword(pdt,b->Boffset - startblock->Boffset); // offset to start of block // Compute ending offset//.........这里部分代码省略.........
开发者ID:TungstenHeart,项目名称:dmd,代码行数:101,
示例28: assertchar *template_mangle(symbol *s,param_t *arglist){ /* mangling ::= '$' template_name { type | expr } type ::= "T" mangled type expr ::= integer | string | address | float | double | long_double integer ::= "I" dimension string ::= "S" string address ::= "R" zname float ::= "F" hex_digits double ::= "D" hex_digits long_double ::= "L" hex_digits */ param_t *p; assert(s); symbol_debug(s); //assert(s->Sclass == SCtemplate); //printf("/ntemplate_mangle(s = '%s', arglist = %p)/n", s->Sident, arglist); //arglist->print_list(); MangleInuse m; mangle.znamei = 0; mangle.argi = 0; mangle.np = mangle.buf; mangle.buf[BUFIDMAX + 1] = 0x55; if (NEWTEMPMANGLE) STR("?$"); else CHAR('$'); // BUG: this is for templates nested inside class scopes. // Need to check if it creates names that are properly unmanglable. cpp_zname(s->Sident); if (s->Sscope) cpp_scope(s->Sscope); for (p = arglist; p; p = p->Pnext) { if (p->Ptype) { /* Argument is a type */ if (!NEWTEMPMANGLE) CHAR('T'); cpp_argument_list(p->Ptype, 1); } else if (p->Psym) { CHAR('V'); // this is a 'class' name, but it should be a 'template' name cpp_ecsu_name(p->Psym); } else { /* Argument is an expression */ elem *e = p->Pelem; tym_t ty = tybasic(e->ET->Tty); char *p; char a[2]; int ni; char c; L2: switch (e->Eoper) { case OPconst: switch (ty) { case TYfloat: ni = FLOATSIZE; c = 'F'; goto L1; case TYdouble_alias: case TYdouble: ni = DOUBLESIZE; c = 'D'; goto L1; case TYldouble: ni = LNGDBLSIZE; c = 'L'; goto L1; L1: if (NEWTEMPMANGLE) CHAR('$'); CHAR(c); p = (char *)&e->EV.Vdouble; while (ni--) { char c;#if __GNUC__ static char hex[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};#else static char hex[16] = "0123456789ABCDEF";#endif c = *p++; CHAR(hex[c & 15]); CHAR(hex[(c >> 4) & 15]); } break; default:#ifdef DEBUG if (!tyintegral(ty) && !tymptr(ty)) elem_print(e);#endif assert(tyintegral(ty) || tymptr(ty)); if (NEWTEMPMANGLE) STR("$0"); else CHAR('I'); cpp_dimension(el_tolongt(e)); break; }//.........这里部分代码省略.........
开发者ID:AlbertLkn,项目名称:dmd,代码行数:101,
注:本文中的symbol_debug函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ symbol_name函数代码示例 C++ symbol_calloc函数代码示例 |