📄 dw.h
字号:
/****************************************************************************
*
* 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: Public DWARF Writer library interface.
*
****************************************************************************/
#ifndef DW_H_INCLUDED
#define DW_H_INCLUDED
#include <watcom.h>
#include "dwcnf.h"
/*
Types
*/
/* The client id; required by all DW calls except DWInit() */
typedef struct dw_client * dw_client;
/* used for macro definitions */
typedef struct dw_macro * dw_macro;
/* temporary value that is used to build location expressions */
typedef struct dw_loc_id * dw_loc_id;
/* a label within a location expression */
typedef struct dw_loc_label * dw_loc_label;
/* a temporary value used to build location lists */
typedef struct dw_list_id * dw_list_id;
/* a 'compiled' location expression or list */
typedef struct dw_loc_handle * dw_loc_handle;
/* an id for a debugging record */
typedef uint_32 dw_handle;
typedef uint_16 dw_defseg; // default size of a seg
/*
Constants
*/
/* language constants */
enum {
DWLANG_C,
DWLANG_CPP,
DWLANG_FORTRAN
};
/* procedure call type */
enum {
DW_SB_NEAR_CALL,
DW_SB_FAR_CALL,
DW_SB_FAR16_CALL
};
/* fundamental types */
enum {
DW_FT_MIN = 1,
DW_FT_ADDRESS = DW_FT_MIN,
DW_FT_BOOLEAN,
DW_FT_COMPLEX_FLOAT,
DW_FT_FLOAT,
DW_FT_SIGNED,
DW_FT_SIGNED_CHAR,
DW_FT_UNSIGNED,
DW_FT_UNSIGNED_CHAR,
DW_FT_MAX
};
/* type modifiers */
enum {
DW_MOD_CONSTANT = 0x10,
DW_MOD_VOLATILE = 0x20,
DW_MOD_NEAR16 = 0x01,
DW_MOD_FAR16 = 0x02,
DW_MOD_HUGE16 = 0x03,
DW_MOD_NEAR32 = 0x04,
DW_MOD_FAR32 = 0x05
};
/* various flags for the generic 'flags' parameter to many functions */
enum {
/* set to indicate die is a declaration, not a definition */
DW_FLAG_DECLARATION = 0x8000, // declaration, not definition
/* accessibility flags */
DW_FLAG_ACCESS_MASK = 0x0003,
DW_FLAG_PRIVATE = 0x0001,
DW_FLAG_PROTECTED = 0x0002,
DW_FLAG_PUBLIC = 0x0003,
/* "pointer types" used in DWPointer and DWBeginSubroutine[Type] */
DW_PTR_TYPE_MASK = 0x7000,
DW_PTR_TYPE_SHIFT = 12,
DW_PTR_TYPE_DEFAULT = 0x0000,
DW_PTR_TYPE_NEAR16 = 0x1000,
DW_PTR_TYPE_FAR16 = 0x2000,
DW_PTR_TYPE_HUGE16 = 0x3000,
DW_PTR_TYPE_NEAR32 = 0x4000,
DW_PTR_TYPE_FAR32 = 0x5000,
/* extra flags for DWPointer */
DW_FLAG_REFERENCE = 0x0008,
/* extra flags for DWAddField */
DW_FLAG_STATIC = 0x0008,
/* for DWAddInheritance and DWBeginSubroutine */
DW_FLAG_VIRTUAL = 0x0020,
/* for DWBeginSubroutineType and DWBeginSubroutine */
DW_FLAG_PROTOTYPED = 0x0010,
/* for DWBeginSubroutine */
DW_FLAG_ARTIFICIAL = 0x0004,
DW_FLAG_VIRTUAL_MASK = 0x0060,
DW_FLAG_VIRTUAL_SHIFT = 5,
DW_FLAG_PURE_VIRTUAL = 0x0040,
DW_FLAG_MAIN = 0x0080,
DW_SUB_STATIC = 0x0100,
DW_FLAG_INLINE_MASK = 0x0c00,
DW_FLAG_INLINE_SHIFT = 10,
DW_FLAG_WAS_INLINED = 0x0400,
DW_FLAG_DECLARED_INLINE = 0x0800,
/* for DWVariable and DWConstant */
DW_FLAG_GLOBAL = 0x0008
};
/* operation codes for location expressions */
enum {
#define DW_LOC_OP( __n, __v ) DW_LOC_##__n,
#include "dwlocop.h"
#undef DW_LOC_OP
DW_LOC_breg,
DW_LOC_max
};
/* the debugging sections */
typedef enum dw_sectnum{
DW_DEBUG_INFO,
DW_DEBUG_PUBNAMES,
DW_DEBUG_ARANGES,
DW_DEBUG_LINE,
DW_DEBUG_LOC,
DW_DEBUG_ABBREV,
DW_DEBUG_MACINFO,
DW_DEBUG_STR,
DW_DEBUG_REF,
DW_DEBUG_MAX
}dw_sectnum;
/* relocation types for CLIReloc */
typedef enum {
DW_W_LOW_PC,
DW_W_HIGH_PC,
DW_W_STATIC,
DW_W_SEGMENT,
DW_W_LABEL,
DW_W_LABEL_SEG,
DW_W_SECTION_POS,
DW_W_DEFAULT_FUNCTION,
DW_W_ARANGE_ADDR,
DW_W_UNIT_SIZE,
DW_W_LOC_RANGE,
DW_W_EXT_REF,
DW_W_MAX
}dw_relocs;
/* seek methods for CLISeek */
enum {
DW_SEEK_SET,
DW_SEEK_CUR,
DW_SEEK_END
};
/* the client supplied functions */
typedef struct {
void (*reloc)( dw_sectnum, dw_relocs, ... );
void (*write)( dw_sectnum, const void *, dw_size_t );
void (*seek)( dw_sectnum, long, uint );
long (*tell)( dw_sectnum );
void * (*alloc)( size_t );
void (*free)( void * );
} dw_funcs;
/* for the compiler_options field */
typedef enum {
DW_CM_BROWSER = 0x01,
DW_CM_DEBUGGER = 0x02,
DW_CM_UPPER = 0x04,
DW_CM_LOWER = 0x08,
DW_CM_ABBREV_GEN = 0x10,
DW_CM_ABBREV_PRE = 0x20,
}dw_cm;
typedef struct {
uint_8 language;
dw_cm compiler_options;
char const *producer_name;
jmp_buf exception_handler;
dw_funcs funcs;
dw_sym_handle abbrev_sym;
} dw_init_info;
typedef enum {
DW_MODEL_NONE = 0,
DW_MODEL_FLAT = 1,
DW_MODEL_SMALL = 2,
DW_MODEL_MEDIUM = 3,
DW_MODEL_COMPACT = 4,
DW_MODEL_LARGE = 5,
DW_MODEL_HUGE = 6,
}dw_model;
/*
Function Prototypes
*/
#define DWENTRY
/* initialization/finalization */
dw_client DWENTRY DWInit( const dw_init_info *__info );
void DWENTRY DWFini( dw_client );
/* compilation units */
typedef struct {
char *source_filename;
char *directory;
unsigned flags;
unsigned offset_size;
unsigned segment_size;
dw_model model;
char *inc_list;
unsigned inc_list_len;
dw_sym_handle dbg_pch;
}dw_cu_info;
dw_handle DWENTRY DWBeginCompileUnit(
dw_client cli,
dw_cu_info *cu );
void DWENTRY DWEndCompileUnit( dw_client );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -