extern void DFBegCCU( segment_id code, dw_sym_handle dbg_pch ) /****************************************************************/ // Call when codeseg hase been defined { dw_cu_info cu; back_handle bck; segment_id old; type_def *tipe_addr; if( _IsntModel( DBG_LOCALS | DBG_TYPES ) ) { return; } if( CcuDef ) { cu.source_filename = FEAuxInfo( NULL, SOURCE_NAME ); cu.directory = ""; cu.dbg_pch = dbg_pch; cu.inc_list = NULL; cu.inc_list_len = 0; old = SetOP( code ); #if _TARGET & ( _TARG_IAPX86 | _TARG_80386 ) if( _IsTargetModel( FLAT_MODEL ) ) { bck = MakeLabel(); OutLabel( bck->lbl ); Pc_Low = bck; Pc_High = MakeLabel(); // Emitting DW_AT_low_pc and DW_AT_high_pc is valid *only* if the // compilation unit's code is in a single contiguous block (see // DWARF 2, section 3.1). // I don't know how to find out at the time of this call if there's // only one code segment or not, hence these attributes are always // disabled. The low/high pc attribs should probably be handled by // the linker. cu.flags = false; cu.segment_size = 0; } else { bck = NULL; cu.flags = false; Pc_Low = NULL; Pc_High = NULL; cu.segment_size = 2; } #else bck = MakeLabel(); OutLabel( bck->lbl ); Pc_Low = bck; Pc_High = MakeLabel(); cu.flags = true; cu.segment_size = 0; #endif SetOP( old ); Comp_High = Pc_High; tipe_addr = TypeAddress( TY_NEAR_POINTER ); cu.offset_size = tipe_addr->length; switch( GetMemModel() ) { case 'h': cu.model = DW_MODEL_HUGE; break; case 'l': cu.model = DW_MODEL_LARGE; break; case 'f': cu.model = DW_MODEL_FLAT; break; case 's': cu.model = DW_MODEL_SMALL; break; default: cu.model = DW_MODEL_NONE; break; } DWBeginCompileUnit( Client, &cu ); if( cu.flags ) { BEFreeBack( bck ); } } else { CcuDef = true; } }
extern void DFObjLineInitDbgInfo( void ) { /*****************************************************/ /* called by objinit to init segments and dwarf writing library */ static const dw_funcs cli_funcs = { CLIReloc, CLIWrite, CLISeek, CLITell, CLIAlloc, CLIFree }; dw_init_info info; dw_cu_info cu; type_def *tipe_addr; info.language = DWLANG_C; info.compiler_options = DW_CM_DEBUGGER; info.abbrev_sym = 0; info.producer_name = SetDwarfProducer(); info.language = SetLang(); if( setjmp( info.exception_handler ) == 0 ) { info.funcs = cli_funcs; InitLineSegBck(); // start each seg with a ref label Client = DWInit( &info ); if( Client == NULL ) { Zoiks( ZOIKS_107 ); /* Bad */ } cu.source_filename = FEAuxInfo( NULL, SOURCE_NAME ); cu.directory = ""; cu.dbg_pch = NULL; cu.inc_list = NULL; cu.inc_list_len = 0; #if _TARGET & ( _TARG_IAPX86 | _TARG_80386 ) if( _IsTargetModel( FLAT_MODEL ) ) { cu.flags = true; cu.segment_size = 0; }else{ cu.flags = false; cu.segment_size = 2; } #else cu.flags = true; cu.segment_size = 0; #endif tipe_addr = TypeAddress( TY_NEAR_POINTER ); cu.offset_size = tipe_addr->length; switch( GetMemModel() ){ case 'h': cu.model = DW_MODEL_HUGE; break; case 'l': cu.model = DW_MODEL_LARGE; break; case 'f': cu.model = DW_MODEL_FLAT; break; case 's': cu.model = DW_MODEL_SMALL; break; default: cu.model = DW_MODEL_NONE; break; } DWInitDebugLine( Client, &cu ); } else { Zoiks( ZOIKS_107 ); /* Big Error */ } }
void CVObjInitDbgInfo( void ) /******************************/ /* called by objinit to init segments and for codeview */ { cv_out out[1]; cs_objname *optr; cs_compile *cptr; char *name; InitSegBck(); if( _IsModel( DBG_LOCALS ) ) { NewBuff( out, CVSyms ); optr = StartSym( out, SG_OBJNAME ); optr->signature = 0; name = FEAuxInfo( NULL, OBJECT_FILE_NAME ); CVPutStr( out, name ); EndSym( out ); buffEnd( out ); NewBuff( out, CVSyms ); cptr = StartSym( out, SG_COMPILE ); cptr->language = SetLang(); cptr->flags.s = 0; /* set default */ #if _TARGET & _TARG_IAPX86 cptr->flags.f.Mode32 = false; cptr->machine = MACH_INTEL_8080; #elif _TARGET & _TARG_80386 cptr->machine = MACH_INTEL_80386; cptr->flags.f.Mode32 = true; #elif _TARGET & _TARG_AXP cptr->machine = MACH_DECALPHA; cptr->flags.f.Mode32 = true; cptr->flags.f.FloatPrecision = 1; #endif switch( GetMemModel() ){ case 'h': cptr->flags.f.AmbientData = AMBIENT_HUGE; cptr->flags.f.AmbientCode = AMBIENT_FAR; break; case 'l': cptr->flags.f.AmbientData = AMBIENT_FAR; cptr->flags.f.AmbientCode = AMBIENT_FAR; break; case 'f': case 's': cptr->flags.f.AmbientData = AMBIENT_NEAR; cptr->flags.f.AmbientCode = AMBIENT_NEAR; break; case 'c': cptr->flags.f.AmbientData = AMBIENT_FAR; cptr->flags.f.AmbientCode = AMBIENT_NEAR; break; case 'm': cptr->flags.f.AmbientData = AMBIENT_NEAR; cptr->flags.f.AmbientCode = AMBIENT_FAR; break; default: break; } CVPutStr( out, "WATCOM CV 10.5 " ); EndSym( out ); buffEnd( out ); } }