Commit 29a70954 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

- no longer store internally the " for strings

- misc clean-ups - activate symbol demangling by default
parent ac2096d6
...@@ -160,12 +160,10 @@ pathname: ...@@ -160,12 +160,10 @@ pathname:
identifier: identifier:
tIDENTIFIER { $$ = $1; } tIDENTIFIER { $$ = $1; }
| tIDENTIFIER '!' tIDENTIFIER { char* ptr = HeapAlloc(GetProcessHeap(), 0, strlen($1) + 1 + strlen($3) + 1); | tPATH '!' tIDENTIFIER { $$ = lexeme_alloc_size(strlen($1) + 1 + strlen($3) + 1);
sprintf(ptr, "%s!%s", $1, $3); $$ = lexeme_alloc(ptr); sprintf($$, "%s!%s", $1, $3); }
HeapFree(GetProcessHeap(), 0, ptr); } | identifier ':' ':' tIDENTIFIER { $$ = lexeme_alloc_size(strlen($1) + 2 + strlen($4) + 1);
| identifier ':' ':' tIDENTIFIER { char* ptr = HeapAlloc(GetProcessHeap(), 0, strlen($1) + 2 + strlen($4) + 1); sprintf($$, "%s::%s", $1, $4); }
sprintf(ptr, "%s::%s", $1, $4); $$ = lexeme_alloc(ptr);
HeapFree(GetProcessHeap(), 0, ptr); }
; ;
list_arg: list_arg:
...@@ -303,10 +301,10 @@ type_expr: ...@@ -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; } | 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; } | 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++; } | type_expr '*' { $$ = $1; $$.deref_count++; }
| tCLASS identifier { $$.type = type_expr_udt_class; $$.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 = lexeme_alloc($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 = lexeme_alloc($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 = lexeme_alloc($2); } | tENUM identifier { $$.type = type_expr_enumeration; $$.deref_count = 0; $$.u.name = $2; }
; ;
expr_lvalue: expr_lvalue:
......
...@@ -126,7 +126,7 @@ STRING \"[^\n"]+\" ...@@ -126,7 +126,7 @@ STRING \"[^\n"]+\"
<FORMAT_EXPECTED>"/"{FORMAT} { yylval.integer = (1 << 8) | yytext[1]; return tFORMAT; } <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++; <ASTRING_EXPECTED>[^\n]+ { char* p = yytext; while (*p == ' ' || *p == '\t') p++;
yylval.string = lexeme_alloc(p); return tSTRING; } yylval.string = lexeme_alloc(p); return tSTRING; }
...@@ -224,7 +224,7 @@ static char** local_lexemes /* = NULL */; ...@@ -224,7 +224,7 @@ static char** local_lexemes /* = NULL */;
static int next_lexeme /* = 0 */; static int next_lexeme /* = 0 */;
static int alloc_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); assert(0 <= next_lexeme && next_lexeme < alloc_lexeme + 1);
if (next_lexeme >= alloc_lexeme) if (next_lexeme >= alloc_lexeme)
...@@ -233,7 +233,13 @@ char* lexeme_alloc(const char* lexeme) ...@@ -233,7 +233,13 @@ char* lexeme_alloc(const char* lexeme)
local_lexemes = dbg_heap_realloc(local_lexemes, alloc_lexeme * sizeof(local_lexemes[0])); local_lexemes = dbg_heap_realloc(local_lexemes, alloc_lexeme * sizeof(local_lexemes[0]));
assert(local_lexemes); 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) void lexeme_flush(void)
......
...@@ -264,6 +264,7 @@ extern int input_fetch_entire_line(const char* pfx, char** line, si ...@@ -264,6 +264,7 @@ extern int input_fetch_entire_line(const char* pfx, char** line, si
/* debug.l */ /* debug.l */
extern void lexeme_flush(void); extern void lexeme_flush(void);
extern char* lexeme_alloc(const char*); extern char* lexeme_alloc(const char*);
extern char* lexeme_alloc_size(int);
/* display.c */ /* display.c */
extern int display_print(void); extern int display_print(void);
...@@ -332,7 +333,7 @@ extern void source_nuke_path(void); ...@@ -332,7 +333,7 @@ extern void source_nuke_path(void);
extern void stack_info(void); extern void stack_info(void);
extern void stack_backtrace(DWORD threadID, BOOL noisy); extern void stack_backtrace(DWORD threadID, BOOL noisy);
extern int stack_set_frame(int newframe); 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 */ /* symbol.c */
extern enum sym_get_lval symbol_get_lvalue(const char* name, const int lineno, struct dbg_lvalue* addr, BOOL bp_disp); extern enum sym_get_lval symbol_get_lvalue(const char* name, const int lineno, struct dbg_lvalue* addr, BOOL bp_disp);
......
...@@ -190,13 +190,11 @@ struct expr* expr_alloc_uconstant(unsigned int value) ...@@ -190,13 +190,11 @@ struct expr* expr_alloc_uconstant(unsigned int value)
struct expr* expr_alloc_string(const char* str) struct expr* expr_alloc_string(const char* str)
{ {
struct expr* ex; struct expr* ex;
char* pnt;
ex = expr_alloc(); ex = expr_alloc();
ex->type = EXPR_TYPE_STRING; ex->type = EXPR_TYPE_STRING;
ex->un.string.str = str + 1; ex->un.string.str = str;
if ((pnt = strrchr(ex->un.string.str, '"'))) *pnt = '\0';
return ex; return ex;
} }
......
...@@ -80,7 +80,7 @@ int stack_set_frame(int newframe) ...@@ -80,7 +80,7 @@ int stack_set_frame(int newframe)
return TRUE; 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; DWORD64 disp;
/* /*
......
...@@ -114,7 +114,7 @@ BOOL types_deref(const struct dbg_lvalue* lvalue, struct dbg_lvalue* result) ...@@ -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) || if (!types_get_info(&lvalue->type, TI_GET_SYMTAG, &tag) ||
tag != SymTagPointerType || 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)) !types_get_info(&lvalue->type, TI_GET_TYPE, &result->type.id))
return FALSE; return FALSE;
result->type.module = lvalue->type.module; result->type.module = lvalue->type.module;
...@@ -305,7 +305,6 @@ static BOOL CALLBACK types_cb(PSYMBOL_INFO sym, ULONG size, void* _user) ...@@ -305,7 +305,6 @@ static BOOL CALLBACK types_cb(PSYMBOL_INFO sym, ULONG size, void* _user)
case SymTagPointerType: case SymTagPointerType:
type.module = sym->ModBase; type.module = sym->ModBase;
type.id = sym->TypeIndex; 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) if (types_get_info(&type, TI_GET_TYPE, &type_id) && type_id == user->u.typeid)
{ {
user->result = sym->TypeIndex; user->result = sym->TypeIndex;
......
...@@ -1267,7 +1267,7 @@ int main(int argc, char** argv) ...@@ -1267,7 +1267,7 @@ int main(int argc, char** argv)
dbg_init_console(); dbg_init_console();
SymSetOptions(SymGetOptions() | SymSetOptions((SymGetOptions() & ~(SYMOPT_UNDNAME)) |
SYMOPT_LOAD_LINES | SYMOPT_DEFERRED_LOADS | SYMOPT_AUTO_PUBLICS); SYMOPT_LOAD_LINES | SYMOPT_DEFERRED_LOADS | SYMOPT_AUTO_PUBLICS);
retv = dbg_main_loop(); retv = dbg_main_loop();
......
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