From ab9cc3e9dcff562d5488795d05423e5be946ab8a Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Sun, 13 Mar 2011 21:30:53 +0100 Subject: [PATCH] dbghelp: In msc unwinding code (from FPO extended data), take care of cases where several variables are stored in the same hash. --- dlls/dbghelp/msc.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 5c630a04e70..7d64239e32d 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -2924,10 +2924,15 @@ static BOOL pev_get_val(struct pevaluator* pev, const char* str, DWORD_PTR* val case '$': case '.': hash_table_iter_init(&pev->values, &hti, str); - if (!(ptr = hash_table_iter_up(&hti))) - return PEV_ERROR1(pev, "get_zvalue: no value found (%s)", str); - *val = GET_ENTRY(ptr, struct zvalue, elt)->value; - return TRUE; + while ((ptr = hash_table_iter_up(&hti))) + { + if (!strcmp(GET_ENTRY(ptr, struct zvalue, elt)->elt.name, str)) + { + *val = GET_ENTRY(ptr, struct zvalue, elt)->value; + return TRUE; + } + } + return PEV_ERROR1(pev, "get_zvalue: no value found (%s)", str); default: *val = strtol(str, &n, 10); if (n == str || *n != '\0') @@ -2974,7 +2979,15 @@ static BOOL pev_set_value(struct pevaluator* pev, const char* name, DWORD_PTR v void* ptr; hash_table_iter_init(&pev->values, &hti, name); - if (!(ptr = hash_table_iter_up(&hti))) + while ((ptr = hash_table_iter_up(&hti))) + { + if (!strcmp(GET_ENTRY(ptr, struct zvalue, elt)->elt.name, name)) + { + GET_ENTRY(ptr, struct zvalue, elt)->value = val; + break; + } + } + if (!ptr) { struct zvalue* zv = pool_alloc(&pev->pool, sizeof(*zv)); if (!zv) return PEV_ERROR(pev, "set_value: out of memory"); @@ -2983,7 +2996,6 @@ static BOOL pev_set_value(struct pevaluator* pev, const char* name, DWORD_PTR v zv->elt.name = pool_strdup(&pev->pool, name); hash_table_add(&pev->values, &zv->elt); } - else GET_ENTRY(ptr, struct zvalue, elt)->value = val; return TRUE; } @@ -3158,7 +3170,7 @@ BOOL pdb_virtual_unwind(struct cpu_stack_walk* csw, DWORD_PTR ip, fpoext[i].str_offset < strsize ? wine_dbgstr_a(strbase + 12 + fpoext[i].str_offset) : ""); if (fpoext[i].str_offset < strsize) - ret = pdb_parse_cmd_string(csw, fpoext, strbase + 12 + fpoext[i].str_offset, cpair); + ret = pdb_parse_cmd_string(csw, &fpoext[i], strbase + 12 + fpoext[i].str_offset, cpair); else ret = FALSE; break;