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
6efc0619
Commit
6efc0619
authored
Feb 21, 2007
by
Eric Pouech
Committed by
Alexandre Julliard
Feb 22, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbghelp: .gnu_link support: rewrote helper functions for better later unicodification.
parent
c75fb89a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
29 deletions
+40
-29
elf_module.c
dlls/dbghelp/elf_module.c
+40
-29
No files found.
dlls/dbghelp/elf_module.c
View file @
6efc0619
...
@@ -802,26 +802,49 @@ static BOOL elf_load_debug_info_from_map(struct module* module,
...
@@ -802,26 +802,49 @@ static BOOL elf_load_debug_info_from_map(struct module* module,
* is the global debug file directory, and execdir has been turned
* is the global debug file directory, and execdir has been turned
* into a relative path)." (from GDB manual)
* into a relative path)." (from GDB manual)
*/
*/
static
char
*
elf_locate_debug_link
(
const
char
*
filename
,
const
char
*
moduleDir
)
static
char
*
elf_locate_debug_link
(
const
char
*
filename
,
const
char
*
loaded_file
,
struct
elf_file_map
*
fmap_link
)
{
{
static
const
char
globalDebugDir
[]
=
"/usr/lib/debug"
;
static
const
char
globalDebugDir
[]
=
"/usr/lib/debug/"
;
const
size_t
moduleDirLen
=
strlen
(
moduleDir
);
const
size_t
globalDebugDirLen
=
strlen
(
globalDebugDir
);
const
size_t
globalDebugDirLen
=
strlen
(
globalDebugDir
);
char
*
p
;
struct
stat
statbuf
;
char
*
slash
;
p
=
HeapAlloc
(
GetProcessHeap
(),
0
,
globalDebugDirLen
+
strlen
(
loaded_file
)
+
1
+
6
+
1
+
strlen
(
filename
)
+
1
);
if
(
!
p
)
return
FALSE
;
/* we prebuild the string with "execdir" */
strcpy
(
p
,
loaded_file
);
slash
=
strrchr
(
p
,
'/'
);
if
(
slash
==
NULL
)
slash
=
p
;
else
slash
++
;
/* testing execdir/filename */
strcpy
(
slash
,
filename
);
if
(
elf_map_file
(
p
,
fmap_link
))
goto
found
;
char
*
p
=
HeapAlloc
(
GetProcessHeap
(),
0
,
/* testing execdir/.debug/filename */
moduleDirLen
+
1
+
max
(
6
,
globalDebugDirLen
)
+
1
+
strlen
(
filename
)
+
1
);
sprintf
(
slash
,
".debug/%s"
,
filename
);
if
(
elf_map_file
(
p
,
fmap_link
))
goto
found
;
sprintf
(
p
,
"%s/%s"
,
moduleDir
,
filename
);
/* testing globaldebugdir/execdir/filename */
if
(
stat
(
p
,
&
statbuf
)
!=
-
1
&&
!
S_ISDIR
(
statbuf
.
st_mode
))
return
p
;
memmove
(
p
+
globalDebugDirLen
,
p
,
slash
-
p
);
memcpy
(
p
,
globalDebugDir
,
globalDebugDirLen
);
slash
+=
globalDebugDirLen
;
strcpy
(
slash
,
filename
);
if
(
elf_map_file
(
p
,
fmap_link
))
goto
found
;
s
printf
(
p
,
"%s/.debug/%s"
,
moduleDir
,
filename
);
s
trcpy
(
p
,
filename
);
if
(
stat
(
p
,
&
statbuf
)
!=
-
1
&&
!
S_ISDIR
(
statbuf
.
st_mode
))
return
p
;
if
(
elf_map_file
(
p
,
fmap_link
))
goto
found
;
sprintf
(
p
,
"%s/%s/%s"
,
globalDebugDir
,
moduleDir
,
filename
);
HeapFree
(
GetProcessHeap
(),
0
,
p
);
if
(
stat
(
p
,
&
statbuf
)
!=
-
1
&&
!
S_ISDIR
(
statbuf
.
st_mode
))
return
p
;
strcpy
(
p
,
filename
);
WARN
(
"Couldn't locate or map %s
\n
"
,
filename
);
return
NULL
;
found:
TRACE
(
"Located debug information file %s at %s
\n
"
,
filename
,
p
);
return
p
;
return
p
;
}
}
...
@@ -845,19 +868,11 @@ static BOOL elf_debuglink_parse (struct module* module,
...
@@ -845,19 +868,11 @@ static BOOL elf_debuglink_parse (struct module* module,
BOOL
ret
=
FALSE
;
BOOL
ret
=
FALSE
;
const
char
*
dbg_link
=
(
char
*
)
debuglink
;
const
char
*
dbg_link
=
(
char
*
)
debuglink
;
struct
elf_file_map
fmap_link
;
struct
elf_file_map
fmap_link
;
char
*
moduleDir
;
char
*
link_file
;
char
*
link_file
;
char
*
slash
;
moduleDir
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
module
->
module
.
LoadedImageName
)
+
1
);
link_file
=
elf_locate_debug_link
(
dbg_link
,
module
->
module
.
LoadedImageName
,
&
fmap_link
);
strcpy
(
moduleDir
,
module
->
module
.
LoadedImageName
);
slash
=
strrchr
(
moduleDir
,
'/'
);
if
(
slash
!=
0
)
*
slash
=
0
;
link_file
=
elf_locate_debug_link
(
dbg_link
,
moduleDir
);
if
(
link_file
)
TRACE
(
"Located debug information file %s at %s
\n
"
,
dbg_link
,
link_file
);
if
(
elf_map_file
(
link_file
,
&
fmap_link
))
{
{
fmap_link
.
crc
=
*
(
const
DWORD
*
)(
dbg_link
+
((
DWORD_PTR
)(
strlen
(
dbg_link
)
+
4
)
&
~
3
));
fmap_link
.
crc
=
*
(
const
DWORD
*
)(
dbg_link
+
((
DWORD_PTR
)(
strlen
(
dbg_link
)
+
4
)
&
~
3
));
fmap_link
.
with_crc
=
1
;
fmap_link
.
with_crc
=
1
;
...
@@ -868,12 +883,8 @@ static BOOL elf_debuglink_parse (struct module* module,
...
@@ -868,12 +883,8 @@ static BOOL elf_debuglink_parse (struct module* module,
else
else
WARN
(
"Couldn't load debug information from %s
\n
"
,
link_file
);
WARN
(
"Couldn't load debug information from %s
\n
"
,
link_file
);
elf_unmap_file
(
&
fmap_link
);
elf_unmap_file
(
&
fmap_link
);
HeapFree
(
GetProcessHeap
(),
0
,
link_file
);
}
}
else
WARN
(
"Couldn't map %s
\n
"
,
dbg_link
);
HeapFree
(
GetProcessHeap
(),
0
,
link_file
);
HeapFree
(
GetProcessHeap
(),
0
,
moduleDir
);
return
ret
;
return
ret
;
}
}
...
...
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