dwmakeab.c

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 889 行 · 第 1/2 页

C
889
字号
/****************************************************************************
*
*                            Open Watcom Project
*
*    Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
*  ========================================================================
*
*    This file contains Original Code and/or Modifications of Original
*    Code as defined in and that are subject to the Sybase Open Watcom
*    Public License version 1.0 (the 'License'). You may not use this file
*    except in compliance with the License. BY USING THIS FILE YOU AGREE TO
*    ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
*    provided with the Original Code and Modifications, and is also
*    available at www.sybase.com/developer/opensource.
*
*    The Original Code and all software distributed under the License are
*    distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
*    EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
*    ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
*    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
*    NON-INFRINGEMENT. Please see the License for the specific language
*    governing rights and limitations under the License.
*
*  ========================================================================
*
* Description:  This file contains the definitions of DWARF abbreviations
*               in a user editable form. Compile and run this file to
*               create abbreviation tables used inside dwabbrev.c.
*
****************************************************************************/


#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define NO_ENUM
#define AB_BITVECT_SIZE 1
#include "dwpriv.h"
#include "dwutils.h"
#include "dwabbrev.h"

#include "dwutils.c"

#define MAX_CODES       29

typedef struct {
    char *              name;           // enumerated name
    uint_32             tag;            // tag for this abbreviation
    abbrev_code         valid_mask;     // valid bits for this abbreviation
    uint_32             data[ MAX_CODES ]; // attr/form pairs
} abbrev_data;

/*
    Some useful combinations of bits
*/
#define DECL                    AB_DECL
#define COMMON_NBITS            AB_ACCESSIBILITY


abbrev_data const abbrevInfo[] = {

    {
        "AB_COMPILE_UNIT",
        DW_TAG_compile_unit,
        AB_SIBLING | AB_LOWHIGH_PC,
        {
            DW_AT_name,                 DW_FORM_string,
            DW_AT_stmt_list,            DW_FORM_data4,
            DW_AT_language,             DW_FORM_udata,
            DW_AT_comp_dir,             DW_FORM_string,
            DW_AT_producer,             DW_FORM_string,
            DW_AT_identifier_case,      DW_FORM_udata,
            DW_AT_macro_info,           DW_FORM_data4,
            DW_AT_base_types,           DW_FORM_ref_addr,
            DW_AT_WATCOM_memory_model,  DW_FORM_data1,
            DW_AT_WATCOM_references_start, DW_FORM_data4,
            0
        }
    },

    {
        "AB_BASE_TYPE",
        DW_TAG_base_type,
        AB_NAME,
        {
            DW_AT_encoding,             DW_FORM_data1,
            DW_AT_byte_size,            DW_FORM_data1,
            0
        }
    },

    {
        "AB_TYPEDEF_TYPE",
        DW_TAG_typedef,
        DECL | AB_NAME | COMMON_NBITS,
        {
            DW_AT_type,                 DW_FORM_ref4,
            0
        }
    },

    {
        "AB_INDIRECT_TYPE",
        DW_TAG_typedef,
        0,
        {
            DW_AT_type,     DW_FORM_ref_addr,
            0
        }
    },
    {
        "AB_POINTER_TYPE",
        DW_TAG_pointer_type,
        AB_ADDRESS_CLASS | AB_SEGMENT,
        {
            DW_AT_type,                 DW_FORM_ref4,
            0
        }
    },

    {
        "AB_REFERENCE_TYPE",
        DW_TAG_reference_type,
        AB_ADDRESS_CLASS,
        {
            DW_AT_type,                 DW_FORM_ref4,
            0
        }
    },

    {
        "AB_CONST_TYPE",
        DW_TAG_const_type,
        0,
        {
            DW_AT_type,                 DW_FORM_ref4,
            0
        }
    },

    {
        "AB_VOLATILE_TYPE",
        DW_TAG_volatile_type,
        0,
        {
            DW_AT_type,                 DW_FORM_ref4,
            0
        }
    },

    {
        "AB_ADDR_CLASS_TYPE",
        DW_TAG_WATCOM_address_class_type,
        0,
        {
            DW_AT_type,                 DW_FORM_ref4,
            DW_AT_address_class,        DW_FORM_data1,
        }
    },

    {
        "AB_SIMPLE_ARRAY_TYPE",
        DW_TAG_array_type,
         0,
        {
            DW_AT_count,                DW_FORM_udata,
            DW_AT_type,                 DW_FORM_ref4,
            0
        }
    },

    {
        "AB_ARRAY_TYPE",
        DW_TAG_array_type,
        DECL | AB_NAME | COMMON_NBITS | AB_SIBLING,
        {
            DW_AT_type,                 DW_FORM_ref4,
            0
        }
    },

    {
        "AB_ARRAY_TYPE_WITH_STRIDE",
        DW_TAG_array_type,
        DECL | AB_NAME | COMMON_NBITS | AB_SIBLING,
        {
            DW_AT_stride_size,          DW_FORM_udata,
            DW_AT_type,                 DW_FORM_ref4,
            0
        }
    },

    {
        "AB_ARRAY_BOUND",
        DW_TAG_subrange_type,
        AB_TYPE,
        {
            DW_AT_lower_bound,          DW_FORM_udata,
            DW_AT_upper_bound,          DW_FORM_udata,
            0
        }
    },

    {
        "AB_ARRAY_VARDIM",
        DW_TAG_subrange_type,
        AB_TYPE,
        {
            DW_AT_lower_bound,          DW_FORM_ref4,
            DW_AT_count,                DW_FORM_ref4,
            0
        }
    },

    {
        "AB_FRIEND",
        DW_TAG_friend,
        0,
        {
            DW_AT_friend,               DW_FORM_ref4,
            0
        }
    },

    {
        "AB_CLASS_TYPE",
        DW_TAG_class_type,
        DECL | AB_NAME | COMMON_NBITS | AB_SIBLING,
        {
            DW_AT_byte_size,            DW_FORM_udata,
            0
        }
    },
    {
        "AB_STRUCT_TYPE",
        DW_TAG_structure_type,
        DECL | AB_NAME | COMMON_NBITS | AB_SIBLING,
        {
            DW_AT_byte_size,            DW_FORM_udata,
            0
        }
    },
    {
        "AB_UNION_TYPE",
        DW_TAG_union_type,
        DECL | AB_NAME | COMMON_NBITS | AB_SIBLING,
        {
            DW_AT_byte_size,            DW_FORM_udata,
            0
        }
    },
    {
        "AB_INHERITANCE",
        DW_TAG_inheritance,
        DECL | AB_ACCESSIBILITY,
        {
            DW_AT_data_member_location, DW_FORM_block1,
            DW_AT_virtuality,           DW_FORM_data1,
            DW_AT_type,                 DW_FORM_ref4,
            0
        }
    },

    {
        "AB_FIELD",
        DW_TAG_member,
        DECL | AB_OPACCESS | AB_ARTIFICIAL,
        {
            DW_AT_name,                 DW_FORM_string,
            DW_AT_data_member_location, DW_FORM_block1,
            DW_AT_type,                 DW_FORM_ref4,
            0
        }
    },

    {
        "AB_BITFIELD",
        DW_TAG_member,
        DECL | AB_ACCESSIBILITY | AB_BYTE_SIZE,
        {
            DW_AT_bit_offset,           DW_FORM_udata,
            DW_AT_bit_size,             DW_FORM_udata,
            DW_AT_artificial,           DW_FORM_flag,
            DW_AT_name,                 DW_FORM_string,
            DW_AT_data_member_location, DW_FORM_block1,
            DW_AT_type,                 DW_FORM_ref4,
            0
        }
    },

    {
        "AB_ENUMERATION",
        DW_TAG_enumeration_type,
        DECL | AB_NAME | COMMON_NBITS | AB_SIBLING,
        {
            DW_AT_byte_size,            DW_FORM_udata,
            0
        }
    },

    {
        "AB_ENUMERATOR",
        DW_TAG_enumerator,
        DECL,
        {
            DW_AT_const_value,          DW_FORM_udata,
            DW_AT_name,                 DW_FORM_string,
            0
        }
    },

    {
        "AB_SUBROUTINE_TYPE",
        DW_TAG_subroutine_type,
        DECL | AB_NAME | COMMON_NBITS | AB_SIBLING |
            AB_ADDRESS_CLASS,
        {
            DW_AT_prototyped,           DW_FORM_flag,
            DW_AT_type,                 DW_FORM_ref4,
            0
        }
    },

    {
        "AB_STRING",
        DW_TAG_string_type,
        DECL | AB_NAME | COMMON_NBITS | AB_BYTE_SIZE,
        {
            0
        }
    },

    {
        "AB_STRING_WITH_LOC",
        DW_TAG_string_type,
        DECL | AB_NAME | COMMON_NBITS | AB_BYTE_SIZE,
        {
            DW_AT_string_length,        DW_FORM_block1,
            0
        }
    },

    {
        "AB_MEMBER_POINTER",
        DW_TAG_ptr_to_member_type,
        DECL | AB_NAME | AB_ADDRESS_CLASS,
        {
            DW_AT_type,                 DW_FORM_ref4,
            DW_AT_containing_type,      DW_FORM_ref4,
            DW_AT_use_location,         DW_FORM_block2,
            0
        }
    },

    {
        "AB_LEXICAL_BLOCK",
        DW_TAG_lexical_block,
        AB_NAME | AB_SEGMENT | AB_SIBLING,
        {
            DW_AT_low_pc,               DW_FORM_addr,
            DW_AT_high_pc,              DW_FORM_addr,
            0
        }
    },

    {
        "AB_COMMON_BLOCK",
        DW_TAG_common_block,
        DECL | AB_NAME | AB_SEGMENT | AB_DECLARATION | AB_SIBLING,
        {
            DW_AT_location,             DW_FORM_block1,
            0
        }
    },

    {
        "AB_INLINED_SUBROUTINE",
        DW_TAG_inlined_subroutine,
        AB_SEGMENT | AB_SIBLING | AB_RETURN_ADDR,
        {
            DW_AT_abstract_origin,      DW_FORM_ref4,
            DW_AT_low_pc,               DW_FORM_addr,
            DW_AT_high_pc,              DW_FORM_addr,
            0
        }
    },

    {
        "AB_SUBROUTINE",
        DW_TAG_subprogram,
        DECL | COMMON_NBITS | AB_START_SCOPE | AB_SIBLING | AB_TYPE
             | AB_MEMBER | AB_VTABLE_LOC | AB_SEGMENT,
        {
            DW_AT_name,                 DW_FORM_string,
            DW_AT_external,             DW_FORM_flag,
            DW_AT_inline,               DW_FORM_data1,
            DW_AT_calling_convention,   DW_FORM_data1,
            DW_AT_prototyped,           DW_FORM_flag,
            DW_AT_virtuality,           DW_FORM_data1,
            DW_AT_artificial,           DW_FORM_flag,
            DW_AT_return_addr,          DW_FORM_block1,
            DW_AT_low_pc,               DW_FORM_addr,
            DW_AT_high_pc,              DW_FORM_addr,
            DW_AT_address_class,        DW_FORM_data1,
            DW_AT_frame_base,           DW_FORM_block1,
            0
        }
    },
    {
        "AB_SUBROUTINE_DECL",
        DW_TAG_subprogram,
        DECL | COMMON_NBITS | AB_SIBLING | AB_TYPE
        | AB_MEMBER | AB_VTABLE_LOC,
        {
            DW_AT_name,                 DW_FORM_string,
            DW_AT_external,             DW_FORM_flag,
            DW_AT_inline,               DW_FORM_data1,
            DW_AT_calling_convention,   DW_FORM_data1,
            DW_AT_prototyped,           DW_FORM_flag,
            DW_AT_virtuality,           DW_FORM_data1,
            DW_AT_artificial,           DW_FORM_flag,
            DW_AT_declaration,          DW_FORM_flag,
            DW_AT_address_class,        DW_FORM_data1,
            DW_AT_frame_base,           DW_FORM_block1,
            0
        }
    },

    {
        "AB_ENTRY_POINT",
        DW_TAG_entry_point,
        DECL | COMMON_NBITS | AB_START_SCOPE | AB_RETURN_ADDR | AB_SIBLING | AB_SEGMENT
        | AB_TYPE,
        {
            DW_AT_low_pc,               DW_FORM_addr,
            DW_AT_address_class,        DW_FORM_data1,
            DW_AT_name,                 DW_FORM_string,
            0
        }
    },
#if 0
    {
        "AB_MEMFUNCDECLSEG",

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?