Commit af0c59bc authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winedbg: Use data model for basic type on input.

parent 2d8b7090
......@@ -60,7 +60,8 @@ static void parser(const char*);
%token tSYMBOLFILE tRUN tATTACH tDETACH tKILL tMAINTENANCE tTYPE tMINIDUMP
%token tNOPROCESS
%token tCHAR tSHORT tINT tLONG tFLOAT tDOUBLE tUNSIGNED tSIGNED
/* can be prefixed by module name */
%token <string> tVOID tCHAR tWCHAR tSHORT tINT tLONG tFLOAT tDOUBLE tUNSIGNED tSIGNED
%token tSTRUCT tUNION tENUM
/* %left ',' */
......@@ -305,27 +306,46 @@ noprocess_state:
;
type_expr:
tCHAR { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = dbg_itype_char; }
| tINT { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = dbg_itype_signed_int32; }
| tLONG tINT { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = ADDRSIZE == 4 ? dbg_itype_signed_long32 : dbg_itype_signed_long64; }
| tLONG { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = ADDRSIZE == 4 ? dbg_itype_signed_long32 : dbg_itype_signed_long64; }
| tUNSIGNED tINT { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = dbg_itype_unsigned_int32; }
| tUNSIGNED { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = dbg_itype_unsigned_int32; }
| tLONG tUNSIGNED tINT { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = ADDRSIZE == 4 ? dbg_itype_unsigned_long32 : dbg_itype_unsigned_long64; }
| tLONG tUNSIGNED { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = ADDRSIZE == 4 ? dbg_itype_unsigned_long32 : dbg_itype_unsigned_long64; }
| tSHORT tINT { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = dbg_itype_signed_int16; }
| tSHORT { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = dbg_itype_signed_int16; }
| tSHORT tUNSIGNED tINT { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = dbg_itype_unsigned_int16; }
| tSHORT tUNSIGNED { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = dbg_itype_unsigned_int16; }
| tSIGNED tCHAR { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = dbg_itype_signed_int8; }
| tUNSIGNED tCHAR { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = dbg_itype_unsigned_int8; }
| tLONG tLONG tUNSIGNED tINT{ $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = dbg_itype_unsigned_int64; }
| tLONG tLONG tUNSIGNED { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = dbg_itype_unsigned_int64; }
| tLONG tLONG tINT { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = dbg_itype_signed_int64; }
| tLONG tLONG { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = dbg_itype_signed_int64; }
| tFLOAT { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = dbg_itype_short_real; }
| tDOUBLE { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = dbg_itype_real; }
| tLONG tDOUBLE { $$.type = type_expr_type_id; $$.deref_count = 0; $$.u.type.module = 0; $$.u.type.id = dbg_itype_long_real; }
tVOID { if (!types_find_basic(L"void", $1, &$$)) YYERROR; }
| tCHAR { if (!types_find_basic(L"char", $1, &$$)) YYERROR; }
| tWCHAR { if (!types_find_basic(L"WCHAR", $1, &$$)) YYERROR; }
| tSIGNED tCHAR { if (!types_find_basic(L"signed char", $1, &$$)) YYERROR; }
| tUNSIGNED tCHAR { if (!types_find_basic(L"unsigned char", $1, &$$)) YYERROR; }
| tSHORT tINT { if (!types_find_basic(L"short int", $1, &$$)) YYERROR; }
| tSHORT { if (!types_find_basic(L"short int", $1, &$$)) YYERROR; }
| tSIGNED tSHORT tINT { if (!types_find_basic(L"short int", $1, &$$)) YYERROR; }
| tSIGNED tSHORT { if (!types_find_basic(L"short int", $1, &$$)) YYERROR; }
| tSHORT tSIGNED tINT { if (!types_find_basic(L"short int", $1, &$$)) YYERROR; }
| tSHORT tSIGNED { if (!types_find_basic(L"short int", $1, &$$)) YYERROR; }
| tSHORT tUNSIGNED { if (!types_find_basic(L"unsigned short int", $1, &$$)) YYERROR; }
| tSHORT tUNSIGNED tINT { if (!types_find_basic(L"unsigned short int", $1, &$$)) YYERROR; }
| tUNSIGNED tSHORT { if (!types_find_basic(L"unsigned short int", $1, &$$)) YYERROR; }
| tUNSIGNED tSHORT tINT { if (!types_find_basic(L"unsigned short int", $1, &$$)) YYERROR; }
| tINT { if (!types_find_basic(L"int", $1, &$$)) YYERROR; }
| tSIGNED tINT { if (!types_find_basic(L"int", $1, &$$)) YYERROR; }
| tUNSIGNED { if (!types_find_basic(L"unsigned int", $1, &$$)) YYERROR; }
| tUNSIGNED tINT { if (!types_find_basic(L"unsigned int", $1, &$$)) YYERROR; }
| tLONG { if (!types_find_basic(L"long int", $1, &$$)) YYERROR; }
| tLONG tINT { if (!types_find_basic(L"long int", $1, &$$)) YYERROR; }
| tSIGNED tLONG { if (!types_find_basic(L"long int", $1, &$$)) YYERROR; }
| tSIGNED tLONG tINT { if (!types_find_basic(L"long int", $1, &$$)) YYERROR; }
| tLONG tSIGNED { if (!types_find_basic(L"long int", $1, &$$)) YYERROR; }
| tLONG tSIGNED tINT { if (!types_find_basic(L"long int", $1, &$$)) YYERROR; }
| tLONG tUNSIGNED { if (!types_find_basic(L"unsigned long int", $1, &$$)) YYERROR; }
| tLONG tUNSIGNED tINT { if (!types_find_basic(L"unsigned long int", $1, &$$)) YYERROR; }
| tUNSIGNED tLONG { if (!types_find_basic(L"unsigned long int", $1, &$$)) YYERROR; }
| tUNSIGNED tLONG tINT { if (!types_find_basic(L"unsigned long int", $1, &$$)) YYERROR; }
| tLONG tLONG { if (!types_find_basic(L"long long int", $1, &$$)) YYERROR; }
| tLONG tLONG tINT { if (!types_find_basic(L"long long int", $1, &$$)) YYERROR; }
| tSIGNED tLONG tLONG { if (!types_find_basic(L"long long int", $1, &$$)) YYERROR; }
| tSIGNED tLONG tLONG tINT { if (!types_find_basic(L"long long int", $1, &$$)) YYERROR; }
| tUNSIGNED tLONG tLONG { if (!types_find_basic(L"unsigned long long int", $1, &$$)) YYERROR; }
| tUNSIGNED tLONG tLONG tINT{ if (!types_find_basic(L"unsigned long long int", $1, &$$)) YYERROR; }
| tLONG tLONG tUNSIGNED { if (!types_find_basic(L"unsigned long long int", $1, &$$)) YYERROR; }
| tLONG tLONG tUNSIGNED tINT{ if (!types_find_basic(L"unsigned long long int", $1, &$$)) YYERROR; }
| tFLOAT { if (!types_find_basic(L"float", $1, &$$)) YYERROR; }
| tDOUBLE { if (!types_find_basic(L"double", $1, &$$)) YYERROR; }
| tLONG tDOUBLE { if (!types_find_basic(L"long double", $1, &$$)) YYERROR; }
| type_expr '*' { $$ = $1; $$.deref_count++; }
| tCLASS identifier { $$.type = type_expr_udt_class; $$.deref_count = 0; $$.u.name = $2; }
| tSTRUCT identifier { $$.type = type_expr_udt_struct; $$.deref_count = 0; $$.u.name = $2; }
......
......@@ -54,6 +54,18 @@ static char* lexeme_alloc(const char* lexeme)
return strcpy(ptr, lexeme);
}
static char* lexeme_alloc_if(const char* lexeme, unsigned sz)
{
size_t len = strlen(lexeme);
char* ptr;
if (len <= sz) return NULL;
len -= sz;
ptr = lexeme_alloc_size(len + 1);
memcpy(ptr, lexeme, len);
ptr[len] = '\0';
return ptr;
}
void lexeme_flush(void)
{
while (--next_lexeme >= 0) HeapFree(GetProcessHeap(), 0, local_lexemes[next_lexeme]);
......@@ -100,7 +112,7 @@ HEXDIGIT [0-9a-fA-F]
FORMAT [ubcdgiswxa]
IDENTIFIER [_a-zA-Z~?][_a-zA-Z0-9~?@]*
SCOPED_IDENTIFIER [_a-zA-Z~?][_a-zA-Z0-9~?@]*"::"
MODULE_IDENTIFIER [_a-zA-Z~?\*][_a-zA-Z0-9~?\*@]*"!"
MODULE_IDENTIFIER [_a-zA-Z~?\*][_a-zA-Z0-9~?\*@\.]*"!"
PATHNAME [\\/_a-zA-Z0-9\.~@][\\/\-_a-zA-Z0-9\.~@]*
STRING \"(\\[^\n]|[^\\"\n])*\"
......@@ -231,14 +243,16 @@ STRING \"(\\[^\n]|[^\\"\n])*\"
<INITIAL,SHOW_CMD>directories|directorie|directori|director|directo|direct|direc|direc|dir {
BEGIN(PATH_EXPECTED); return tDIR; }
char { return tCHAR; }
short { return tSHORT; }
int { return tINT; }
long { return tLONG; }
float { return tFLOAT; }
double { return tDOUBLE; }
unsigned { return tUNSIGNED; }
signed { return tSIGNED; }
{MODULE_IDENTIFIER}?void { dbg_lval.string = lexeme_alloc_if(yytext, 5); return tVOID; } /* return modulename if present */
{MODULE_IDENTIFIER}?char { dbg_lval.string = lexeme_alloc_if(yytext, 5); return tCHAR; }
{MODULE_IDENTIFIER}?WCHAR { dbg_lval.string = lexeme_alloc_if(yytext, 6); return tWCHAR; }
{MODULE_IDENTIFIER}?short { dbg_lval.string = lexeme_alloc_if(yytext, 6); return tSHORT; }
{MODULE_IDENTIFIER}?int { dbg_lval.string = lexeme_alloc_if(yytext, 4); return tINT; }
{MODULE_IDENTIFIER}?long { dbg_lval.string = lexeme_alloc_if(yytext, 5); return tLONG; }
{MODULE_IDENTIFIER}?float { dbg_lval.string = lexeme_alloc_if(yytext, 6); return tFLOAT; }
{MODULE_IDENTIFIER}?double { dbg_lval.string = lexeme_alloc_if(yytext, 7); return tDOUBLE; }
{MODULE_IDENTIFIER}?unsigned { dbg_lval.string = lexeme_alloc_if(yytext, 9); return tUNSIGNED; }
{MODULE_IDENTIFIER}?signed { dbg_lval.string = lexeme_alloc_if(yytext, 7); return tSIGNED; }
struct { return tSTRUCT; }
union { return tUNION; }
enum { return tENUM; }
......
......@@ -67,33 +67,42 @@ enum dbg_line_status
enum dbg_internal_types
{
/* order here must match types.c:basic_types_details table */
dbg_itype_first = 0xffffff00,
dbg_itype_void = dbg_itype_first,
dbg_itype_bool,
dbg_itype_char,
dbg_itype_wchar,
dbg_itype_char8,
dbg_itype_char16,
dbg_itype_char32,
dbg_itype_unsigned_int8,
dbg_itype_signed_int8,
dbg_itype_unsigned_int16,
dbg_itype_signed_int16,
dbg_itype_unsigned_int32,
dbg_itype_signed_int32,
dbg_itype_unsigned_int64,
dbg_itype_signed_int64,
dbg_itype_unsigned_int128,
dbg_itype_signed_int128,
dbg_itype_unsigned_long32,
dbg_itype_signed_long32,
dbg_itype_unsigned_long64,
dbg_itype_signed_int8,
dbg_itype_signed_int16,
dbg_itype_signed_int32,
dbg_itype_signed_int64,
dbg_itype_signed_int128,
dbg_itype_signed_long32,
dbg_itype_signed_long64,
dbg_itype_short_real, /* aka float */
dbg_itype_real, /* aka double */
dbg_itype_long_real, /* aka long double */
dbg_itype_last,
/* they represent the dbg_lg(u)int_t types */
dbg_itype_lgint,
dbg_itype_lguint,
dbg_itype_short_real, /* aka float */
dbg_itype_real, /* aka double */
dbg_itype_long_real, /* aka long double */
dbg_itype_astring,
dbg_itype_ustring,
dbg_itype_segptr, /* hack for segmented pointers */
......@@ -506,6 +515,7 @@ extern struct dbg_type types_find_type(DWORD64 linear, const char* name, enum S
extern BOOL types_compare(const struct dbg_type, const struct dbg_type, BOOL* equal);
extern BOOL types_is_integral_type(const struct dbg_lvalue*);
extern BOOL types_is_float_type(const struct dbg_lvalue*);
extern BOOL types_find_basic(const WCHAR*, const char*, struct type_expr_t* type);
/* winedbg.c */
#ifdef __GNUC__
......@@ -553,10 +563,10 @@ static inline void* dbg_heap_realloc(void* buffer, size_t size)
struct data_model
{
unsigned base_type;
unsigned size;
const WCHAR* name;
enum dbg_internal_types itype;
const WCHAR* name;
};
extern const struct data_model ilp32_data_model[];
extern const struct data_model lp64_data_model[];
extern const struct data_model llp64_data_model[];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment