dwtype.c
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 747 行 · 第 1/2 页
C
747 行
start_scope = start_scope;
SetHandleLocation( cli, struct_hdl );
kind = GetExtra( cli, struct_hdl )->structure.kind;
switch( kind ){
case DW_ST_CLASS:
abbrev = AB_CLASS_TYPE;
break;
case DW_ST_STRUCT:
abbrev = AB_STRUCT_TYPE;
break;
case DW_ST_UNION:
abbrev = AB_UNION_TYPE;
break;
}
DestroyExtra( cli, struct_hdl );
abbrev |= AB_SIBLING | AB_START_REF;
emitCommonTypeInfo( cli, abbrev , name, flags );
/* AT_byte_size */
InfoULEB128( cli, size );
EndDIE( cli );
StartChildren( cli );
}
void DWENTRY DWAddFriend(
dw_client cli,
dw_handle friend )
{
StartDIE( cli, AB_FRIEND );
HandleReference( cli, friend, DW_DEBUG_INFO );
EndDIE( cli );
}
dw_handle DWENTRY DWAddInheritance(
dw_client cli,
dw_handle ancestor_hdl,
dw_loc_handle loc,
uint flags )
{
dw_handle new_hdl;
abbrev_code abbrev;
new_hdl = LabelNewHandle( cli );
abbrev = AB_INHERITANCE;
StartDIE( cli, abbrev );
EmitAccessFlags( cli, flags );
/* AT_location */
if( loc ) {
EmitLocExpr( cli, DW_DEBUG_INFO, sizeof( uint_8), loc );
}else{
EmitLocExprNull( cli, DW_DEBUG_INFO, sizeof( uint_8) );
}
/* AT_virtual */
if( flags & DW_FLAG_VIRTUAL ) {
Info8( cli, DW_VIRTUALITY_virtual );
} else {
Info8( cli, DW_VIRTUALITY_none );
}
/* AT_type */
HandleReference( cli, ancestor_hdl, DW_DEBUG_INFO );
EndDIE( cli );
return( new_hdl );
}
dw_handle DWENTRY DWAddField(
dw_client cli,
dw_handle field_hdl,
dw_loc_handle loc,
const char * name,
uint flags )
{
dw_handle new_hdl;
abbrev_code abbrev;
_Validate( field_hdl );
_Validate( !(flags & DW_FLAG_STATIC) ); // use DWVariable dummy
new_hdl = LabelNewHandle( cli );
abbrev = AB_FIELD;
if( (flags & DW_FLAG_ACCESS_MASK) != DW_FLAG_PUBLIC ){ // not the default
abbrev |= AB_OPACCESS;
}
if( flags & DW_FLAG_ARTIFICIAL ){
abbrev |= AB_ARTIFICIAL;
}
StartDIE( cli, abbrev );
if( abbrev & AB_OPACCESS ){
/* AT_accessibility */
EmitAccessFlags( cli, flags );
}
/* AT_artificial */
if( flags & DW_FLAG_ARTIFICIAL ){
Info8( cli, 1 );
}
if( name == NULL ) {
name = "";
}
/* AT_name */
InfoString( cli, name );
/* AT_data_member_location */
if( loc ) {
EmitLocExpr( cli, DW_DEBUG_INFO, sizeof( uint_8), loc );
}else{
EmitLocExprNull( cli, DW_DEBUG_INFO, sizeof( uint_8) );
}
/* AT_type */
EmitTypeRef( cli, field_hdl );
EndDIE( cli );
return( new_hdl );
}
dw_handle DWENTRY DWAddBitField(
dw_client cli,
dw_handle field_hdl,
dw_loc_handle loc,
dw_size_t byte_size,
uint bit_offset,
uint bit_size,
const char * name,
uint flags )
{
abbrev_code abbrev;
dw_handle new_hdl;
_Validate( field_hdl );
new_hdl = LabelNewHandle( cli );
abbrev = AB_BITFIELD;
if( byte_size ) abbrev |= AB_BYTE_SIZE;
StartDIE( cli, abbrev );
/* AT_accessibility */
EmitAccessFlags( cli, flags );
if( byte_size ) {
/* AT_byte_size */
InfoULEB128( cli, byte_size );
}
/* AT_bit_offset */
InfoULEB128( cli, bit_offset );
/* AT_bit_size */
InfoULEB128( cli, bit_size );
/* AT_artificial */
Info8( cli, (flags & DW_FLAG_ARTIFICIAL) != 0 );
if( name == NULL ) {
name = "";
}
/* AT_name */
InfoString( cli, name );
/* AT_data_member_location */
if( loc ) {
EmitLocExpr( cli, DW_DEBUG_INFO, sizeof( uint_8), loc );
}else{
EmitLocExprNull( cli, DW_DEBUG_INFO, sizeof( uint_8) );
}
/* AT_type */
EmitTypeRef( cli, field_hdl );
EndDIE( cli );
return( new_hdl );
}
void DWENTRY DWEndStruct(
dw_client cli )
{
EndChildren( cli );
EndRef( cli );
}
dw_handle DWENTRY DWBeginEnumeration(
dw_client cli,
dw_size_t byte_size,
const char * name,
dw_addr_offset start_scope,
uint flags )
{
dw_handle new_hdl;
abbrev_code abbrev;
start_scope = start_scope;
new_hdl = GetHandle( cli );
abbrev = AB_ENUMERATION | AB_SIBLING;
emitCommonTypeInfo( cli, abbrev, name, flags );
/* AT_byte_size */
InfoULEB128( cli, byte_size );
EndDIE( cli );
StartChildren( cli );
return( new_hdl );
}
void DWENTRY DWAddConstant(
dw_client cli,
dw_uconst value,
const char * name )
{
StartDIE( cli, AB_ENUMERATOR );
InfoULEB128( cli, value );
InfoString( cli, name );
EndDIE( cli );
}
void DWENTRY DWEndEnumeration(
dw_client cli )
{
EndChildren( cli );
}
dw_handle DWENTRY DWBeginSubroutineType(
dw_client cli,
dw_handle return_type,
const char * name,
dw_addr_offset start_scope,
uint flags )
{
dw_handle new_hdl;
abbrev_code abbrev;
start_scope = start_scope;
_Validate( return_type != NULL );
new_hdl = GetHandle( cli );
abbrev = AB_SUBROUTINE_TYPE | AB_SIBLING;
if( flags & DW_PTR_TYPE_MASK ) abbrev |= AB_ADDRESS_CLASS;
emitCommonTypeInfo( cli, abbrev,
name, flags );
if( abbrev & AB_ADDRESS_CLASS ) {
WriteAddressClass( cli, flags );
}
/* AT_prototyped */
Info8( cli, ( flags & DW_FLAG_PROTOTYPED ) != 0 );
EmitTypeRef( cli, return_type );
EndDIE( cli );
StartChildren( cli );
return( new_hdl );
}
dw_handle DWENTRY DWAddParmToSubroutineType(
dw_client cli,
dw_handle parm_type,
dw_loc_handle loc,
dw_loc_handle seg,
const char * name )
{
dw_handle new_hdl;
abbrev_code abbrev;
//TODO: change interface
loc = loc;
seg = seg;
_Validate( parm_type !=NULL );
new_hdl = LabelNewHandle( cli );
abbrev = AB_FORMAL_PARM_TYPE;
if( name ) abbrev |= AB_NAME;
StartDIE( cli, abbrev );
/* AT_name */
if( name ) {
InfoString( cli, name );
}
EmitTypeRef( cli, parm_type );
EndDIE( cli );
return( new_hdl );
}
dw_handle DWENTRY DWAddEllipsisToSubroutineType(
dw_client cli )
{
dw_handle new_hdl;
new_hdl = LabelNewHandle( cli );
StartDIE( cli, AB_ELLIPSIS );
EndDIE( cli );
return( new_hdl );
}
void DWENTRY DWEndSubroutineType(
dw_client cli )
{
EndChildren( cli );
}
dw_handle DWENTRY DWString(
dw_client cli,
dw_loc_handle string_length,
dw_size_t byte_size,
const char * name,
dw_addr_offset start_scope,
uint flags )
{
dw_handle new_hdl;
abbrev_code abbrev;
start_scope = start_scope;
new_hdl = GetHandle( cli );
abbrev = string_length ? AB_STRING_WITH_LOC : AB_STRING;
if( byte_size ) abbrev |= AB_BYTE_SIZE;
emitCommonTypeInfo( cli, abbrev, name, flags );
/* AT_byte_size */
if( byte_size ) {
InfoULEB128( cli, byte_size );
}
/* AT_string_length */
if( string_length ) {
EmitLocExpr( cli, DW_DEBUG_INFO, sizeof( uint_8), string_length );
}
EndDIE( cli );
return( new_hdl );
}
dw_handle DWENTRY DWMemberPointer(
dw_client cli,
dw_handle struct_type,
dw_loc_handle loc,
dw_handle base_type,
const char * name,
unsigned flags )
{
abbrev_code abbrev;
dw_handle new_hdl;
new_hdl = LabelNewHandle( cli );
abbrev = AB_MEMBER_POINTER;
if( name ) abbrev |= AB_NAME;
if( flags & DW_PTR_TYPE_MASK ) abbrev |= AB_ADDRESS_CLASS;
StartDIE( cli, abbrev );
/* AT_name */
if( name ) {
InfoString( cli, name );
}
WriteAddressClass( cli, flags );
/* AT_type */
EmitTypeRef( cli, base_type );
/* AT_containing_type */
HandleReference( cli, struct_type, DW_DEBUG_INFO );
/* AT_use_location */
EmitLocExpr( cli, DW_DEBUG_INFO, sizeof( uint_16), loc );
EndDIE( cli );
return( new_hdl );
}
dw_handle DWENTRY DWBeginNameSpace(
dw_client cli,
const char * name )
{
dw_handle new_hdl;
abbrev_code abbrev;
new_hdl = LabelNewHandle( cli );
abbrev = AB_NAMESPACE | AB_SIBLING | AB_START_REF;
if( name ) abbrev |= AB_NAME;
StartDIE( cli, abbrev );
if( name ) {
/* AT_name */
InfoString( cli, name );
}
EndDIE( cli );
StartChildren( cli );
return( new_hdl );
}
void DWENTRY DWEndNameSpace(
dw_client cli )
{
EndChildren( cli );
EndRef( cli );
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?