- added missing W64 variant - always regenerate the FileName field (as we don't know whether the internal buffer has been reused or not)
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/dbghelp.spec | 2 + dlls/dbghelp/symbol.c | 69 ++++++++++++++++++++++++++++++--------------- 2 files changed, 47 insertions(+), 24 deletions(-)
diff --git a/dlls/dbghelp/dbghelp.spec b/dlls/dbghelp/dbghelp.spec index 73455c547e8..1d95c7a21ff 100644 --- a/dlls/dbghelp/dbghelp.spec +++ b/dlls/dbghelp/dbghelp.spec @@ -92,7 +92,7 @@ @ stdcall SymGetLineFromNameW64(long wstr wstr long ptr ptr) @ stdcall SymGetLineNext(long ptr) @ stdcall SymGetLineNext64(long ptr) -@ stub SymGetLineNextW64 +@ stdcall SymGetLineNextW64(long ptr) @ stdcall SymGetLinePrev(long ptr) @ stdcall SymGetLinePrev64(long ptr) @ stub SymGetLinePrevW64 diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index d79b32a0b5a..25bb21edeaa 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -1861,24 +1861,35 @@ BOOL WINAPI SymGetLinePrev(HANDLE hProcess, PIMAGEHLP_LINE Line) return TRUE; }
-static BOOL symt_get_func_line_next(const struct module* module, PIMAGEHLP_LINE64 line) +static BOOL symt_get_func_line_next(HANDLE hProcess, struct internal_line_t* intl, void* key, DWORD64 addr) { + struct module_pair pair; struct line_info* li; + struct line_info* srcli; + + if (key == NULL) return FALSE; + pair.pcs = process_find_by_handle(hProcess); + if (!pair.pcs) return FALSE; + pair.requested = module_find_by_addr(pair.pcs, addr, DMT_UNKNOWN); + if (!module_get_debug(&pair)) return FALSE;
- if (line->Key == 0) return FALSE; - li = line->Key; + /* search current source file */ + for (srcli = key; !srcli->is_source_file; srcli--); + + li = key; while (!li->is_last) { li++; if (!li->is_source_file) { - line->LineNumber = li->line_number; - line->Address = li->u.pc_offset; - line->Key = li; - return TRUE; + intl->line_number = li->line_number; + intl->address = li->u.pc_offset; + intl->key = li; + return internal_line_set_nameA(pair.pcs, intl, (char*)source_get(pair.effective, srcli->u.source_file), FALSE); } - line->FileName = (char*)source_get(module, li->u.source_file); + srcli = li; } + SetLastError(ERROR_NO_MORE_ITEMS); /* FIXME */ return FALSE; }
@@ -1888,19 +1899,14 @@ static BOOL symt_get_func_line_next(const struct module* module, PIMAGEHLP_LINE6 */ BOOL WINAPI SymGetLineNext64(HANDLE hProcess, PIMAGEHLP_LINE64 Line) { - struct module_pair pair; + struct internal_line_t intl;
TRACE("(%p %p)\n", hProcess, Line);
if (Line->SizeOfStruct < sizeof(*Line)) return FALSE; - pair.pcs = process_find_by_handle(hProcess); - if (!pair.pcs) return FALSE; - pair.requested = module_find_by_addr(pair.pcs, Line->Address, DMT_UNKNOWN); - if (!module_get_debug(&pair)) return FALSE; - - if (symt_get_func_line_next(pair.effective, Line)) return TRUE; - SetLastError(ERROR_NO_MORE_ITEMS); /* FIXME */ - return FALSE; + init_internal_line(&intl, FALSE); + if (!symt_get_func_line_next(hProcess, &intl, Line->Key, Line->Address)) return FALSE; + return internal_line_copy_toA64(&intl, Line); }
/****************************************************************** @@ -1909,13 +1915,30 @@ BOOL WINAPI SymGetLineNext64(HANDLE hProcess, PIMAGEHLP_LINE64 Line) */ BOOL WINAPI SymGetLineNext(HANDLE hProcess, PIMAGEHLP_LINE Line) { - IMAGEHLP_LINE64 line64; + struct internal_line_t intl;
- line64.SizeOfStruct = sizeof(line64); - copy_line_64_from_32(&line64, Line); - if (!SymGetLineNext64(hProcess, &line64)) return FALSE; - copy_line_32_from_64(Line, &line64); - return TRUE; + TRACE("(%p %p)\n", hProcess, Line); + + if (Line->SizeOfStruct < sizeof(*Line)) return FALSE; + init_internal_line(&intl, FALSE); + if (!symt_get_func_line_next(hProcess, &intl, Line->Key, Line->Address)) return FALSE; + return internal_line_copy_toA32(&intl, Line); +} + +/****************************************************************** + * SymGetLineNextW64 (DBGHELP.@) + * + */ +BOOL WINAPI SymGetLineNextW64(HANDLE hProcess, PIMAGEHLP_LINEW64 Line) +{ + struct internal_line_t intl; + + TRACE("(%p %p)\n", hProcess, Line); + + if (Line->SizeOfStruct < sizeof(*Line)) return FALSE; + init_internal_line(&intl, TRUE); + if (!symt_get_func_line_next(hProcess, &intl, Line->Key, Line->Address)) return FALSE; + return internal_line_copy_toW64(&intl, Line); }
/***********************************************************************