From f7dd869ebf75b98b9ddf983899a1480ffac463f2 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Thu, 17 Nov 2005 12:53:41 +0000 Subject: [PATCH] Dbghelp describes the types of function arguments with a specific symbol-type (symt) which links both to arguments' type and to function prototype - added this new type to dbghelp - implemented its use in winedbg --- dlls/dbghelp/dbghelp.c | 2 -- dlls/dbghelp/dbghelp_private.h | 7 +++++++ dlls/dbghelp/type.c | 20 ++++++++++++++++---- programs/winedbg/dbg.y | 2 +- programs/winedbg/types.c | 1 + 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/dlls/dbghelp/dbghelp.c b/dlls/dbghelp/dbghelp.c index f5907678172..3952f7eff71 100644 --- a/dlls/dbghelp/dbghelp.c +++ b/dlls/dbghelp/dbghelp.c @@ -30,8 +30,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp); /* TODO * - support for symbols' types is still partly missing * + C++ support - * + funcargtype:s are (partly) wrong: they should be a specific struct (like - * typedef) pointing to the actual type (and not a direct access) * + we should store the underlying type for an enum in the symt_enum struct * + for enums, we store the names & values (associated to the enum type), * but those values are not directly usable from a debugger (that's why, I diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 01a6b411986..eb86e509346 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -222,6 +222,13 @@ struct symt_function_signature struct vector vchildren; }; +struct symt_function_arg_type +{ + struct symt symt; + struct symt* arg_type; + struct symt* container; +}; + struct symt_pointer { struct symt symt; diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index f076529d13b..7617be8839b 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -316,12 +316,18 @@ BOOL symt_add_function_signature_parameter(struct module* module, struct symt_function_signature* sig_type, struct symt* param) { - struct symt** p; + struct symt** p; + struct symt_function_arg_type* arg; assert(sig_type->symt.tag == SymTagFunctionType); + arg = pool_alloc(&module->pool, sizeof(*arg)); + if (!arg) return FALSE; + arg->symt.tag = SymTagFunctionArgType; + arg->arg_type = param; + arg->container = &sig_type->symt; p = vector_add(&sig_type->vchildren, &module->pool); - if (!p) return FALSE; /* FIXME we leak e */ - *p = param; + if (!p) return FALSE; /* FIXME we leak arg */ + *p = &arg->symt; return TRUE; } @@ -620,6 +626,9 @@ BOOL symt_get_info(const struct symt* type, IMAGEHLP_SYMBOL_TYPE_INFO req, case SymTagThunk: X(DWORD) = (DWORD)((const struct symt_thunk*)type)->container; break; + case SymTagFunctionArgType: + X(DWORD) = (DWORD)((const struct symt_function_arg_type*)type)->container; + break; default: FIXME("Unsupported sym-tag %s for get-lexical-parent\n", symt_get_tag_str(type->tag)); @@ -702,7 +711,10 @@ BOOL symt_get_info(const struct symt* type, IMAGEHLP_SYMBOL_TYPE_INFO req, case SymTagFunction: X(DWORD) = (DWORD)((const struct symt_function*)type)->type; break; - /* FIXME: should also work for enums and FunctionArgType */ + /* FIXME: should also work for enums */ + case SymTagFunctionArgType: + X(DWORD) = (DWORD)((const struct symt_function_arg_type*)type)->arg_type; + break; default: FIXME("Unsupported sym-tag %s for get-type\n", symt_get_tag_str(type->tag)); diff --git a/programs/winedbg/dbg.y b/programs/winedbg/dbg.y index 45712dfcbb3..523855ad460 100644 --- a/programs/winedbg/dbg.y +++ b/programs/winedbg/dbg.y @@ -136,7 +136,7 @@ command: | tSOURCE pathname { parser($2); } | tSYMBOLFILE pathname { symbol_read_symtable($2, 0); } | tSYMBOLFILE pathname expr_rvalue { symbol_read_symtable($2, $3); } - | tWHATIS expr_lvalue { types_print_type(&$2.type, FALSE); dbg_printf("\n"); } + | tWHATIS expr_lvalue { dbg_printf("type = "); types_print_type(&$2.type, FALSE); dbg_printf("\n"); } | tATTACH tNUM { dbg_attach_debuggee($2, FALSE, TRUE); } | tDETACH { dbg_detach_debuggee(); } | tMINIDUMP pathname { minidump_write($2, (dbg_curr_thread && dbg_curr_thread->in_exception) ? &dbg_curr_thread->excpt_record : NULL);} diff --git a/programs/winedbg/types.c b/programs/winedbg/types.c index 424bca3ff84..53a133d71eb 100644 --- a/programs/winedbg/types.c +++ b/programs/winedbg/types.c @@ -627,6 +627,7 @@ int types_print_type(const struct dbg_type* type, BOOL details) for (i = 0; i < min(fcp->Count, count); i++) { subtype.id = fcp->ChildId[i]; + types_get_info(&subtype, TI_GET_TYPE, &subtype.id); types_print_type(&subtype, FALSE); if (i < min(fcp->Count, count) - 1 || count > 256) dbg_printf(", "); }