- no longer store internally the " for strings

- misc clean-ups
- activate symbol demangling by default
This commit is contained in:
Eric Pouech 2005-05-23 09:51:44 +00:00 committed by Alexandre Julliard
parent ac2096d624
commit 29a70954f9
7 changed files with 23 additions and 21 deletions

View File

@ -160,12 +160,10 @@ pathname:
identifier:
tIDENTIFIER { $$ = $1; }
| tIDENTIFIER '!' tIDENTIFIER { char* ptr = HeapAlloc(GetProcessHeap(), 0, strlen($1) + 1 + strlen($3) + 1);
sprintf(ptr, "%s!%s", $1, $3); $$ = lexeme_alloc(ptr);
HeapFree(GetProcessHeap(), 0, ptr); }
| identifier ':' ':' tIDENTIFIER { char* ptr = HeapAlloc(GetProcessHeap(), 0, strlen($1) + 2 + strlen($4) + 1);
sprintf(ptr, "%s::%s", $1, $4); $$ = lexeme_alloc(ptr);
HeapFree(GetProcessHeap(), 0, ptr); }
| tPATH '!' tIDENTIFIER { $$ = lexeme_alloc_size(strlen($1) + 1 + strlen($3) + 1);
sprintf($$, "%s!%s", $1, $3); }
| identifier ':' ':' tIDENTIFIER { $$ = lexeme_alloc_size(strlen($1) + 2 + strlen($4) + 1);
sprintf($$, "%s::%s", $1, $4); }
;
list_arg:
@ -303,10 +301,10 @@ type_expr:
| 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; }
| type_expr '*' { $$ = $1; $$.deref_count++; }
| tCLASS identifier { $$.type = type_expr_udt_class; $$.deref_count = 0; $$.u.name = lexeme_alloc($2); }
| tSTRUCT identifier { $$.type = type_expr_udt_struct; $$.deref_count = 0; $$.u.name = lexeme_alloc($2); }
| tUNION identifier { $$.type = type_expr_udt_union; $$.deref_count = 0; $$.u.name = lexeme_alloc($2); }
| tENUM identifier { $$.type = type_expr_enumeration; $$.deref_count = 0; $$.u.name = lexeme_alloc($2); }
| 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; }
| tUNION identifier { $$.type = type_expr_udt_union; $$.deref_count = 0; $$.u.name = $2; }
| tENUM identifier { $$.type = type_expr_enumeration; $$.deref_count = 0; $$.u.name = $2; }
;
expr_lvalue:

View File

@ -126,7 +126,7 @@ STRING \"[^\n"]+\"
<FORMAT_EXPECTED>"/"{FORMAT} { yylval.integer = (1 << 8) | yytext[1]; return tFORMAT; }
{STRING} { yylval.string = lexeme_alloc(yytext); return tSTRING; }
{STRING} { yylval.string = lexeme_alloc(yytext + 1); yylval.string[strlen(yylval.string) - 1] = '\0'; return tSTRING; }
<ASTRING_EXPECTED>[^\n]+ { char* p = yytext; while (*p == ' ' || *p == '\t') p++;
yylval.string = lexeme_alloc(p); return tSTRING; }
@ -224,7 +224,7 @@ static char** local_lexemes /* = NULL */;
static int next_lexeme /* = 0 */;
static int alloc_lexeme /* = 0 */;
char* lexeme_alloc(const char* lexeme)
char* lexeme_alloc_size(int size)
{
assert(0 <= next_lexeme && next_lexeme < alloc_lexeme + 1);
if (next_lexeme >= alloc_lexeme)
@ -233,7 +233,13 @@ char* lexeme_alloc(const char* lexeme)
local_lexemes = dbg_heap_realloc(local_lexemes, alloc_lexeme * sizeof(local_lexemes[0]));
assert(local_lexemes);
}
return local_lexemes[next_lexeme++] = strcpy(HeapAlloc(GetProcessHeap(), 0, strlen(lexeme) + 1), lexeme);
return local_lexemes[next_lexeme++] = HeapAlloc(GetProcessHeap(), 0, size + 1);
}
char* lexeme_alloc(const char* lexeme)
{
char* ptr = lexeme_alloc_size(strlen(lexeme) + 1);
return strcpy(ptr, lexeme);
}
void lexeme_flush(void)

View File

@ -264,6 +264,7 @@ extern int input_fetch_entire_line(const char* pfx, char** line, si
/* debug.l */
extern void lexeme_flush(void);
extern char* lexeme_alloc(const char*);
extern char* lexeme_alloc_size(int);
/* display.c */
extern int display_print(void);
@ -332,7 +333,7 @@ extern void source_nuke_path(void);
extern void stack_info(void);
extern void stack_backtrace(DWORD threadID, BOOL noisy);
extern int stack_set_frame(int newframe);
extern int stack_get_frame(SYMBOL_INFO* sym, IMAGEHLP_STACK_FRAME* ihsf);
extern BOOL stack_get_frame(SYMBOL_INFO* sym, IMAGEHLP_STACK_FRAME* ihsf);
/* symbol.c */
extern enum sym_get_lval symbol_get_lvalue(const char* name, const int lineno, struct dbg_lvalue* addr, BOOL bp_disp);

View File

@ -190,13 +190,11 @@ struct expr* expr_alloc_uconstant(unsigned int value)
struct expr* expr_alloc_string(const char* str)
{
struct expr* ex;
char* pnt;
ex = expr_alloc();
ex->type = EXPR_TYPE_STRING;
ex->un.string.str = str + 1;
if ((pnt = strrchr(ex->un.string.str, '"'))) *pnt = '\0';
ex->un.string.str = str;
return ex;
}

View File

@ -80,7 +80,7 @@ int stack_set_frame(int newframe)
return TRUE;
}
int stack_get_frame(SYMBOL_INFO* symbol, IMAGEHLP_STACK_FRAME* ihsf)
BOOL stack_get_frame(SYMBOL_INFO* symbol, IMAGEHLP_STACK_FRAME* ihsf)
{
DWORD64 disp;
/*

View File

@ -114,7 +114,7 @@ BOOL types_deref(const struct dbg_lvalue* lvalue, struct dbg_lvalue* result)
*/
if (!types_get_info(&lvalue->type, TI_GET_SYMTAG, &tag) ||
tag != SymTagPointerType ||
memory_read_value(lvalue, sizeof(result->addr.Offset), &result->addr.Offset) ||
!memory_read_value(lvalue, sizeof(result->addr.Offset), &result->addr.Offset) ||
!types_get_info(&lvalue->type, TI_GET_TYPE, &result->type.id))
return FALSE;
result->type.module = lvalue->type.module;
@ -305,7 +305,6 @@ static BOOL CALLBACK types_cb(PSYMBOL_INFO sym, ULONG size, void* _user)
case SymTagPointerType:
type.module = sym->ModBase;
type.id = sym->TypeIndex;
types_get_info(&type, TI_GET_TYPE, &type_id);
if (types_get_info(&type, TI_GET_TYPE, &type_id) && type_id == user->u.typeid)
{
user->result = sym->TypeIndex;

View File

@ -1267,7 +1267,7 @@ int main(int argc, char** argv)
dbg_init_console();
SymSetOptions(SymGetOptions() |
SymSetOptions((SymGetOptions() & ~(SYMOPT_UNDNAME)) |
SYMOPT_LOAD_LINES | SYMOPT_DEFERRED_LOADS | SYMOPT_AUTO_PUBLICS);
retv = dbg_main_loop();