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
9f176619
Commit
9f176619
authored
Nov 22, 2021
by
Eric Pouech
Committed by
Alexandre Julliard
Nov 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: Simplify code for searching alternate debug info files.
Signed-off-by:
Eric Pouech
<
eric.pouech@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
789512be
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
41 deletions
+32
-41
module.c
dlls/dbghelp/module.c
+32
-41
No files found.
dlls/dbghelp/module.c
View file @
9f176619
...
...
@@ -634,6 +634,17 @@ found:
return
TRUE
;
}
static
WCHAR
*
append_hex
(
WCHAR
*
dst
,
const
BYTE
*
id
,
const
BYTE
*
end
)
{
while
(
id
<
end
)
{
*
dst
++
=
"0123456789abcdef"
[
*
id
>>
4
];
*
dst
++
=
"0123456789abcdef"
[
*
id
&
0x0F
];
id
++
;
}
return
dst
;
}
/******************************************************************
* image_load_debugaltlink
*
...
...
@@ -683,16 +694,14 @@ struct image_file_map* image_load_debugaltlink(struct image_file_map* fmap, stru
if
(
dst
)
{
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
data
,
-
1
,
dst
,
filename_len
);
ret
=
image_check_debug_link_gnu_id
(
dst
,
fmap_link
,
id
,
data
+
sect_len
-
(
const
char
*
)
id
);
ret
=
image_check_debug_link_gnu_id
(
dst
,
fmap_link
,
id
,
idlen
);
HeapFree
(
GetProcessHeap
(),
0
,
dst
);
}
/* Trying relative path to build-id directory */
if
(
!
ret
)
{
static
const
WCHAR
globalDebugDirW
[]
=
{
'/'
,
'u'
,
's'
,
'r'
,
'/'
,
'l'
,
'i'
,
'b'
,
'/'
,
'd'
,
'e'
,
'b'
,
'u'
,
'g'
,
'/'
,
'.'
,
'b'
,
'u'
,
'i'
,
'l'
,
'd'
,
'-'
,
'i'
,
'd'
,
'/'
};
dst
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
globalDebugDirW
)
+
(
3
+
filename_len
+
idlen
*
2
)
*
sizeof
(
WCHAR
));
sizeof
(
L"/usr/lib/debug/.build-id/"
)
+
(
3
+
filename_len
+
idlen
*
2
)
*
sizeof
(
WCHAR
));
if
(
dst
)
{
WCHAR
*
p
;
...
...
@@ -702,21 +711,16 @@ struct image_file_map* image_load_debugaltlink(struct image_file_map* fmap, stru
* where the alternate file is...
* so try both
*/
p
=
memcpy
(
dst
,
globalDebugDirW
,
sizeof
(
globalDebugDirW
));
p
+=
ARRAY_SIZE
(
globalDebugDirW
);
p
=
memcpy
(
dst
,
L"/usr/lib/debug/.build-id/"
,
sizeof
(
L"/usr/lib/debug/.build-id/"
));
p
+=
wcslen
(
dst
);
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
data
,
-
1
,
p
,
filename_len
);
ret
=
image_check_debug_link_gnu_id
(
dst
,
fmap_link
,
id
,
data
+
sect_len
-
(
const
char
*
)
id
);
ret
=
image_check_debug_link_gnu_id
(
dst
,
fmap_link
,
id
,
idlen
);
if
(
!
ret
)
{
p
=
dst
+
ARRAY_SIZE
(
globalDebugDirW
);
if
((
const
char
*
)
id
<
data
+
sect_len
)
{
*
p
++
=
"0123456789abcdef"
[
*
id
>>
4
];
*
p
++
=
"0123456789abcdef"
[
*
id
&
0x0F
];
}
p
=
append_hex
(
p
,
id
,
id
+
idlen
);
*
p
++
=
'/'
;
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
data
,
-
1
,
p
,
filename_len
);
ret
=
image_check_debug_link_gnu_id
(
dst
,
fmap_link
,
id
,
data
+
sect_len
-
(
const
char
*
)
id
);
ret
=
image_check_debug_link_gnu_id
(
dst
,
fmap_link
,
id
,
idlen
);
}
HeapFree
(
GetProcessHeap
(),
0
,
dst
);
}
...
...
@@ -742,51 +746,38 @@ 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
)
{
static
const
WCHAR
globalDebugDirW
[]
=
{
'/'
,
'u'
,
's'
,
'r'
,
'/'
,
'l'
,
'i'
,
'b'
,
'/'
,
'd'
,
'e'
,
'b'
,
'u'
,
'g'
,
'/'
};
static
const
WCHAR
buildidW
[]
=
{
'.'
,
'b'
,
'u'
,
'i'
,
'l'
,
'd'
,
'-'
,
'i'
,
'd'
,
'/'
};
struct
image_file_map
*
fmap_link
=
NULL
;
WCHAR
*
p
;
WCHAR
*
z
;
const
BYTE
*
idend
=
id
+
idlen
;
fmap_link
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
fmap_link
));
if
(
!
fmap_link
)
return
FALSE
;
p
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
globalDebugDirW
)
+
sizeof
(
buildidW
)
+
(
idlen
*
2
+
1
)
*
sizeof
(
WCHAR
)
+
sizeof
(
L".debug"
));
z
=
p
;
memcpy
(
z
,
globalDebugDirW
,
sizeof
(
globalDebugDirW
));
z
+=
ARRAY_SIZE
(
globalDebugDirW
);
memcpy
(
z
,
buildidW
,
sizeof
(
buildidW
));
z
+=
ARRAY_SIZE
(
buildidW
);
if
(
id
<
idend
)
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
++
=
"0123456789abcdef"
[
*
id
>>
4
];
*
z
++
=
"0123456789abcdef"
[
*
id
&
0x0F
];
id
++
;
}
if
(
id
<
idend
)
*
z
++
=
'/'
;
while
(
id
<
idend
)
{
*
z
++
=
"0123456789abcdef"
[
*
id
>>
4
];
*
z
++
=
"0123456789abcdef"
[
*
id
&
0x0F
];
id
++
;
z
=
append_hex
(
z
,
id
,
id
+
1
);
if
(
idlen
>
1
)
{
*
z
++
=
L'/'
;
z
=
append_hex
(
z
,
id
+
1
,
id
+
idlen
);
}
}
memcpy
(
z
,
L".debug"
,
sizeof
(
L".debug"
));
TRACE
(
"checking %s
\n
"
,
wine_dbgstr_w
(
p
));
if
(
image_check_debug_link_gnu_id
(
p
,
fmap_link
,
id
end
-
idlen
,
idlen
))
if
(
image_check_debug_link_gnu_id
(
p
,
fmap_link
,
id
,
idlen
))
{
HeapFree
(
GetProcessHeap
(),
0
,
p
);
free
(
p
);
fmap
->
alternate
=
fmap_link
;
return
TRUE
;
}
TRACE
(
"not found
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
p
);
free
(
p
);
HeapFree
(
GetProcessHeap
(),
0
,
fmap_link
);
return
FALSE
;
}
...
...
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