Eric Pouech : dbghelp: Use the correct size for global variable when searching for a symbol.
Alexandre Julliard
julliard at winehq.org
Mon Sep 8 07:41:26 CDT 2008
Module: wine
Branch: master
Commit: 5ad756fb3ca734c8f2906d6c5b8c91b85ceba6c4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5ad756fb3ca734c8f2906d6c5b8c91b85ceba6c4
Author: Eric Pouech <eric.pouech at orange.fr>
Date: Sat Sep 6 22:20:06 2008 +0200
dbghelp: Use the correct size for global variable when searching for a symbol.
---
dlls/dbghelp/symbol.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c
index f4f2d11..a4a1683 100644
--- a/dlls/dbghelp/symbol.c
+++ b/dlls/dbghelp/symbol.c
@@ -715,6 +715,18 @@ static BOOL resort_symbols(struct module* module)
return module->sortlist_valid = TRUE;
}
+static void symt_get_length(struct symt* symt, ULONG64* size)
+{
+ DWORD type_index;
+
+ if (symt_get_info(symt, TI_GET_LENGTH, size) && *size)
+ return;
+
+ if (symt_get_info(symt, TI_GET_TYPE, &type_index) &&
+ symt_get_info((struct symt*)type_index, TI_GET_LENGTH, size)) return;
+ *size = 0x1000; /* arbitrary value */
+}
+
/* assume addr is in module */
struct symt_ht* symt_find_nearest(struct module* module, DWORD addr)
{
@@ -737,8 +749,7 @@ struct symt_ht* symt_find_nearest(struct module* module, DWORD addr)
if (high)
{
symt_get_info(&module->addr_sorttab[high - 1]->symt, TI_GET_ADDRESS, &ref_addr);
- if (!symt_get_info(&module->addr_sorttab[high - 1]->symt, TI_GET_LENGTH, &ref_size) || !ref_size)
- ref_size = 0x1000; /* arbitrary value */
+ symt_get_length(&module->addr_sorttab[high - 1]->symt, &ref_size);
if (addr >= ref_addr + ref_size) return NULL;
}
@@ -772,8 +783,7 @@ struct symt_ht* symt_find_nearest(struct module* module, DWORD addr)
/* finally check that we fit into the found symbol */
symt_get_info(&module->addr_sorttab[low]->symt, TI_GET_ADDRESS, &ref_addr);
if (addr < ref_addr) return NULL;
- if (!symt_get_info(&module->addr_sorttab[high - 1]->symt, TI_GET_LENGTH, &ref_size) || !ref_size)
- ref_size = 0x1000; /* arbitrary value */
+ symt_get_length(&module->addr_sorttab[low]->symt, &ref_size);
if (addr >= ref_addr + ref_size) return NULL;
return module->addr_sorttab[low];
More information about the wine-cvs
mailing list