https://git.reactos.org/?p=reactos.git;a=commitdiff;h=329ea60f7c85663164f22…
commit 329ea60f7c85663164f22643bd56509314a04f8f
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Fri Sep 11 19:00:44 2020 +0200
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Wed Sep 16 10:35:56 2020 +0200
[WINESYNC] dbghelp: Factor out query_dsym.
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id c3c2cda9d2792f8c9c612b5bd6e9fd4d08cbb073 by Jacek Caban
<jacek(a)codeweavers.com>
---
dll/win32/dbghelp/macho_module.c | 75 +++++++++++++++++++++-------------------
sdk/tools/winesync/dbghelp.cfg | 2 +-
2 files changed, 41 insertions(+), 36 deletions(-)
diff --git a/dll/win32/dbghelp/macho_module.c b/dll/win32/dbghelp/macho_module.c
index 413a25c663d..6fad0e0be58 100644
--- a/dll/win32/dbghelp/macho_module.c
+++ b/dll/win32/dbghelp/macho_module.c
@@ -1241,6 +1241,44 @@ static BOOL try_dsym(struct process *pcs, const WCHAR* path, struct
macho_file_m
return FALSE;
}
+static const WCHAR dsym_subpath[] =
{'/','C','o','n','t','e','n','t','s',
+
'/','R','e','s','o','u','r','c','e','s',
+
'/','D','W','A','R','F','/',0};
+
+static WCHAR *query_dsym(const UINT8 *uuid, const WCHAR *filename)
+{
+ char uuid_string[UUID_STRING_LEN];
+ CFStringRef uuid_cfstring;
+ CFStringRef query_string;
+ MDQueryRef query = NULL;
+ WCHAR *path = NULL;
+
+ format_uuid(uuid, uuid_string);
+ uuid_cfstring = CFStringCreateWithCString(NULL, uuid_string,
kCFStringEncodingASCII);
+ query_string = CFStringCreateWithFormat(NULL, NULL,
CFSTR("com_apple_xcode_dsym_uuids == \"%@\""), uuid_cfstring);
+ CFRelease(uuid_cfstring);
+ query = MDQueryCreate(NULL, query_string, NULL, NULL);
+ CFRelease(query_string);
+ MDQuerySetMaxCount(query, 1);
+ if (MDQueryExecute(query, kMDQuerySynchronous) &&
MDQueryGetResultCount(query) >= 1)
+ {
+ MDItemRef item = (MDItemRef)MDQueryGetResultAtIndex(query, 0);
+ CFStringRef item_path = MDItemCopyAttribute(item, kMDItemPath);
+ if (item_path)
+ {
+ CFIndex item_path_len = CFStringGetLength(item_path);
+ size_t len = item_path_len + strlenW(dsym_subpath) + strlenW(filename) + 1;
+ path = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+ CFStringGetCharacters(item_path, CFRangeMake(0, item_path_len),
(UniChar*)path);
+ strcpyW(path + item_path_len, dsym_subpath);
+ strcatW(path, filename);
+ CFRelease(item_path);
+ }
+ }
+ CFRelease(query);
+ return path;
+}
+
/******************************************************************
* find_and_map_dsym
*
@@ -1255,16 +1293,11 @@ static BOOL try_dsym(struct process *pcs, const WCHAR* path,
struct macho_file_m
static void find_and_map_dsym(struct process *pcs, struct module* module)
{
static const WCHAR dot_dsym[] =
{'.','d','S','Y','M',0};
- static const WCHAR dsym_subpath[] =
{'/','C','o','n','t','e','n','t','s','/','R','e','s','o','u','r','c','e','s','/','D','W','A','R','F','/',0};
static const WCHAR dot_dwarf[] =
{'.','d','w','a','r','f',0};
struct macho_file_map* fmap =
&module->format_info[DFI_MACHO]->u.macho_info->file_map.u.macho;
const WCHAR* p;
size_t len;
WCHAR* path = NULL;
- char uuid_string[UUID_STRING_LEN];
- CFStringRef uuid_cfstring;
- CFStringRef query_string;
- MDQueryRef query = NULL;
/* Without a UUID, we can't verify that any debug info file we find corresponds
to this file. Better to have no debug info than incorrect debug info. */
@@ -1289,39 +1322,11 @@ static void find_and_map_dsym(struct process *pcs, struct module*
module)
if (try_dsym(pcs, path, fmap))
goto found;
- format_uuid(fmap->uuid->uuid, uuid_string);
- uuid_cfstring = CFStringCreateWithCString(NULL, uuid_string,
kCFStringEncodingASCII);
- query_string = CFStringCreateWithFormat(NULL, NULL,
CFSTR("com_apple_xcode_dsym_uuids == \"%@\""), uuid_cfstring);
- CFRelease(uuid_cfstring);
- query = MDQueryCreate(NULL, query_string, NULL, NULL);
- CFRelease(query_string);
- MDQuerySetMaxCount(query, 1);
- if (MDQueryExecute(query, kMDQuerySynchronous) &&
MDQueryGetResultCount(query) >= 1)
- {
- MDItemRef item = (MDItemRef)MDQueryGetResultAtIndex(query, 0);
- CFStringRef item_path = MDItemCopyAttribute(item, kMDItemPath);
- if (item_path)
- {
- CFIndex item_path_len = CFStringGetLength(item_path);
- if (item_path_len + strlenW(dsym_subpath) + strlenW(p) >= len)
- {
- HeapFree(GetProcessHeap(), 0, path);
- len = item_path_len + strlenW(dsym_subpath) + strlenW(p) + 1;
- path = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
- }
- CFStringGetCharacters(item_path, CFRangeMake(0, item_path_len),
(UniChar*)path);
- strcpyW(path + item_path_len, dsym_subpath);
- strcatW(path, p);
- CFRelease(item_path);
-
- if (try_dsym(pcs, path, fmap))
- goto found;
- }
- }
+ HeapFree(GetProcessHeap(), 0, path);
+ if ((path = query_dsym(fmap->uuid->uuid, p))) try_dsym(pcs, path, fmap);
found:
HeapFree(GetProcessHeap(), 0, path);
- if (query) CFRelease(query);
}
/******************************************************************
diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg
index 4018c66b2e1..a92fb76aa23 100644
--- a/sdk/tools/winesync/dbghelp.cfg
+++ b/sdk/tools/winesync/dbghelp.cfg
@@ -4,4 +4,4 @@ files:
include/dbghelp.h: sdk/include/psdk/dbghelp.h
include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h
tags:
- wine: 3047385437c7ef36996d0418ac378677f3e9d67c
+ wine: c3c2cda9d2792f8c9c612b5bd6e9fd4d08cbb073