Fixed stabs parsing for GCC 3.0 (default types).
Added boolean type support. Simplified internal types handling.
This commit is contained in:
parent
c19bb1ab3f
commit
02ecb68453
|
@ -328,7 +328,7 @@ void DEBUG_AddBreakpoint( const DBG_VALUE *_value, BOOL (*func)(void) )
|
|||
int num;
|
||||
BYTE ch;
|
||||
|
||||
if( value.type != NULL && value.type == DEBUG_TypeIntConst )
|
||||
if( value.type != NULL && value.type == DEBUG_GetBasicType(DT_BASIC_CONST_INT) )
|
||||
{
|
||||
/*
|
||||
* We know that we have the actual offset stored somewhere
|
||||
|
@ -460,7 +460,7 @@ void DEBUG_AddWatchpoint( const DBG_VALUE *_value, BOOL is_write )
|
|||
DEBUG_FixAddress( &value.addr, DEBUG_context.SegCs );
|
||||
#endif
|
||||
|
||||
if ( value.type != NULL && value.type == DEBUG_TypeIntConst )
|
||||
if ( value.type != NULL && value.type == DEBUG_GetBasicType(DT_BASIC_CONST_INT) )
|
||||
{
|
||||
/*
|
||||
* We know that we have the actual offset stored somewhere
|
||||
|
|
|
@ -243,20 +243,20 @@ type_cast:
|
|||
|
||||
type_expr:
|
||||
type_expr '*' { $$ = DEBUG_FindOrMakePointerType($1); }
|
||||
| tINT { $$ = DEBUG_TypeCast(DT_BASIC, "int"); }
|
||||
| tCHAR { $$ = DEBUG_TypeCast(DT_BASIC, "char"); }
|
||||
| tLONG tINT { $$ = DEBUG_TypeCast(DT_BASIC, "long int"); }
|
||||
| tUNSIGNED tINT { $$ = DEBUG_TypeCast(DT_BASIC, "unsigned int"); }
|
||||
| tLONG tUNSIGNED tINT { $$ = DEBUG_TypeCast(DT_BASIC, "long unsigned int"); }
|
||||
| tLONG tLONG tINT { $$ = DEBUG_TypeCast(DT_BASIC, "long long int"); }
|
||||
| tLONG tLONG tUNSIGNED tINT{ $$ = DEBUG_TypeCast(DT_BASIC, "long long unsigned int"); }
|
||||
| tSHORT tINT { $$ = DEBUG_TypeCast(DT_BASIC, "short int"); }
|
||||
| tSHORT tUNSIGNED tINT { $$ = DEBUG_TypeCast(DT_BASIC, "short unsigned int"); }
|
||||
| tSIGNED tCHAR { $$ = DEBUG_TypeCast(DT_BASIC, "signed char"); }
|
||||
| tUNSIGNED tCHAR { $$ = DEBUG_TypeCast(DT_BASIC, "unsigned char"); }
|
||||
| tFLOAT { $$ = DEBUG_TypeCast(DT_BASIC, "float"); }
|
||||
| tDOUBLE { $$ = DEBUG_TypeCast(DT_BASIC, "double"); }
|
||||
| tLONG tDOUBLE { $$ = DEBUG_TypeCast(DT_BASIC, "long double"); }
|
||||
| tINT { $$ = DEBUG_GetBasicType(DT_BASIC_INT); }
|
||||
| tCHAR { $$ = DEBUG_GetBasicType(DT_BASIC_CHAR); }
|
||||
| tLONG tINT { $$ = DEBUG_GetBasicType(DT_BASIC_LONGINT); }
|
||||
| tUNSIGNED tINT { $$ = DEBUG_GetBasicType(DT_BASIC_UINT); }
|
||||
| tLONG tUNSIGNED tINT { $$ = DEBUG_GetBasicType(DT_BASIC_ULONGINT); }
|
||||
| tLONG tLONG tINT { $$ = DEBUG_GetBasicType(DT_BASIC_LONGLONGINT); }
|
||||
| tLONG tLONG tUNSIGNED tINT{ $$ = DEBUG_GetBasicType(DT_BASIC_ULONGLONGINT); }
|
||||
| tSHORT tINT { $$ = DEBUG_GetBasicType(DT_BASIC_SHORTINT); }
|
||||
| tSHORT tUNSIGNED tINT { $$ = DEBUG_GetBasicType(DT_BASIC_USHORTINT); }
|
||||
| tSIGNED tCHAR { $$ = DEBUG_GetBasicType(DT_BASIC_SCHAR); }
|
||||
| tUNSIGNED tCHAR { $$ = DEBUG_GetBasicType(DT_BASIC_UCHAR); }
|
||||
| tFLOAT { $$ = DEBUG_GetBasicType(DT_BASIC_FLOAT); }
|
||||
| tDOUBLE { $$ = DEBUG_GetBasicType(DT_BASIC_DOUBLE); }
|
||||
| tLONG tDOUBLE { $$ = DEBUG_GetBasicType(DT_BASIC_LONGDOUBLE); }
|
||||
| tSTRUCT tIDENTIFIER { $$ = DEBUG_TypeCast(DT_STRUCT, $2); }
|
||||
| tUNION tIDENTIFIER { $$ = DEBUG_TypeCast(DT_STRUCT, $2); }
|
||||
| tENUM tIDENTIFIER { $$ = DEBUG_TypeCast(DT_ENUM, $2); }
|
||||
|
|
|
@ -29,6 +29,21 @@
|
|||
enum debug_type {DT_BASIC, DT_POINTER, DT_ARRAY, DT_STRUCT, DT_ENUM,
|
||||
DT_FUNC, DT_BITFIELD};
|
||||
|
||||
enum debug_type_basic {DT_BASIC_INT = 1, DT_BASIC_CHAR, DT_BASIC_LONGINT, DT_BASIC_UINT,
|
||||
DT_BASIC_ULONGINT, DT_BASIC_LONGLONGINT, DT_BASIC_ULONGLONGINT,
|
||||
DT_BASIC_SHORTINT, DT_BASIC_USHORTINT, DT_BASIC_SCHAR, DT_BASIC_UCHAR,
|
||||
DT_BASIC_FLOAT, DT_BASIC_LONGDOUBLE, DT_BASIC_DOUBLE,
|
||||
DT_BASIC_CMPLX_INT, DT_BASIC_CMPLX_FLOAT, DT_BASIC_CMPLX_DOUBLE,
|
||||
DT_BASIC_CMPLX_LONGDOUBLE, DT_BASIC_VOID,
|
||||
/* modifier on size isn't possible on current types definitions
|
||||
* so we need to add more types... */
|
||||
DT_BASIC_BOOL1, DT_BASIC_BOOL2, DT_BASIC_BOOL4,
|
||||
/* this is not really a basic type... */
|
||||
DT_BASIC_STRING,
|
||||
/* this is for historical reasons... should take care of it RSN */
|
||||
DT_BASIC_CONST_INT,
|
||||
/* to be kept as last... sentinel entry... do not use */
|
||||
DT_BASIC_LAST};
|
||||
|
||||
/*
|
||||
* Return values for DEBUG_CheckLinenoStatus. Used to determine
|
||||
|
@ -39,15 +54,6 @@ enum debug_type {DT_BASIC, DT_POINTER, DT_ARRAY, DT_STRUCT, DT_ENUM,
|
|||
#define AT_LINENUMBER (2)
|
||||
#define FUNC_IS_TRAMPOLINE (3)
|
||||
|
||||
/*
|
||||
* For constants generated by the parser, we use this datatype
|
||||
*/
|
||||
extern struct datatype * DEBUG_TypeShortUInt;
|
||||
extern struct datatype * DEBUG_TypeInt;
|
||||
extern struct datatype * DEBUG_TypeIntConst;
|
||||
extern struct datatype * DEBUG_TypeUSInt;
|
||||
extern struct datatype * DEBUG_TypeString;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD seg; /* 0xffffffff means current default segment (cs or ds) */
|
||||
|
@ -480,6 +486,7 @@ extern enum debug_type DEBUG_GetType(struct datatype * dt);
|
|||
extern struct datatype * DEBUG_TypeCast(enum debug_type, const char *);
|
||||
extern int DEBUG_PrintTypeCast(const struct datatype *);
|
||||
extern int DEBUG_PrintType( const DBG_VALUE* addr );
|
||||
extern struct datatype * DEBUG_GetBasicType(enum debug_type_basic);
|
||||
|
||||
/* debugger/winedbg.c */
|
||||
#define DBG_CHN_MESG 1
|
||||
|
|
|
@ -314,19 +314,19 @@ DBG_VALUE DEBUG_EvalExpr(struct expr * exp)
|
|||
rtn.cookie = DV_TARGET;
|
||||
break;
|
||||
case EXPR_TYPE_STRING:
|
||||
rtn.type = DEBUG_TypeString;
|
||||
rtn.type = DEBUG_GetBasicType(DT_BASIC_STRING);
|
||||
rtn.cookie = DV_HOST;
|
||||
rtn.addr.off = (unsigned int) &exp->un.string.str;
|
||||
rtn.addr.seg = 0;
|
||||
break;
|
||||
case EXPR_TYPE_CONST:
|
||||
rtn.type = DEBUG_TypeIntConst;
|
||||
rtn.type = DEBUG_GetBasicType(DT_BASIC_CONST_INT);
|
||||
rtn.cookie = DV_HOST;
|
||||
rtn.addr.off = (unsigned int) &exp->un.constant.value;
|
||||
rtn.addr.seg = 0;
|
||||
break;
|
||||
case EXPR_TYPE_US_CONST:
|
||||
rtn.type = DEBUG_TypeUSInt;
|
||||
rtn.type = DEBUG_GetBasicType(DT_BASIC_USHORTINT);
|
||||
rtn.cookie = DV_HOST;
|
||||
rtn.addr.off = (unsigned int) &exp->un.u_const.value;
|
||||
rtn.addr.seg = 0;
|
||||
|
@ -431,7 +431,7 @@ DBG_VALUE DEBUG_EvalExpr(struct expr * exp)
|
|||
*/
|
||||
exp->un.call.result = 0;
|
||||
#endif
|
||||
rtn.type = DEBUG_TypeInt;
|
||||
rtn.type = DEBUG_GetBasicType(DT_BASIC_INT);
|
||||
rtn.cookie = DV_HOST;
|
||||
rtn.addr.off = (unsigned int) &exp->un.call.result;
|
||||
|
||||
|
@ -456,13 +456,14 @@ DBG_VALUE DEBUG_EvalExpr(struct expr * exp)
|
|||
{
|
||||
RaiseException(DEBUG_STATUS_BAD_TYPE, 0, 0, NULL);
|
||||
}
|
||||
if( exp1.type == DEBUG_TypeIntConst && exp2.type == DEBUG_TypeIntConst )
|
||||
if( exp1.type == DEBUG_GetBasicType(DT_BASIC_CONST_INT) &&
|
||||
exp2.type == DEBUG_GetBasicType(DT_BASIC_CONST_INT) )
|
||||
{
|
||||
rtn.type = exp1.type;
|
||||
}
|
||||
else
|
||||
{
|
||||
rtn.type = DEBUG_TypeInt;
|
||||
rtn.type = DEBUG_GetBasicType(DT_BASIC_INT);
|
||||
}
|
||||
rtn.addr.seg = 0;
|
||||
rtn.addr.off = (unsigned int) &exp->un.binop.result;
|
||||
|
@ -595,13 +596,13 @@ DBG_VALUE DEBUG_EvalExpr(struct expr * exp)
|
|||
}
|
||||
rtn.addr.seg = 0;
|
||||
rtn.addr.off = (unsigned int) &exp->un.unop.result;
|
||||
if( exp1.type == DEBUG_TypeIntConst )
|
||||
if( exp1.type == DEBUG_GetBasicType(DT_BASIC_CONST_INT) )
|
||||
{
|
||||
rtn.type = exp1.type;
|
||||
}
|
||||
else
|
||||
{
|
||||
rtn.type = DEBUG_TypeInt;
|
||||
rtn.type = DEBUG_GetBasicType(DT_BASIC_INT);
|
||||
}
|
||||
switch(exp->un.unop.unop_type)
|
||||
{
|
||||
|
|
|
@ -65,11 +65,7 @@ void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format )
|
|||
case 0:
|
||||
if( default_format != NULL )
|
||||
{
|
||||
if (strstr(default_format, "%S") == NULL)
|
||||
{
|
||||
DEBUG_nchar += DEBUG_Printf( DBG_CHN_MESG, default_format, res );
|
||||
}
|
||||
else
|
||||
if (strstr(default_format, "%S") != NULL)
|
||||
{
|
||||
char* ptr;
|
||||
int state = 0;
|
||||
|
@ -107,6 +103,14 @@ void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format )
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (strcmp(default_format, "%B") == 0)
|
||||
{
|
||||
DEBUG_nchar += DEBUG_Printf( DBG_CHN_MESG, "%s", res ? "true" : "false");
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_nchar += DEBUG_Printf( DBG_CHN_MESG, default_format, res );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -6,53 +6,53 @@
|
|||
*/
|
||||
|
||||
/* break handling */
|
||||
INTERNAL_VAR(BreakAllThreadsStartup, FALSE, NULL, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(BreakOnCritSectTimeOut, FALSE, NULL, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(BreakOnAttach, FALSE, NULL, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(BreakOnFirstChance, TRUE, NULL, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(BreakOnDllLoad, FALSE, NULL, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(BreakAllThreadsStartup, FALSE, NULL, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(BreakOnCritSectTimeOut, FALSE, NULL, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(BreakOnAttach, FALSE, NULL, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(BreakOnFirstChance, TRUE, NULL, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(BreakOnDllLoad, FALSE, NULL, DT_BASIC_CONST_INT)
|
||||
|
||||
/* output handling */
|
||||
INTERNAL_VAR(ConChannelMask, DBG_CHN_MESG, NULL, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(StdChannelMask, 0, NULL, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(UseXTerm, TRUE, NULL, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(ConChannelMask, DBG_CHN_MESG, NULL, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(StdChannelMask, 0, NULL, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(UseXTerm, TRUE, NULL, DT_BASIC_CONST_INT)
|
||||
|
||||
/* debugging debugger */
|
||||
INTERNAL_VAR(ExtDbgOnInvalidAddress, FALSE, NULL, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(ExtDbgOnInvalidAddress, FALSE, NULL, DT_BASIC_CONST_INT)
|
||||
|
||||
/* current process/thread */
|
||||
INTERNAL_VAR(ThreadId, FALSE, &DEBUG_CurrTid, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(ProcessId, FALSE, &DEBUG_CurrPid, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(ThreadId, FALSE, &DEBUG_CurrTid, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(ProcessId, FALSE, &DEBUG_CurrPid, DT_BASIC_CONST_INT)
|
||||
|
||||
/* context manipulation */
|
||||
#ifdef __i386__
|
||||
/* FIXME: 16 bit registers use imply that CPU is little endian, which is
|
||||
* the case when running natively i386 code
|
||||
*/
|
||||
INTERNAL_VAR(eip, 0, &DEBUG_context.Eip, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(ip, 0, &DEBUG_context.Eip, DEBUG_TypeShortUInt)
|
||||
INTERNAL_VAR(pc, 0, &DEBUG_context.Eip, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(flags, 0, &DEBUG_context.EFlags, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(esp, 0, &DEBUG_context.Esp, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(sp, 0, &DEBUG_context.Esp, DEBUG_TypeShortUInt)
|
||||
INTERNAL_VAR(eax, 0, &DEBUG_context.Eax, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(ax, 0, &DEBUG_context.Eax, DEBUG_TypeShortUInt)
|
||||
INTERNAL_VAR(ebx, 0, &DEBUG_context.Ebx, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(bx, 0, &DEBUG_context.Ebx, DEBUG_TypeShortUInt)
|
||||
INTERNAL_VAR(ecx, 0, &DEBUG_context.Ecx, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(cx, 0, &DEBUG_context.Ecx, DEBUG_TypeShortUInt)
|
||||
INTERNAL_VAR(edx, 0, &DEBUG_context.Edx, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(dx, 0, &DEBUG_context.Edx, DEBUG_TypeShortUInt)
|
||||
INTERNAL_VAR(esi, 0, &DEBUG_context.Esi, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(si, 0, &DEBUG_context.Esi, DEBUG_TypeShortUInt)
|
||||
INTERNAL_VAR(edi, 0, &DEBUG_context.Edi, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(di, 0, &DEBUG_context.Edi, DEBUG_TypeShortUInt)
|
||||
INTERNAL_VAR(ebp, 0, &DEBUG_context.Ebp, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(bp, 0, &DEBUG_context.Ebp, DEBUG_TypeShortUInt)
|
||||
INTERNAL_VAR(es, 0, &DEBUG_context.SegEs, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(ds, 0, &DEBUG_context.SegDs, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(cs, 0, &DEBUG_context.SegCs, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(ss, 0, &DEBUG_context.SegSs, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(fs, 0, &DEBUG_context.SegFs, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(gs, 0, &DEBUG_context.SegGs, DEBUG_TypeIntConst)
|
||||
INTERNAL_VAR(eip, 0, &DEBUG_context.Eip, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(ip, 0, &DEBUG_context.Eip, DT_BASIC_USHORTINT)
|
||||
INTERNAL_VAR(pc, 0, &DEBUG_context.Eip, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(flags, 0, &DEBUG_context.EFlags, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(esp, 0, &DEBUG_context.Esp, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(sp, 0, &DEBUG_context.Esp, DT_BASIC_USHORTINT)
|
||||
INTERNAL_VAR(eax, 0, &DEBUG_context.Eax, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(ax, 0, &DEBUG_context.Eax, DT_BASIC_USHORTINT)
|
||||
INTERNAL_VAR(ebx, 0, &DEBUG_context.Ebx, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(bx, 0, &DEBUG_context.Ebx, DT_BASIC_USHORTINT)
|
||||
INTERNAL_VAR(ecx, 0, &DEBUG_context.Ecx, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(cx, 0, &DEBUG_context.Ecx, DT_BASIC_USHORTINT)
|
||||
INTERNAL_VAR(edx, 0, &DEBUG_context.Edx, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(dx, 0, &DEBUG_context.Edx, DT_BASIC_USHORTINT)
|
||||
INTERNAL_VAR(esi, 0, &DEBUG_context.Esi, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(si, 0, &DEBUG_context.Esi, DT_BASIC_USHORTINT)
|
||||
INTERNAL_VAR(edi, 0, &DEBUG_context.Edi, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(di, 0, &DEBUG_context.Edi, DT_BASIC_USHORTINT)
|
||||
INTERNAL_VAR(ebp, 0, &DEBUG_context.Ebp, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(bp, 0, &DEBUG_context.Ebp, DT_BASIC_USHORTINT)
|
||||
INTERNAL_VAR(es, 0, &DEBUG_context.SegEs, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(ds, 0, &DEBUG_context.SegDs, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(cs, 0, &DEBUG_context.SegCs, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(ss, 0, &DEBUG_context.SegSs, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(fs, 0, &DEBUG_context.SegFs, DT_BASIC_CONST_INT)
|
||||
INTERNAL_VAR(gs, 0, &DEBUG_context.SegGs, DT_BASIC_CONST_INT)
|
||||
#endif
|
||||
|
|
|
@ -212,7 +212,7 @@ BOOL DEBUG_GrabAddress( DBG_VALUE* value, BOOL fromCode )
|
|||
* and hope that this is a sensible thing to do.
|
||||
*/
|
||||
if (value->type != NULL) {
|
||||
if (value->type == DEBUG_TypeIntConst) {
|
||||
if (value->type == DEBUG_GetBasicType(DT_BASIC_CONST_INT)) {
|
||||
/*
|
||||
* We know that we have the actual offset stored somewhere
|
||||
* else in 32-bit space. Grab it, and we
|
||||
|
@ -227,7 +227,7 @@ BOOL DEBUG_GrabAddress( DBG_VALUE* value, BOOL fromCode )
|
|||
|
||||
if (DEBUG_TypeDerefPointer(value, &testtype) == 0)
|
||||
return FALSE;
|
||||
if (testtype != NULL || value->type == DEBUG_TypeIntConst)
|
||||
if (testtype != NULL || value->type == DEBUG_GetBasicType(DT_BASIC_CONST_INT))
|
||||
value->addr.off = DEBUG_GetExprValue(value, NULL);
|
||||
}
|
||||
} else if (!value->addr.seg && !value->addr.off) {
|
||||
|
|
|
@ -1104,21 +1104,21 @@ DEBUG_InitCVDataTypes(void)
|
|||
*/
|
||||
cv_basic_types[T_NOTYPE] = NULL;
|
||||
cv_basic_types[T_ABS] = NULL;
|
||||
cv_basic_types[T_VOID] = DEBUG_NewDataType(DT_BASIC, "void");
|
||||
cv_basic_types[T_CHAR] = DEBUG_NewDataType(DT_BASIC, "char");
|
||||
cv_basic_types[T_SHORT] = DEBUG_NewDataType(DT_BASIC, "short int");
|
||||
cv_basic_types[T_LONG] = DEBUG_NewDataType(DT_BASIC, "long int");
|
||||
cv_basic_types[T_QUAD] = DEBUG_NewDataType(DT_BASIC, "long long int");
|
||||
cv_basic_types[T_UCHAR] = DEBUG_NewDataType(DT_BASIC, "unsigned char");
|
||||
cv_basic_types[T_USHORT] = DEBUG_NewDataType(DT_BASIC, "short unsigned int");
|
||||
cv_basic_types[T_ULONG] = DEBUG_NewDataType(DT_BASIC, "long unsigned int");
|
||||
cv_basic_types[T_UQUAD] = DEBUG_NewDataType(DT_BASIC, "long long unsigned int");
|
||||
cv_basic_types[T_REAL32] = DEBUG_NewDataType(DT_BASIC, "float");
|
||||
cv_basic_types[T_REAL64] = DEBUG_NewDataType(DT_BASIC, "double");
|
||||
cv_basic_types[T_RCHAR] = DEBUG_NewDataType(DT_BASIC, "char");
|
||||
cv_basic_types[T_WCHAR] = DEBUG_NewDataType(DT_BASIC, "short");
|
||||
cv_basic_types[T_INT4] = DEBUG_NewDataType(DT_BASIC, "int");
|
||||
cv_basic_types[T_UINT4] = DEBUG_NewDataType(DT_BASIC, "unsigned int");
|
||||
cv_basic_types[T_VOID] = DEBUG_GetBasicType(DT_BASIC_VOID);
|
||||
cv_basic_types[T_CHAR] = DEBUG_GetBasicType(DT_BASIC_CHAR);
|
||||
cv_basic_types[T_SHORT] = DEBUG_GetBasicType(DT_BASIC_SHORTINT);
|
||||
cv_basic_types[T_LONG] = DEBUG_GetBasicType(DT_BASIC_LONGINT);
|
||||
cv_basic_types[T_QUAD] = DEBUG_GetBasicType(DT_BASIC_LONGLONGINT);
|
||||
cv_basic_types[T_UCHAR] = DEBUG_GetBasicType(DT_BASIC_UCHAR);
|
||||
cv_basic_types[T_USHORT] = DEBUG_GetBasicType(DT_BASIC_USHORTINT);
|
||||
cv_basic_types[T_ULONG] = DEBUG_GetBasicType(DT_BASIC_ULONGINT);
|
||||
cv_basic_types[T_UQUAD] = DEBUG_GetBasicType(DT_BASIC_ULONGLONGINT);
|
||||
cv_basic_types[T_REAL32] = DEBUG_GetBasicType(DT_BASIC_FLOAT);
|
||||
cv_basic_types[T_REAL64] = DEBUG_GetBasicType(DT_BASIC_DOUBLE);
|
||||
cv_basic_types[T_RCHAR] = DEBUG_GetBasicType(DT_BASIC_CHAR);
|
||||
cv_basic_types[T_WCHAR] = DEBUG_GetBasicType(DT_BASIC_SHORTINT);
|
||||
cv_basic_types[T_INT4] = DEBUG_GetBasicType(DT_BASIC_INT);
|
||||
cv_basic_types[T_UINT4] = DEBUG_GetBasicType(DT_BASIC_UINT);
|
||||
|
||||
cv_basic_types[T_32PVOID] = DEBUG_FindOrMakePointerType(cv_basic_types[T_VOID]);
|
||||
cv_basic_types[T_32PCHAR] = DEBUG_FindOrMakePointerType(cv_basic_types[T_CHAR]);
|
||||
|
|
|
@ -395,7 +395,7 @@ static inline int DEBUG_PTS_ReadArray(struct ParseTypedefData* ptd, struct datat
|
|||
static int DEBUG_PTS_ReadTypedef(struct ParseTypedefData* ptd, const char* typename,
|
||||
struct datatype** ret_dt)
|
||||
{
|
||||
int idx, lo, hi;
|
||||
int idx, lo, hi, sz = -1;
|
||||
struct datatype* new_dt = NULL; /* newly created data type */
|
||||
struct datatype* ref_dt; /* referenced data type (pointer...) */
|
||||
struct datatype* dt1; /* intermediate data type (scope is limited) */
|
||||
|
@ -422,7 +422,7 @@ static int DEBUG_PTS_ReadTypedef(struct ParseTypedefData* ptd, const char* typen
|
|||
case '@':
|
||||
if (*++ptd->ptr == 's') {
|
||||
ptd->ptr++;
|
||||
if (DEBUG_PTS_ReadNum(ptd, &lo) == -1) {
|
||||
if (DEBUG_PTS_ReadNum(ptd, &sz) == -1) {
|
||||
DEBUG_Printf(DBG_CHN_MESG, "Not an attribute... NIY\n");
|
||||
ptd->ptr -= 2;
|
||||
return -1;
|
||||
|
@ -516,8 +516,56 @@ static int DEBUG_PTS_ReadTypedef(struct ParseTypedefData* ptd, const char* typen
|
|||
new_dt = DEBUG_NewDataType(lo, ptd->buf + idx);
|
||||
ptd->idx = idx;
|
||||
break;
|
||||
case '-':
|
||||
if (DEBUG_PTS_ReadNum(ptd, &lo) == -1) {
|
||||
DEBUG_Printf(DBG_CHN_MESG, "Should be a number (%s)...\n", ptd->ptr);
|
||||
return -1;
|
||||
} else {
|
||||
enum debug_type_basic basic = DT_BASIC_LAST;
|
||||
switch (lo)
|
||||
{
|
||||
case 1: basic = DT_BASIC_INT; break;
|
||||
case 2: basic = DT_BASIC_CHAR; break;
|
||||
case 3: basic = DT_BASIC_SHORTINT; break;
|
||||
case 4: basic = DT_BASIC_LONGINT; break;
|
||||
case 5: basic = DT_BASIC_UCHAR; break;
|
||||
case 6: basic = DT_BASIC_SCHAR; break;
|
||||
case 7: basic = DT_BASIC_USHORTINT; break;
|
||||
case 8: basic = DT_BASIC_UINT; break;
|
||||
/* case 9: basic = DT_BASIC_UINT"; */
|
||||
case 10: basic = DT_BASIC_ULONGINT; break;
|
||||
case 11: basic = DT_BASIC_VOID; break;
|
||||
case 12: basic = DT_BASIC_FLOAT; break;
|
||||
case 13: basic = DT_BASIC_DOUBLE; break;
|
||||
case 14: basic = DT_BASIC_LONGDOUBLE; break;
|
||||
/* case 15: basic = DT_BASIC_INT; break; */
|
||||
case 16:
|
||||
switch (sz) {
|
||||
case 32: basic = DT_BASIC_BOOL1; break;
|
||||
case 16: basic = DT_BASIC_BOOL2; break;
|
||||
case 8: basic = DT_BASIC_BOOL4; break;
|
||||
}
|
||||
break;
|
||||
/* case 17: basic = DT_BASIC_SHORT real; break; */
|
||||
/* case 18: basic = DT_BASIC_REAL; break; */
|
||||
case 25: basic = DT_BASIC_CMPLX_FLOAT; break;
|
||||
case 26: basic = DT_BASIC_CMPLX_DOUBLE; break;
|
||||
/* case 30: basic = DT_BASIC_wchar"; break; */
|
||||
case 31: basic = DT_BASIC_LONGLONGINT; break;
|
||||
case 32: basic = DT_BASIC_ULONGLONGINT; break;
|
||||
default:
|
||||
DEBUG_Printf(DBG_CHN_MESG, "Unsupported integral type (%d/%d)\n", lo, sz);
|
||||
return -1;
|
||||
}
|
||||
if (!(new_dt = DEBUG_GetBasicType(basic))) {
|
||||
DEBUG_Printf(DBG_CHN_MESG, "Basic type %d not found\n", basic);
|
||||
return -1;
|
||||
}
|
||||
if (*ptd->ptr++ != ';') return -1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DEBUG_Printf(DBG_CHN_MESG, "Unknown type '%c'\n", *ptd->ptr);
|
||||
DEBUG_Printf(DBG_CHN_MESG, "Unknown type '%c'\n", ptd->ptr[-1]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,36 +87,12 @@ struct datatype
|
|||
} un;
|
||||
};
|
||||
|
||||
#define BASIC_INT 1
|
||||
#define BASIC_CHAR 2
|
||||
#define BASIC_LONG 3
|
||||
#define BASIC_UINT 4
|
||||
#define BASIC_LUI 5
|
||||
#define BASIC_LONGLONG 6
|
||||
#define BASIC_ULONGLONGI 7
|
||||
#define BASIC_SHORT 8
|
||||
#define BASIC_SHORTUI 9
|
||||
#define BASIC_SCHAR 10
|
||||
#define BASIC_UCHAR 11
|
||||
#define BASIC_FLT 12
|
||||
#define BASIC_LONG_DOUBLE 13
|
||||
#define BASIC_DOUBLE 14
|
||||
#define BASIC_CMPLX_INT 15
|
||||
#define BASIC_CMPLX_FLT 16
|
||||
#define BASIC_CMPLX_DBL 17
|
||||
#define BASIC_CMPLX_LONG_DBL 18
|
||||
#define BASIC_VOID 19
|
||||
|
||||
struct datatype * DEBUG_TypeInt = NULL;
|
||||
struct datatype * DEBUG_TypeIntConst = NULL;
|
||||
struct datatype * DEBUG_TypeUSInt = NULL;
|
||||
struct datatype * DEBUG_TypeString = NULL;
|
||||
struct datatype * DEBUG_TypeShortUInt = NULL;
|
||||
/*
|
||||
* All of the types that have been defined so far.
|
||||
*/
|
||||
static struct datatype * type_hash_table[NR_TYPE_HASH + 1];
|
||||
static struct datatype * pointer_types = NULL;
|
||||
static struct datatype * basic_types[DT_BASIC_LAST];
|
||||
|
||||
static unsigned int type_hash( const char * name )
|
||||
{
|
||||
|
@ -168,6 +144,7 @@ DEBUG_InitBasic(int type, char * name, int size, int b_signed,
|
|||
dt->un.basic.basic_size = size;
|
||||
dt->un.basic.b_signed = b_signed;
|
||||
dt->un.basic.output_format = output_format;
|
||||
basic_types[type] = dt;
|
||||
}
|
||||
|
||||
return dt;
|
||||
|
@ -199,6 +176,16 @@ DEBUG_LookupDataType(enum debug_type xtype, int hash, const char * typename)
|
|||
return dt;
|
||||
}
|
||||
|
||||
struct datatype *
|
||||
DEBUG_GetBasicType(enum debug_type_basic basic)
|
||||
{
|
||||
if (basic == 0 || basic >= DT_BASIC_LAST)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return basic_types[basic];
|
||||
}
|
||||
|
||||
struct datatype *
|
||||
DEBUG_NewDataType(enum debug_type xtype, const char * typename)
|
||||
{
|
||||
|
@ -293,44 +280,46 @@ void
|
|||
DEBUG_InitTypes(void)
|
||||
{
|
||||
static int beenhere = 0;
|
||||
struct datatype * chartype;
|
||||
|
||||
if( beenhere++ != 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Special version of int used with constants of various kinds.
|
||||
*/
|
||||
DEBUG_TypeIntConst = DEBUG_InitBasic(BASIC_INT,NULL,4,1,"%d");
|
||||
|
||||
/*
|
||||
* Initialize a few builtin types.
|
||||
*/
|
||||
|
||||
DEBUG_TypeInt = DEBUG_InitBasic(BASIC_INT,"int",4,1,"%d");
|
||||
chartype = DEBUG_InitBasic(BASIC_CHAR,"char",1,1,"'%c'");
|
||||
DEBUG_InitBasic(BASIC_LONG,"long int",4,1,"%d");
|
||||
DEBUG_TypeUSInt = DEBUG_InitBasic(BASIC_UINT,"unsigned int",4,0,"%d");
|
||||
DEBUG_InitBasic(BASIC_LUI,"long unsigned int",4,0,"%d");
|
||||
DEBUG_InitBasic(BASIC_LONGLONG,"long long int",8,1,"%ld");
|
||||
DEBUG_InitBasic(BASIC_ULONGLONGI,"long long unsigned int",8,0,"%ld");
|
||||
DEBUG_InitBasic(BASIC_SHORT,"short int",2,1,"%d");
|
||||
DEBUG_TypeShortUInt = DEBUG_InitBasic(BASIC_SHORTUI,"short unsigned int",2,0,"%d");
|
||||
DEBUG_InitBasic(BASIC_SCHAR,"signed char",1,1,"'%c'");
|
||||
DEBUG_InitBasic(BASIC_UCHAR,"unsigned char",1,0,"'%c'");
|
||||
DEBUG_InitBasic(BASIC_FLT,"float",4,0,"%f");
|
||||
DEBUG_InitBasic(BASIC_LONG_DOUBLE,"double",8,0,"%lf");
|
||||
DEBUG_InitBasic(BASIC_DOUBLE,"long double",12,0,NULL);
|
||||
DEBUG_InitBasic(BASIC_CMPLX_INT,"complex int",8,1,NULL);
|
||||
DEBUG_InitBasic(BASIC_CMPLX_FLT,"complex float",8,0,NULL);
|
||||
DEBUG_InitBasic(BASIC_CMPLX_DBL,"complex double",16,0,NULL);
|
||||
DEBUG_InitBasic(BASIC_CMPLX_LONG_DBL,"complex long double",24,0,NULL);
|
||||
DEBUG_InitBasic(BASIC_VOID,"void",0,0,NULL);
|
||||
DEBUG_InitBasic(DT_BASIC_INT,"int",4,1,"%d");
|
||||
DEBUG_InitBasic(DT_BASIC_CHAR,"char",1,1,"'%c'");
|
||||
DEBUG_InitBasic(DT_BASIC_LONGINT,"long int",4,1,"%d");
|
||||
DEBUG_InitBasic(DT_BASIC_UINT,"unsigned int",4,0,"%d");
|
||||
DEBUG_InitBasic(DT_BASIC_ULONGINT,"long unsigned int",4,0,"%d");
|
||||
DEBUG_InitBasic(DT_BASIC_LONGLONGINT,"long long int",8,1,"%ld");
|
||||
DEBUG_InitBasic(DT_BASIC_ULONGLONGINT,"long long unsigned int",8,0,"%ld");
|
||||
DEBUG_InitBasic(DT_BASIC_SHORTINT,"short int",2,1,"%d");
|
||||
DEBUG_InitBasic(DT_BASIC_USHORTINT,"short unsigned int",2,0,"%d");
|
||||
DEBUG_InitBasic(DT_BASIC_SCHAR,"signed char",1,1,"'%c'");
|
||||
DEBUG_InitBasic(DT_BASIC_UCHAR,"unsigned char",1,0,"'%c'");
|
||||
DEBUG_InitBasic(DT_BASIC_FLOAT,"float",4,0,"%f");
|
||||
DEBUG_InitBasic(DT_BASIC_DOUBLE,"long double",12,0,NULL);
|
||||
DEBUG_InitBasic(DT_BASIC_LONGDOUBLE,"double",8,0,"%lf");
|
||||
DEBUG_InitBasic(DT_BASIC_CMPLX_INT,"complex int",8,1,NULL);
|
||||
DEBUG_InitBasic(DT_BASIC_CMPLX_FLOAT,"complex float",8,0,NULL);
|
||||
DEBUG_InitBasic(DT_BASIC_CMPLX_DOUBLE,"complex double",16,0,NULL);
|
||||
DEBUG_InitBasic(DT_BASIC_CMPLX_LONGDOUBLE,"complex long double",24,0,NULL);
|
||||
DEBUG_InitBasic(DT_BASIC_VOID,"void",0,0,NULL);
|
||||
DEBUG_InitBasic(DT_BASIC_BOOL1,NULL,1,0,"%B");
|
||||
DEBUG_InitBasic(DT_BASIC_BOOL2,NULL,2,0,"%B");
|
||||
DEBUG_InitBasic(DT_BASIC_BOOL4,NULL,4,0,"%B");
|
||||
|
||||
DEBUG_TypeString = DEBUG_NewDataType(DT_POINTER, NULL);
|
||||
DEBUG_SetPointerType(DEBUG_TypeString, chartype);
|
||||
basic_types[DT_BASIC_STRING] = DEBUG_NewDataType(DT_POINTER, NULL);
|
||||
DEBUG_SetPointerType(basic_types[DT_BASIC_STRING], basic_types[DT_BASIC_CHAR]);
|
||||
|
||||
/*
|
||||
* Special version of int used with constants of various kinds.
|
||||
*/
|
||||
DEBUG_InitBasic(DT_BASIC_CONST_INT,NULL,4,1,"%d");
|
||||
|
||||
/*
|
||||
* Now initialize the builtins for codeview.
|
||||
|
@ -381,7 +370,7 @@ DEBUG_GetExprValue(const DBG_VALUE* _value, char** format)
|
|||
rtn = rtn | ((-1) << (value.type->un.basic.basic_size * 8));
|
||||
}
|
||||
/* float type has to be promoted as a double */
|
||||
if (value.type->un.basic.basic_type == BASIC_FLT) {
|
||||
if (value.type->un.basic.basic_type == DT_BASIC_FLOAT) {
|
||||
float f;
|
||||
double d;
|
||||
memcpy(&f, &rtn, sizeof(f));
|
||||
|
|
|
@ -72,7 +72,7 @@ static BOOL DEBUG_IntVarsRW(int read)
|
|||
/* initializes internal vars table */
|
||||
#define INTERNAL_VAR(_var,_val,_ref,_typ) \
|
||||
div->val = _val; div->name = #_var; div->pval = _ref; \
|
||||
div->type = _typ; div++;
|
||||
div->type = DEBUG_GetBasicType(_typ); div++;
|
||||
#include "intvar.h"
|
||||
#undef INTERNAL_VAR
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue