Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/type.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index 70719cf6b7c..0baa9d72c32 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -158,11 +158,11 @@ BOOL symt_get_address(const struct symt* type, ULONG64* addr) case SymTagThunk: *addr = ((const struct symt_thunk*)type)->address; break; - case SymTagCompiland: - *addr = ((const struct symt_compiland*)type)->address; - break; default: FIXME("Unsupported sym-tag %s for get-address\n", symt_get_tag_str(type->tag)); + /* fall through */ + case SymTagExe: + case SymTagCompiland: return FALSE; } return TRUE; @@ -689,6 +689,8 @@ BOOL symt_get_info(struct module* module, const struct symt* type, FIXME("Unsupported sym-tag %s for get-length\n", symt_get_tag_str(type->tag)); /* fall through */ + case SymTagExe: + case SymTagCompiland: case SymTagFunctionType: return FALSE; }
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/type.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index 0baa9d72c32..91c334689ce 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -549,6 +549,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type,
switch (type->tag) { + case SymTagCompiland: v = &((const struct symt_compiland*)type)->vchildren; break; case SymTagUDT: v = &((const struct symt_udt*)type)->vchildren; break; case SymTagEnum: v = &((const struct symt_enum*)type)->vchildren; break; case SymTagFunctionType: v = &((const struct symt_function_signature*)type)->vchildren; break; @@ -594,6 +595,9 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case TI_GET_CHILDRENCOUNT: switch (type->tag) { + case SymTagCompiland: + X(DWORD) = vector_length(&((const struct symt_compiland*)type)->vchildren); + break; case SymTagUDT: X(DWORD) = vector_length(&((const struct symt_udt*)type)->vchildren); break;
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/dbghelp_private.h | 1 + dlls/dbghelp/symbol.c | 4 ++++ dlls/dbghelp/type.c | 7 +++++++ 3 files changed, 12 insertions(+)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 0587ce13914..2fc5a7e5eca 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -169,6 +169,7 @@ struct symt_block struct symt_module /* in fact any of .exe, .dll... */ { struct symt symt; /* module */ + struct vector vchildren; /* compilation units */ struct module* module; };
diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index e2fde00456a..091ea173305 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -191,6 +191,7 @@ struct symt_module* symt_new_module(struct module* module) { sym->symt.tag = SymTagExe; sym->module = module; + vector_init(&sym->vchildren, sizeof(struct symt*), 8); } return sym; } @@ -199,6 +200,7 @@ struct symt_compiland* symt_new_compiland(struct module* module, ULONG_PTR address, unsigned src_idx) { struct symt_compiland* sym; + struct symt_compiland** p;
TRACE_(dbghelp_symt)("Adding compiland symbol %s:%s\n", debugstr_w(module->modulename), source_get(module, src_idx)); @@ -210,6 +212,8 @@ struct symt_compiland* symt_new_compiland(struct module* module, sym->source = src_idx; vector_init(&sym->vchildren, sizeof(struct symt*), 32); sym->user = NULL; + p = vector_add(&module->top->vchildren, &module->pool); + *p = sym; } return sym; } diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index 91c334689ce..ae601c0cda2 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -549,6 +549,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type,
switch (type->tag) { + case SymTagExe: v = &((const struct symt_module*)type)->vchildren; break; case SymTagCompiland: v = &((const struct symt_compiland*)type)->vchildren; break; case SymTagUDT: v = &((const struct symt_udt*)type)->vchildren; break; case SymTagEnum: v = &((const struct symt_enum*)type)->vchildren; break; @@ -595,6 +596,9 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case TI_GET_CHILDRENCOUNT: switch (type->tag) { + case SymTagExe: + X(DWORD) = vector_length(&((const struct symt_module*)type)->vchildren); + break; case SymTagCompiland: X(DWORD) = vector_length(&((const struct symt_compiland*)type)->vchildren); break; @@ -703,6 +707,9 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case TI_GET_LEXICALPARENT: switch (type->tag) { + case SymTagCompiland: + X(DWORD) = symt_ptr2index(module, &((const struct symt_compiland*)type)->container->symt); + break; case SymTagBlock: X(DWORD) = symt_ptr2index(module, ((const struct symt_block*)type)->container); break;
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/type.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index ae601c0cda2..69b25bafef0 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -732,6 +732,8 @@ BOOL symt_get_info(struct module* module, const struct symt* type, default: FIXME("Unsupported sym-tag %s for get-lexical-parent\n", symt_get_tag_str(type->tag)); + /* fall through */ + case SymTagExe: return FALSE; } break;
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/type.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index 69b25bafef0..e7c180f32d7 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -555,6 +555,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case SymTagEnum: v = &((const struct symt_enum*)type)->vchildren; break; case SymTagFunctionType: v = &((const struct symt_function_signature*)type)->vchildren; break; case SymTagFunction: v = &((const struct symt_function*)type)->vchildren; break; + case SymTagBlock: v = &((const struct symt_block*)type)->vchildren; break; default: FIXME("Unsupported sym-tag %s for find-children\n", symt_get_tag_str(type->tag)); @@ -614,6 +615,9 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case SymTagFunction: X(DWORD) = vector_length(&((const struct symt_function*)type)->vchildren); break; + case SymTagBlock: + X(DWORD) = vector_length(&((const struct symt_block*)type)->vchildren); + break; case SymTagPointerType: /* MS does it that way */ case SymTagArrayType: /* MS does it that way */ case SymTagThunk: /* MS does it that way */
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/type.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index e7c180f32d7..b9d90b000d7 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -141,6 +141,9 @@ BOOL symt_get_address(const struct symt* type, ULONG64* addr) default: return FALSE; } break; + case SymTagBlock: + *addr = ((const struct symt_block*)type)->address; + break; case SymTagFunction: *addr = ((const struct symt_function*)type)->address; break; @@ -664,6 +667,9 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case SymTagFunction: X(DWORD64) = ((const struct symt_function*)type)->size; break; + case SymTagBlock: + X(DWORD64) = ((const struct symt_block*)type)->size; + break; case SymTagPointerType: X(DWORD64) = ((const struct symt_pointer*)type)->size; break;
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/type.c | 1 + include/cvconst.h | 1 + include/dbghelp.h | 9 +++++++++ 3 files changed, 11 insertions(+)
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index b9d90b000d7..221dbe68f42 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -83,6 +83,7 @@ static const char* symt_get_tag_str(DWORD tag) case SymTagExport: return "SymTagExport"; case SymTagHeapAllocationSite: return "SymTagHeapAllocationSite"; case SymTagCoffGroup: return "SymTagCoffGroup"; + case SymTagInlinee: return "SymTagInlinee"; default: return "---"; } } diff --git a/include/cvconst.h b/include/cvconst.h index f90c61a57fa..82929dda772 100644 --- a/include/cvconst.h +++ b/include/cvconst.h @@ -66,6 +66,7 @@ enum SymTagEnum SymTagExport, SymTagHeapAllocationSite, SymTagCoffGroup, + SymTagInlinee, SymTagMax };
diff --git a/include/dbghelp.h b/include/dbghelp.h index bf235c7f97a..75dfd76b327 100644 --- a/include/dbghelp.h +++ b/include/dbghelp.h @@ -1071,6 +1071,15 @@ typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO TI_GET_UDTKIND, TI_IS_EQUIV_TO, TI_GET_CALLING_CONVENTION, + TI_IS_CLOSE_EQUIV_TO, + TI_GTIEX_REQS_VALID, + TI_GET_VIRTUALBASEOFFSET, + TI_GET_VIRTUALBASEDISPINDEX, + TI_GET_IS_REFERENCE, + TI_GET_INDIRECTVIRTUALBASECLASS, + TI_GET_VIRTUALBASETABLETYPE, + TI_GET_OBJECTPOINTERTYPE, + IMAGEHLP_SYMBOL_TYPE_INFO_MAX } IMAGEHLP_SYMBOL_TYPE_INFO;
#define IMAGEHLP_GET_TYPE_INFO_UNCACHED 0x00000001
(as any other type)
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/dbghelp_private.h | 1 - dlls/dbghelp/type.c | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 2fc5a7e5eca..474e76d52b6 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -294,7 +294,6 @@ struct symt_function_arg_type { struct symt symt; struct symt* arg_type; - struct symt* container; };
struct symt_pointer diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index 221dbe68f42..fc6ae3f7350 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -411,7 +411,6 @@ BOOL symt_add_function_signature_parameter(struct module* module, 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 arg */ *p = &arg->symt; @@ -733,11 +732,9 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case SymTagThunk: X(DWORD) = symt_ptr2index(module, ((const struct symt_thunk*)type)->container); break; - case SymTagFunctionArgType: - X(DWORD) = symt_ptr2index(module, ((const struct symt_function_arg_type*)type)->container); - break; case SymTagUDT: case SymTagEnum: + case SymTagFunctionArgType: X(DWORD) = symt_ptr2index(module, &module->top->symt); break; default:
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/type.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index fc6ae3f7350..709a4bc851b 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -559,6 +559,17 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case SymTagFunctionType: v = &((const struct symt_function_signature*)type)->vchildren; break; case SymTagFunction: v = &((const struct symt_function*)type)->vchildren; break; case SymTagBlock: v = &((const struct symt_block*)type)->vchildren; break; + case SymTagPointerType: + case SymTagArrayType: + case SymTagFunctionArgType: + case SymTagThunk: + case SymTagLabel: + case SymTagFuncDebugStart: + case SymTagFuncDebugEnd: + case SymTagTypedef: + case SymTagBaseType: + /* for those, CHILDRENCOUNT returns 0 */ + return tifp->Count == 0; default: FIXME("Unsupported sym-tag %s for find-children\n", symt_get_tag_str(type->tag)); @@ -621,18 +632,25 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case SymTagBlock: X(DWORD) = vector_length(&((const struct symt_block*)type)->vchildren); break; - case SymTagPointerType: /* MS does it that way */ - case SymTagArrayType: /* MS does it that way */ - case SymTagThunk: /* MS does it that way */ + /* some SymTag:s return 0 */ + case SymTagPointerType: + case SymTagArrayType: + case SymTagFunctionArgType: + case SymTagThunk: + case SymTagFuncDebugStart: + case SymTagFuncDebugEnd: + case SymTagLabel: + case SymTagTypedef: + case SymTagBaseType: X(DWORD) = 0; break; default: FIXME("Unsupported sym-tag %s for get-children-count\n", symt_get_tag_str(type->tag)); /* fall through */ + /* some others return error */ case SymTagData: case SymTagPublicSymbol: - case SymTagBaseType: return FALSE; } break;
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/type.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index 709a4bc851b..d2721c764cf 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -111,6 +111,10 @@ const char* symt_get_name(const struct symt* sym) case SymTagArrayType: case SymTagPointerType: case SymTagFunctionType: + case SymTagFunctionArgType: + case SymTagBlock: + case SymTagFuncDebugStart: + case SymTagFuncDebugEnd: return NULL; } } @@ -167,6 +171,14 @@ BOOL symt_get_address(const struct symt* type, ULONG64* addr) /* fall through */ case SymTagExe: case SymTagCompiland: + case SymTagFunctionType: + case SymTagFunctionArgType: + case SymTagBaseType: + case SymTagUDT: + case SymTagEnum: + case SymTagTypedef: + case SymTagPointerType: + case SymTagArrayType: return FALSE; } return TRUE; @@ -728,6 +740,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case SymTagExe: case SymTagCompiland: case SymTagFunctionType: + case SymTagFunctionArgType: return FALSE; } break; @@ -798,6 +811,20 @@ BOOL symt_get_info(struct module* module, const struct symt* type, default: FIXME("Unsupported sym-tag %s for get-offset\n", symt_get_tag_str(type->tag)); + /* fall through */ + case SymTagExe: + case SymTagCompiland: + case SymTagUDT: + case SymTagFunctionType: + case SymTagFunctionArgType: + case SymTagPointerType: + case SymTagArrayType: + case SymTagBaseType: + case SymTagTypedef: + case SymTagBlock: + case SymTagFuncDebugStart: + case SymTagFuncDebugEnd: + case SymTagLabel: return FALSE; } break; @@ -862,7 +889,14 @@ BOOL symt_get_info(struct module* module, const struct symt* type, /* fall through */ case SymTagPublicSymbol: case SymTagThunk: + case SymTagBlock: + case SymTagFuncDebugStart: + case SymTagFuncDebugEnd: case SymTagLabel: + case SymTagExe: + case SymTagCompiland: + case SymTagUDT: + case SymTagBaseType: return FALSE; } break;
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/type.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index d2721c764cf..320af023135 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -730,9 +730,6 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case SymTagThunk: X(DWORD64) = ((const struct symt_thunk*)type)->size; break; - case SymTagLabel: - X(DWORD64) = 0; - break; default: FIXME("Unsupported sym-tag %s for get-length\n", symt_get_tag_str(type->tag)); @@ -741,6 +738,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case SymTagCompiland: case SymTagFunctionType: case SymTagFunctionArgType: + case SymTagLabel: return FALSE; } break;
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/type.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index 320af023135..b45e79e9946 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -763,7 +763,13 @@ BOOL symt_get_info(struct module* module, const struct symt* type, break; case SymTagUDT: case SymTagEnum: + case SymTagFunctionType: case SymTagFunctionArgType: + case SymTagPointerType: + case SymTagArrayType: + case SymTagBaseType: + case SymTagTypedef: + case SymTagBaseClass: X(DWORD) = symt_ptr2index(module, &module->top->symt); break; default:
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/type.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index b45e79e9946..4e322ea5364 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -761,6 +761,11 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case SymTagThunk: X(DWORD) = symt_ptr2index(module, ((const struct symt_thunk*)type)->container); break; + case SymTagFuncDebugStart: + case SymTagFuncDebugEnd: + case SymTagLabel: + X(DWORD) = symt_ptr2index(module, ((const struct symt_hierarchy_point*)type)->parent); + break; case SymTagUDT: case SymTagEnum: case SymTagFunctionType:
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/type.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index 4e322ea5364..eaec124c57b 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -775,6 +775,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case SymTagBaseType: case SymTagTypedef: case SymTagBaseClass: + case SymTagPublicSymbol: X(DWORD) = symt_ptr2index(module, &module->top->symt); break; default:
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/type.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index eaec124c57b..ee6e1865fa8 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -970,17 +970,15 @@ BOOL symt_get_info(struct module* module, const struct symt* type,
#undef X
- case TI_GET_ADDRESSOFFSET: - case TI_GET_SYMINDEX: - case TI_GET_THISADJUST: - case TI_GET_VIRTUALBASECLASS: - case TI_GET_VIRTUALBASEPOINTEROFFSET: - case TI_GET_VIRTUALTABLESHAPEID: - case TI_IS_EQUIV_TO: - FIXME("Unsupported GetInfo request (%u)\n", req); - return FALSE; default: - FIXME("Unknown GetInfo request (%u)\n", req); + { + static DWORD64 once; + if (!(once & ((DWORD64)1 << req))) + { + FIXME("Unsupported GetInfo request (%u)\n", req); + once |= (DWORD64)1 << req; + } + } return FALSE; }
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/dwarf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index 430544196c5..c15b59b57c3 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -1988,7 +1988,7 @@ static void dwarf2_parse_subprogram_label(dwarf2_subprogram_t* subpgm, name.u.string = NULL;
loc.kind = loc_absolute; - loc.offset = subpgm->ctx->module_ctx->load_offset + low_pc.u.uvalue; + loc.offset = subpgm->ctx->module_ctx->load_offset + low_pc.u.uvalue - subpgm->func->address; symt_add_function_point(subpgm->ctx->module_ctx->module, subpgm->func, SymTagLabel, &loc, name.u.string); }
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/dbghelp.spec | 4 ++-- dlls/dbghelp/image.c | 6 ++++-- include/dbghelp.h | 9 +++++---- include/imagehlp.h | 17 ++++++++++------- 4 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/dlls/dbghelp/dbghelp.spec b/dlls/dbghelp/dbghelp.spec index 39820a98566..047e81b3777 100644 --- a/dlls/dbghelp/dbghelp.spec +++ b/dlls/dbghelp/dbghelp.spec @@ -25,7 +25,7 @@ @ stdcall ImagehlpApiVersion() @ stdcall ImagehlpApiVersionEx(ptr) @ stdcall MakeSureDirectoryPathExists(str) -@ stdcall MapDebugInformation(long str str long) +@ stdcall -arch=i386 MapDebugInformation(long str str long) @ stdcall MiniDumpReadDumpStream(ptr long ptr ptr ptr) @ stdcall MiniDumpWriteDump(ptr long ptr long ptr ptr ptr) @ stdcall SearchTreeForFile(str str ptr) @@ -187,7 +187,7 @@ @ stdcall SymUnloadModule64(long int64) @ stdcall UnDecorateSymbolName(str ptr long long) @ stdcall UnDecorateSymbolNameW(wstr ptr long long) -@ stdcall UnmapDebugInformation(ptr) +@ stdcall -arch=i386 UnmapDebugInformation(ptr) @ stdcall WinDbgExtensionDllInit(ptr long long) #@ stub block #@ stub chksym diff --git a/dlls/dbghelp/image.c b/dlls/dbghelp/image.c index 59622180dc7..7de0a6e23c8 100644 --- a/dlls/dbghelp/image.c +++ b/dlls/dbghelp/image.c @@ -26,8 +26,6 @@ #include "winternl.h" #include "wine/debug.h"
-WINE_DEFAULT_DEBUG_CHANNEL(dbghelp); - /*********************************************************************** * GetTimestampForLoadedLibrary (DBGHELP.@) */ @@ -37,6 +35,9 @@ DWORD WINAPI GetTimestampForLoadedLibrary(HMODULE Module) return (nth) ? nth->FileHeader.TimeDateStamp : 0; }
+#ifndef _WIN64 +WINE_DEFAULT_DEBUG_CHANNEL(dbghelp); + /*********************************************************************** * MapDebugInformation (DBGHELP.@) */ @@ -57,3 +58,4 @@ BOOL WINAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION DebugInfo) SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; } +#endif diff --git a/include/dbghelp.h b/include/dbghelp.h index 75dfd76b327..c4770553809 100644 --- a/include/dbghelp.h +++ b/include/dbghelp.h @@ -1408,6 +1408,7 @@ typedef struct API_VERSION LPAPI_VERSION WINAPI ImagehlpApiVersion(void); LPAPI_VERSION WINAPI ImagehlpApiVersionEx(LPAPI_VERSION);
+#ifndef _WIN64 typedef struct _IMAGE_DEBUG_INFORMATION { LIST_ENTRY List; @@ -1443,6 +1444,10 @@ typedef struct _IMAGE_DEBUG_INFORMATION DWORD Reserved[ 2 ]; } IMAGE_DEBUG_INFORMATION, *PIMAGE_DEBUG_INFORMATION;
+PIMAGE_DEBUG_INFORMATION WINAPI MapDebugInformation(HANDLE, PCSTR, PCSTR, ULONG); +BOOL WINAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION); +#endif + typedef enum { SYMOPT_EX_DISABLEACCESSTIMEUPDATE, @@ -1453,10 +1458,6 @@ typedef enum #endif } IMAGEHLP_EXTENDED_OPTIONS;
-PIMAGE_DEBUG_INFORMATION WINAPI MapDebugInformation(HANDLE, PCSTR, PCSTR, ULONG); - -BOOL WINAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION); - DWORD WINAPI SymGetOptions(void); DWORD WINAPI SymSetOptions(DWORD);
diff --git a/include/imagehlp.h b/include/imagehlp.h index 5ee978a3d4c..72936e4353e 100644 --- a/include/imagehlp.h +++ b/include/imagehlp.h @@ -239,6 +239,7 @@ typedef struct _API_VERSION { USHORT Reserved; } API_VERSION, *LPAPI_VERSION;
+#ifndef _WIN64 typedef struct _IMAGE_DEBUG_INFORMATION { LIST_ENTRY List; DWORD Size; @@ -282,6 +283,15 @@ typedef struct _IMAGE_DEBUG_INFORMATION { DWORD Reserved[3]; } IMAGE_DEBUG_INFORMATION, *PIMAGE_DEBUG_INFORMATION;
+PIMAGE_DEBUG_INFORMATION WINAPI MapDebugInformation( + HANDLE FileHandle, PCSTR FileName, + PCSTR SymbolPath, ULONG ImageBase +); +BOOL WINAPI UnmapDebugInformation( + PIMAGE_DEBUG_INFORMATION DebugInfo +); +#endif + typedef struct _ADDRESS { DWORD Offset; WORD Segment; @@ -958,10 +968,6 @@ BOOL WINAPI MapAndLoad( PCSTR ImageName, PCSTR DllPath, PLOADED_IMAGE LoadedImage, BOOL DotDll, BOOL ReadOnly ); -PIMAGE_DEBUG_INFORMATION WINAPI MapDebugInformation( - HANDLE FileHandle, PCSTR FileName, - PCSTR SymbolPath, ULONG ImageBase -); DWORD WINAPI MapFileAndCheckSumA( PCSTR Filename, PDWORD HeaderSum, PDWORD CheckSum ); @@ -1385,9 +1391,6 @@ DWORD WINAPI UnDecorateSymbolNameW( BOOL WINAPI UnMapAndLoad( PLOADED_IMAGE LoadedImage ); -BOOL WINAPI UnmapDebugInformation( - PIMAGE_DEBUG_INFORMATION DebugInfo -); BOOL WINAPI UpdateDebugInfoFile( PCSTR ImageFileName, PCSTR SymbolPath, PSTR DebugFilePath, PIMAGE_NT_HEADERS32 NtHeaders
(MASM generate those)
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/type.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index ee6e1865fa8..b09406028e8 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -160,7 +160,7 @@ BOOL symt_get_address(const struct symt* type, ULONG64* addr) case SymTagLabel: if (!((const struct symt_hierarchy_point*)type)->parent || !symt_get_address(((const struct symt_hierarchy_point*)type)->parent, addr)) - return FALSE; + *addr = 0; *addr += ((const struct symt_hierarchy_point*)type)->loc.offset; break; case SymTagThunk:
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/dbghelp_private.h | 12 +++++ dlls/dbghelp/module.c | 1 dlls/dbghelp/symbol.c | 106 +++++++++++++++++++++++++++++++--------- dlls/dbghelp/type.c | 12 +++++ 4 files changed, 107 insertions(+), 24 deletions(-)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 474e76d52b6..14c4336e205 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -256,6 +256,14 @@ struct symt_thunk THUNK_ORDINAL ordinal; /* FIXME: doesn't seem to be accessible */ };
+struct symt_custom +{ + struct symt symt; + struct hash_table_elt hash_elt; + DWORD64 address; + DWORD size; +}; + /* class tree */ struct symt_array { @@ -382,6 +390,7 @@ struct module
/* symbols & symbol tables */ struct vector vsymt; + struct vector vcustom_symt; int sortlist_valid; unsigned num_sorttab; /* number of symbols with addresses */ unsigned num_symbols; @@ -791,6 +800,9 @@ extern struct symt_hierarchy_point* const char* name, ULONG_PTR address) DECLSPEC_HIDDEN; extern struct symt* symt_index2ptr(struct module* module, DWORD id) DECLSPEC_HIDDEN; extern DWORD symt_ptr2index(struct module* module, const struct symt* sym) DECLSPEC_HIDDEN; +extern struct symt_custom* + symt_new_custom(struct module* module, const char* name, + DWORD64 addr, DWORD size) DECLSPEC_HIDDEN;
/* type.c */ extern void symt_init_basic(struct module* module) DECLSPEC_HIDDEN; diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c index 826306cfb38..254bbb297d7 100644 --- a/dlls/dbghelp/module.c +++ b/dlls/dbghelp/module.c @@ -243,6 +243,7 @@ struct module* module_new(struct process* pcs, const WCHAR* name, module->num_symbols = 0;
vector_init(&module->vsymt, sizeof(struct symt*), 128); + vector_init(&module->vcustom_symt, sizeof(struct symt*), 16); /* FIXME: this seems a bit too high (on a per module basis) * need some statistics about this */ diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index 091ea173305..ffb0e53fdeb 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -64,35 +64,68 @@ int __cdecl symt_cmp_addr(const void* p1, const void* p2) return cmp_addr(a1, a2); }
+#define BASE_CUSTOM_SYMT 0x80000000 + +/* dbghelp exposes the internal symbols/types with DWORD indexes. + * - custom symbols are always stored with index starting at BASE_CUSTOM_SYMT + * - for all the others (non custom) symbols: + * + on 32bit machine, index is set to the actual adress of symt + * + on 64bit machine, we have a dedicated array to store symt exposed to caller + * index is the index in this array of the symbol + */ DWORD symt_ptr2index(struct module* module, const struct symt* sym) { -#ifdef _WIN64 + struct vector* vector; + DWORD offset; const struct symt** c; - int len = vector_length(&module->vsymt), i; + int len, i;
+ if (!sym) return 0; + if (sym->tag == SymTagCustom) + { + vector = &module->vcustom_symt; + offset = BASE_CUSTOM_SYMT; + } + else + { +#ifdef _WIN64 + vector = &module->vsymt; + offset = 1; +#else + return (DWORD)sym; +#endif + } + len = vector_length(vector); /* FIXME: this is inefficient */ for (i = 0; i < len; i++) { - if (*(struct symt**)vector_at(&module->vsymt, i) == sym) - return i + 1; + if (*(struct symt**)vector_at(vector, i) == sym) + return i + offset; } /* not found */ - c = vector_add(&module->vsymt, &module->pool); + c = vector_add(vector, &module->pool); if (c) *c = sym; - return len + 1; -#else - return (DWORD)sym; -#endif + return len + offset; }
struct symt* symt_index2ptr(struct module* module, DWORD id) { + struct vector* vector; + if (id >= BASE_CUSTOM_SYMT) + { + id -= BASE_CUSTOM_SYMT; + vector = &module->vcustom_symt; + } + else + { #ifdef _WIN64 - if (!id-- || id >= vector_length(&module->vsymt)) return NULL; - return *(struct symt**)vector_at(&module->vsymt, id); + if (!id--) return NULL; + vector = &module->vsymt; #else - return (struct symt*)id; + return (struct symt*)id; #endif + } + return (id >= vector_length(vector)) ? NULL : *(struct symt**)vector_at(vector, id); }
static BOOL symt_grow_sorttab(struct module* module, unsigned sz) @@ -595,6 +628,25 @@ struct symt_hierarchy_point* symt_new_label(struct module* module, return sym; }
+struct symt_custom* symt_new_custom(struct module* module, const char* name, + DWORD64 addr, DWORD size) +{ + struct symt_custom* sym; + + TRACE_(dbghelp_symt)("Adding custom symbol %s:%s\n", + debugstr_w(module->modulename), name); + + if ((sym = pool_alloc(&module->pool, sizeof(*sym)))) + { + sym->symt.tag = SymTagCustom; + sym->hash_elt.name = pool_strdup(&module->pool, name); + sym->address = addr; + sym->size = size; + symt_add_module_ht(module, (struct symt_ht*)sym); + } + return sym; +} + /* expect sym_info->MaxNameLen to be set before being called */ static void symt_fill_sym_info(struct module_pair* pair, const struct symt_function* func, @@ -734,6 +786,10 @@ static void symt_fill_sym_info(struct module_pair* pair, sym_info->Flags |= SYMFLAG_THUNK; symt_get_address(sym, &sym_info->Address); break; + case SymTagCustom: + symt_get_address(sym, &sym_info->Address); + sym_info->Flags |= SYMFLAG_VIRTUAL; + break; default: symt_get_address(sym, &sym_info->Address); sym_info->Register = 0; @@ -2281,30 +2337,32 @@ BOOL WINAPI SymSearchW(HANDLE hProcess, ULONG64 BaseOfDll, DWORD Index, BOOL WINAPI SymAddSymbol(HANDLE hProcess, ULONG64 BaseOfDll, PCSTR name, DWORD64 addr, DWORD size, DWORD flags) { - WCHAR nameW[MAX_SYM_NAME]; + struct module_pair pair; + + TRACE("(%p %s %s %u)\n", hProcess, wine_dbgstr_a(name), wine_dbgstr_longlong(addr), size);
- MultiByteToWideChar(CP_ACP, 0, name, -1, nameW, ARRAY_SIZE(nameW)); - return SymAddSymbolW(hProcess, BaseOfDll, nameW, addr, size, flags); + pair.pcs = process_find_by_handle(hProcess); + if (!pair.pcs) return FALSE; + pair.requested = module_find_by_addr(pair.pcs, BaseOfDll, DMT_UNKNOWN); + if (!module_get_debug(&pair)) return FALSE; + + return symt_new_custom(pair.effective, name, addr, size) != NULL; }
/****************************************************************** * SymAddSymbolW (DBGHELP.@) * */ -BOOL WINAPI SymAddSymbolW(HANDLE hProcess, ULONG64 BaseOfDll, PCWSTR name, +BOOL WINAPI SymAddSymbolW(HANDLE hProcess, ULONG64 BaseOfDll, PCWSTR nameW, DWORD64 addr, DWORD size, DWORD flags) { - struct module_pair pair; + char name[MAX_SYM_NAME];
- TRACE("(%p %s %s %u)\n", hProcess, wine_dbgstr_w(name), wine_dbgstr_longlong(addr), size); + TRACE("(%p %s %s %u)\n", hProcess, wine_dbgstr_w(nameW), wine_dbgstr_longlong(addr), size);
- pair.pcs = process_find_by_handle(hProcess); - if (!pair.pcs) return FALSE; - pair.requested = module_find_by_addr(pair.pcs, BaseOfDll, DMT_UNKNOWN); - if (!module_get_debug(&pair)) return FALSE; + WideCharToMultiByte(CP_ACP, 0, nameW, -1, name, ARRAY_SIZE(name), NULL, NULL);
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + return SymAddSymbol(hProcess, BaseOfDll, name, addr, size, flags); }
/****************************************************************** diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index b09406028e8..d41e13ef79e 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -99,6 +99,7 @@ const char* symt_get_name(const struct symt* sym) case SymTagBaseType: return ((const struct symt_basic*)sym)->hash_elt.name; case SymTagLabel: return ((const struct symt_hierarchy_point*)sym)->hash_elt.name; case SymTagThunk: return ((const struct symt_thunk*)sym)->hash_elt.name; + case SymTagCustom: return ((const struct symt_custom*)sym)->hash_elt.name; /* hierarchy tree */ case SymTagEnum: return ((const struct symt_enum*)sym)->hash_elt.name; case SymTagTypedef: return ((const struct symt_typedef*)sym)->hash_elt.name; @@ -166,6 +167,9 @@ BOOL symt_get_address(const struct symt* type, ULONG64* addr) case SymTagThunk: *addr = ((const struct symt_thunk*)type)->address; break; + case SymTagCustom: + *addr = ((const struct symt_custom*)type)->address; + break; default: FIXME("Unsupported sym-tag %s for get-address\n", symt_get_tag_str(type->tag)); /* fall through */ @@ -580,6 +584,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case SymTagFuncDebugEnd: case SymTagTypedef: case SymTagBaseType: + case SymTagCustom: /* for those, CHILDRENCOUNT returns 0 */ return tifp->Count == 0; default: @@ -654,6 +659,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case SymTagLabel: case SymTagTypedef: case SymTagBaseType: + case SymTagCustom: X(DWORD) = 0; break; default: @@ -730,6 +736,9 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case SymTagThunk: X(DWORD64) = ((const struct symt_thunk*)type)->size; break; + case SymTagCustom: + X(DWORD64) = ((const struct symt_custom*)type)->size; + break; default: FIXME("Unsupported sym-tag %s for get-length\n", symt_get_tag_str(type->tag)); @@ -776,6 +785,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case SymTagTypedef: case SymTagBaseClass: case SymTagPublicSymbol: + case SymTagCustom: X(DWORD) = symt_ptr2index(module, &module->top->symt); break; default: @@ -835,6 +845,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case SymTagFuncDebugStart: case SymTagFuncDebugEnd: case SymTagLabel: + case SymTagCustom: return FALSE; } break; @@ -907,6 +918,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case SymTagCompiland: case SymTagUDT: case SymTagBaseType: + case SymTagCustom: return FALSE; } break;