Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
c3c2cda9
Commit
c3c2cda9
authored
Apr 03, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: Factor out query_dsym.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ce2257b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
35 deletions
+40
-35
macho_module.c
dlls/dbghelp/macho_module.c
+40
-35
No files found.
dlls/dbghelp/macho_module.c
View file @
c3c2cda9
...
...
@@ -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
);
}
/******************************************************************
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment