This serie allow to load alternate debug info from user's debuginfo cache.
This series (as is) will not bring lots of value as: - no support for loading the missing debug info files (they should have been been loaded beforehand) - most of these files are in Dwarf5 format, that we don't support yet.
From: Eric Pouech eric.pouech@gmail.com
Signed-off-by: Eric Pouech eric.pouech@gmail.com --- dlls/dbghelp/path.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/dlls/dbghelp/path.c b/dlls/dbghelp/path.c index 2320c9da5c3..d23a4b5733e 100644 --- a/dlls/dbghelp/path.c +++ b/dlls/dbghelp/path.c @@ -741,17 +741,14 @@ BOOL search_dll_path(const struct process *process, const WCHAR *name, BOOL (*ma
if ((env = process_getenv(process, L"WINEBUILDDIR"))) { - const WCHAR dllsW[] = { '\','d','l','l','s','\' }; - const WCHAR programsW[] = { '\','p','r','o','g','r','a','m','s','\' }; - len = lstrlenW(env); - if (!(buf = heap_alloc((len + ARRAY_SIZE(programsW) + machine_dir_len + + if (!(buf = heap_alloc((len + wcslen(L"\programs\") + machine_dir_len + 2 * lstrlenW(name) + 1) * sizeof(WCHAR)))) return FALSE; wcscpy(buf, env); end = buf + len;
- memcpy(end, dllsW, sizeof(dllsW)); - lstrcpyW(end + ARRAY_SIZE(dllsW), name); + wcscpy(end, L"\dlls\"); + wcscat(end, name); if ((p = wcsrchr(end, '.')) && !lstrcmpW(p, L".so")) *p = 0; if ((p = wcsrchr(end, '.')) && !lstrcmpW(p, L".dll")) *p = 0; p = end + lstrlenW(end); @@ -764,9 +761,9 @@ BOOL search_dll_path(const struct process *process, const WCHAR *name, BOOL (*ma lstrcpyW(p, name); if (try_match_file(buf, match, param)) goto found;
- memcpy(end, programsW, sizeof(programsW)); - end += ARRAY_SIZE(programsW); - lstrcpyW(end, name); + wcscpy(end, L"\programs\"); + end += wcslen(end); + wcscpy(end, name); if ((p = wcsrchr(end, '.')) && !lstrcmpW(p, L".so")) *p = 0; if ((p = wcsrchr(end, '.')) && !lstrcmpW(p, L".exe")) *p = 0; p = end + lstrlenW(end);
From: Eric Pouech eric.pouech@gmail.com
Signed-off-by: Eric Pouech eric.pouech@gmail.com --- dlls/dbghelp/module.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c index 4840a44f5de..27ed915389a 100644 --- a/dlls/dbghelp/module.c +++ b/dlls/dbghelp/module.c @@ -745,6 +745,7 @@ struct image_file_map* image_load_debugaltlink(struct image_file_map* fmap, stru static BOOL image_locate_build_id_target(struct image_file_map* fmap, const BYTE* id, unsigned idlen) { struct image_file_map* fmap_link = NULL; + DWORD sz; WCHAR* p; WCHAR* z;
@@ -764,7 +765,7 @@ static BOOL image_locate_build_id_target(struct image_file_map* fmap, const BYTE z = append_hex(z, id + 1, id + idlen); } } - memcpy(z, L".debug", sizeof(L".debug")); + wcscpy(z, L".debug"); TRACE("checking %s\n", wine_dbgstr_w(p));
if (image_check_debug_link_gnu_id(p, fmap_link, id, idlen)) @@ -774,6 +775,27 @@ static BOOL image_locate_build_id_target(struct image_file_map* fmap, const BYTE return TRUE; }
+ sz = GetEnvironmentVariableW(L"WINEHOMEDIR", NULL, 0); + if (sz) + { + p = realloc(p, sz * sizeof(WCHAR) + + sizeof(L"\.cache\debuginfod_client\") + + idlen * 2 * sizeof(WCHAR) + sizeof(L"\debuginfo") + 500); + GetEnvironmentVariableW(L"WINEHOMEDIR", p, sz); + z = p + sz - 1; + wcscpy(z, L"\.cache\debuginfod_client\"); + z += wcslen(z); + z = append_hex(z, id, id + idlen); + wcscpy(z, L"\debuginfo"); + TRACE("checking %ls\n", p); + if (image_check_debug_link_gnu_id(p, fmap_link, id, idlen)) + { + free(p); + fmap->alternate = fmap_link; + return TRUE; + } + } + TRACE("not found\n"); free(p); HeapFree(GetProcessHeap(), 0, fmap_link);
From: Eric Pouech eric.pouech@gmail.com
(including debuginfo client cache)
Signed-off-by: Eric Pouech eric.pouech@gmail.com --- dlls/dbghelp/module.c | 146 ++++++++++++++++++++++-------------------- 1 file changed, 77 insertions(+), 69 deletions(-)
diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c index 27ed915389a..d590877497d 100644 --- a/dlls/dbghelp/module.c +++ b/dlls/dbghelp/module.c @@ -643,6 +643,71 @@ static WCHAR* append_hex(WCHAR* dst, const BYTE* id, const BYTE* end) return dst; }
+/****************************************************************** + * image_locate_build_id_target + * + * Try to find the .so file containing the debug info out of the build-id note information + */ +static BOOL image_locate_build_id_target(struct image_file_map* fmap, const BYTE* id, unsigned idlen) +{ + struct image_file_map* fmap_link = NULL; + DWORD sz; + WCHAR* p; + WCHAR* z; + + fmap_link = HeapAlloc(GetProcessHeap(), 0, sizeof(*fmap_link)); + if (!fmap_link) return FALSE; + + p = malloc(sizeof(L"/usr/lib/debug/.build-id/") + + (idlen * 2 + 1) * sizeof(WCHAR) + sizeof(L".debug")); + wcscpy(p, L"/usr/lib/debug/.build-id/"); + z = p + wcslen(p); + if (idlen) + { + z = append_hex(z, id, id + 1); + if (idlen > 1) + { + *z++ = L'/'; + z = append_hex(z, id + 1, id + idlen); + } + } + wcscpy(z, L".debug"); + TRACE("checking %s\n", wine_dbgstr_w(p)); + + if (image_check_debug_link_gnu_id(p, fmap_link, id, idlen)) + { + free(p); + fmap->alternate = fmap_link; + return TRUE; + } + + sz = GetEnvironmentVariableW(L"WINEHOMEDIR", NULL, 0); + if (sz) + { + p = realloc(p, sz * sizeof(WCHAR) + + sizeof(L"\.cache\debuginfod_client\") + + idlen * 2 * sizeof(WCHAR) + sizeof(L"\debuginfo") + 500); + GetEnvironmentVariableW(L"WINEHOMEDIR", p, sz); + z = p + sz - 1; + wcscpy(z, L"\.cache\debuginfod_client\"); + z += wcslen(z); + z = append_hex(z, id, id + idlen); + wcscpy(z, L"\debuginfo"); + TRACE("checking %ls\n", p); + if (image_check_debug_link_gnu_id(p, fmap_link, id, idlen)) + { + free(p); + fmap->alternate = fmap_link; + return TRUE; + } + } + + TRACE("not found\n"); + free(p); + HeapFree(GetProcessHeap(), 0, fmap_link); + return FALSE; +} + /****************************************************************** * image_load_debugaltlink * @@ -674,9 +739,12 @@ struct image_file_map* image_load_debugaltlink(struct image_file_map* fmap, stru unsigned sect_len; const BYTE* id; /* The content of the section is: - * + a \0 terminated string + * + a \0 terminated string (filename) * + followed by the build-id - * We try loading the dwz_alternate, either as absolute path, or relative to the embedded build-id + * We try loading the dwz_alternate: + * - from the filename: either as absolute path, or relative to the embedded build-id + * - from the build-id + * In both cases, checking that found .so file matches the requested build-id */ sect_len = image_get_map_size(&debugaltlink_sect); id = memchr(data, '\0', sect_len); @@ -726,8 +794,13 @@ struct image_file_map* image_load_debugaltlink(struct image_file_map* fmap, stru if (!ret) { HeapFree(GetProcessHeap(), 0, fmap_link); - WARN("Couldn't find a match for .gnu_debugaltlink section %s for %s\n", data, debugstr_w(module->modulename)); - fmap_link = NULL; + /* didn't work out with filename, try file lookup based on build-id */ + ret = image_locate_build_id_target(fmap, id, idlen); + if (!ret) + { + WARN("Couldn't find a match for .gnu_debugaltlink section %s for %s\n", data, debugstr_w(module->modulename)); + fmap_link = NULL; + } } } } @@ -737,71 +810,6 @@ struct image_file_map* image_load_debugaltlink(struct image_file_map* fmap, stru return fmap_link; }
-/****************************************************************** - * image_locate_build_id_target - * - * Try to find the .so file containing the debug info out of the build-id note information - */ -static BOOL image_locate_build_id_target(struct image_file_map* fmap, const BYTE* id, unsigned idlen) -{ - struct image_file_map* fmap_link = NULL; - DWORD sz; - WCHAR* p; - WCHAR* z; - - fmap_link = HeapAlloc(GetProcessHeap(), 0, sizeof(*fmap_link)); - if (!fmap_link) return FALSE; - - p = malloc(sizeof(L"/usr/lib/debug/.build-id/") + - (idlen * 2 + 1) * sizeof(WCHAR) + sizeof(L".debug")); - wcscpy(p, L"/usr/lib/debug/.build-id/"); - z = p + wcslen(p); - if (idlen) - { - z = append_hex(z, id, id + 1); - if (idlen > 1) - { - *z++ = L'/'; - z = append_hex(z, id + 1, id + idlen); - } - } - wcscpy(z, L".debug"); - TRACE("checking %s\n", wine_dbgstr_w(p)); - - if (image_check_debug_link_gnu_id(p, fmap_link, id, idlen)) - { - free(p); - fmap->alternate = fmap_link; - return TRUE; - } - - sz = GetEnvironmentVariableW(L"WINEHOMEDIR", NULL, 0); - if (sz) - { - p = realloc(p, sz * sizeof(WCHAR) + - sizeof(L"\.cache\debuginfod_client\") + - idlen * 2 * sizeof(WCHAR) + sizeof(L"\debuginfo") + 500); - GetEnvironmentVariableW(L"WINEHOMEDIR", p, sz); - z = p + sz - 1; - wcscpy(z, L"\.cache\debuginfod_client\"); - z += wcslen(z); - z = append_hex(z, id, id + idlen); - wcscpy(z, L"\debuginfo"); - TRACE("checking %ls\n", p); - if (image_check_debug_link_gnu_id(p, fmap_link, id, idlen)) - { - free(p); - fmap->alternate = fmap_link; - return TRUE; - } - } - - TRACE("not found\n"); - free(p); - HeapFree(GetProcessHeap(), 0, fmap_link); - return FALSE; -} - /****************************************************************** * image_check_alternate *
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=126565
Your paranoid android.
=== debian11 (build log) ===
error: patch failed: dlls/dbghelp/path.c:741 error: patch failed: dlls/dbghelp/module.c:745 error: patch failed: dlls/dbghelp/module.c:643 Task: Patch failed to apply