mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-19 17:06:04 -07:00
dbghelp: Extend search for buildid in system directories.
Search for files <buildid> and <buildid>.debug Fedora (at least) now put the debug info here (instead of /usr/lib/debug/.build). So search both directories. Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
parent
67c1c3c255
commit
3e0eda8986
1 changed files with 53 additions and 42 deletions
|
@ -664,69 +664,80 @@ static WCHAR* append_hex(WCHAR* dst, const BYTE* id, const BYTE* end)
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************
|
static BOOL image_locate_build_id_target_in_dir(struct image_file_map *fmap_link, const BYTE* id, unsigned idlen, const WCHAR *from)
|
||||||
* image_locate_build_id_target
|
|
||||||
*
|
|
||||||
* Try to find the .so file containing the debug info out of the build-id note information
|
|
||||||
*/
|
|
||||||
static struct image_file_map* image_locate_build_id_target(const BYTE* id, unsigned idlen)
|
|
||||||
{
|
{
|
||||||
struct image_file_map* fmap_link = NULL;
|
size_t from_len = wcslen(from);
|
||||||
DWORD sz;
|
BOOL found = FALSE;
|
||||||
WCHAR* p;
|
WCHAR *p, *z;
|
||||||
WCHAR* z;
|
|
||||||
|
|
||||||
fmap_link = HeapAlloc(GetProcessHeap(), 0, sizeof(*fmap_link));
|
if ((p = malloc((from_len + idlen * 2 + 1) * sizeof(WCHAR) + sizeof(L".debug"))))
|
||||||
if (!fmap_link) return NULL;
|
|
||||||
|
|
||||||
p = malloc(sizeof(L"/usr/lib/debug/.build-id/") +
|
|
||||||
(idlen * 2 + 1) * sizeof(WCHAR) + sizeof(L".debug"));
|
|
||||||
if (!p) goto fail;
|
|
||||||
wcscpy(p, L"/usr/lib/debug/.build-id/");
|
|
||||||
z = p + wcslen(p);
|
|
||||||
if (idlen)
|
|
||||||
{
|
{
|
||||||
|
memcpy(p, from, from_len * sizeof(WCHAR));
|
||||||
|
z = p + from_len;
|
||||||
z = append_hex(z, id, id + 1);
|
z = append_hex(z, id, id + 1);
|
||||||
if (idlen > 1)
|
if (idlen > 1)
|
||||||
{
|
{
|
||||||
*z++ = L'/';
|
*z++ = L'/';
|
||||||
z = append_hex(z, id + 1, id + idlen);
|
z = append_hex(z, id + 1, id + idlen);
|
||||||
}
|
}
|
||||||
}
|
*z = L'\0';
|
||||||
wcscpy(z, L".debug");
|
TRACE("checking %s\n", debugstr_w(p));
|
||||||
TRACE("checking %s\n", debugstr_w(p));
|
found = image_check_debug_link_gnu_id(p, fmap_link, id, idlen);
|
||||||
|
if (!found)
|
||||||
if (image_check_debug_link_gnu_id(p, fmap_link, id, idlen))
|
{
|
||||||
{
|
wcscpy(z, L".debug");
|
||||||
|
TRACE("checking %s\n", debugstr_w(p));
|
||||||
|
found = image_check_debug_link_gnu_id(p, fmap_link, id, idlen);
|
||||||
|
}
|
||||||
free(p);
|
free(p);
|
||||||
return fmap_link;
|
|
||||||
}
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************
|
||||||
|
* image_locate_build_id_target
|
||||||
|
*
|
||||||
|
* Try to find an image file containing the debug info out of the build-id
|
||||||
|
* note information.
|
||||||
|
*/
|
||||||
|
static struct image_file_map* image_locate_build_id_target(const BYTE* id, unsigned idlen)
|
||||||
|
{
|
||||||
|
struct image_file_map* fmap_link;
|
||||||
|
DWORD sz;
|
||||||
|
|
||||||
|
if (!idlen) return NULL;
|
||||||
|
|
||||||
|
if (!(fmap_link = HeapAlloc(GetProcessHeap(), 0, sizeof(*fmap_link))))
|
||||||
|
return NULL;
|
||||||
|
if (image_locate_build_id_target_in_dir(fmap_link, id, idlen, L"/usr/lib/debug/.build-id/"))
|
||||||
|
return fmap_link;
|
||||||
|
if (image_locate_build_id_target_in_dir(fmap_link, id, idlen, L"/usr/lib/.build-id/"))
|
||||||
|
return fmap_link;
|
||||||
|
|
||||||
sz = GetEnvironmentVariableW(L"WINEHOMEDIR", NULL, 0);
|
sz = GetEnvironmentVariableW(L"WINEHOMEDIR", NULL, 0);
|
||||||
if (sz)
|
if (sz)
|
||||||
{
|
{
|
||||||
z = realloc(p, sz * sizeof(WCHAR) +
|
WCHAR *p, *z;
|
||||||
sizeof(L"\\.cache\\debuginfod_client\\") +
|
p = malloc(sz * sizeof(WCHAR) +
|
||||||
idlen * 2 * sizeof(WCHAR) + sizeof(L"\\debuginfo") + 500);
|
sizeof(L"\\.cache\\debuginfod_client\\") +
|
||||||
if (!z) goto fail;
|
idlen * 2 * sizeof(WCHAR) + sizeof(L"\\debuginfo") + 500);
|
||||||
p = z;
|
if (p && GetEnvironmentVariableW(L"WINEHOMEDIR", p, sz) == sz - 1)
|
||||||
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))
|
|
||||||
{
|
{
|
||||||
|
BOOL found;
|
||||||
|
|
||||||
|
wcscpy(p + sz - 1, L"\\.cache\\debuginfod_client\\");
|
||||||
|
z = p + wcslen(p);
|
||||||
|
z = append_hex(z, id, id + idlen);
|
||||||
|
wcscpy(z, L"\\debuginfo");
|
||||||
|
TRACE("checking %ls\n", p);
|
||||||
|
found = image_check_debug_link_gnu_id(p, fmap_link, id, idlen);
|
||||||
free(p);
|
free(p);
|
||||||
return fmap_link;
|
if (found) return fmap_link;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("not found\n");
|
TRACE("not found\n");
|
||||||
fail:
|
|
||||||
free(p);
|
|
||||||
HeapFree(GetProcessHeap(), 0, fmap_link);
|
HeapFree(GetProcessHeap(), 0, fmap_link);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue