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
43dffcd0
Commit
43dffcd0
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: Now storing module information in Unicode form.
parent
6efc0619
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
67 additions
and
42 deletions
+67
-42
dbghelp_private.h
dlls/dbghelp/dbghelp_private.h
+21
-8
elf_module.c
dlls/dbghelp/elf_module.c
+25
-17
module.c
dlls/dbghelp/module.c
+0
-0
msc.c
dlls/dbghelp/msc.c
+3
-1
pe_module.c
dlls/dbghelp/pe_module.c
+16
-14
source.c
dlls/dbghelp/source.c
+1
-1
symbol.c
dlls/dbghelp/symbol.c
+1
-1
No files found.
dlls/dbghelp/dbghelp_private.h
View file @
43dffcd0
...
...
@@ -4,7 +4,7 @@
* Copyright (C) 1995, Alexandre Julliard
* Copyright (C) 1996, Eric Youngdale.
* Copyright (C) 1999-2000, Ulrich Weigand.
* Copyright (C) 2004, Eric Pouech.
* Copyright (C) 2004
-2007
, Eric Pouech.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -28,6 +28,8 @@
#include "dbghelp.h"
#include "objbase.h"
#include "oaidl.h"
#include "winnls.h"
#include "wine/unicode.h"
#include "cvconst.h"
...
...
@@ -310,7 +312,7 @@ struct process;
struct
module
{
IMAGEHLP_MODULE
64
module
;
IMAGEHLP_MODULE
W64
module
;
/* ANSI copy of module.ModuleName for efficiency */
char
module_name
[
MAX_PATH
];
struct
module
*
next
;
...
...
@@ -428,19 +430,30 @@ extern int elf_is_in_thunk_area(unsigned long addr, const struct elf_th
extern
DWORD
WINAPI
addr_to_linear
(
HANDLE
hProcess
,
HANDLE
hThread
,
ADDRESS
*
addr
);
/* module.c */
extern
const
WCHAR
S_ElfW
[];
extern
const
WCHAR
S_WineLoaderW
[];
extern
struct
module
*
module_find_by_addr
(
const
struct
process
*
pcs
,
unsigned
long
addr
,
enum
module_type
type
);
extern
struct
module
*
module_find_by_name
(
const
struct
process
*
pcs
,
const
char
*
name
,
enum
module_type
type
);
module_find_by_name
(
const
struct
process
*
pcs
,
const
WCHAR
*
name
,
enum
module_type
type
);
extern
struct
module
*
module_find_by_nameA
(
const
struct
process
*
pcs
,
const
char
*
name
,
enum
module_type
type
);
extern
BOOL
module_get_debug
(
struct
module_pair
*
);
extern
struct
module
*
module_new
(
struct
process
*
pcs
,
const
char
*
name
,
module_new
(
struct
process
*
pcs
,
const
WCHAR
*
name
,
enum
module_type
type
,
BOOL
virtual
,
unsigned
long
addr
,
unsigned
long
size
,
unsigned
long
stamp
,
unsigned
long
checksum
);
extern
struct
module
*
module_newA
(
struct
process
*
pcs
,
const
char
*
name
,
enum
module_type
type
,
BOOL
virtual
,
unsigned
long
addr
,
unsigned
long
size
,
unsigned
long
stamp
,
unsigned
long
checksum
);
extern
struct
module
*
module_get_container
(
const
struct
process
*
pcs
,
const
struct
module
*
inner
);
extern
struct
module
*
...
...
@@ -449,12 +462,12 @@ extern struct module*
extern
enum
module_type
module_get_type_by_name
(
const
char
*
name
);
extern
void
module_reset_debug_info
(
struct
module
*
module
);
extern
BOOL
module_remove
(
struct
process
*
pcs
,
extern
BOOL
module_remove
(
struct
process
*
pcs
,
struct
module
*
module
);
extern
void
module_set_module
(
struct
module
*
module
,
const
char
*
name
);
extern
void
module_set_module
(
struct
module
*
module
,
const
WCHAR
*
name
);
/* msc.c */
extern
BOOL
pe_load_debug_directory
(
const
struct
process
*
pcs
,
extern
BOOL
pe_load_debug_directory
(
const
struct
process
*
pcs
,
struct
module
*
module
,
const
BYTE
*
mapping
,
const
IMAGE_SECTION_HEADER
*
sectp
,
DWORD
nsect
,
...
...
dlls/dbghelp/elf_module.c
View file @
43dffcd0
...
...
@@ -2,7 +2,7 @@
* File elf.c - processing of ELF files
*
* Copyright (C) 1996, Eric Youngdale.
* 1999-200
4
Eric Pouech
* 1999-200
7
Eric Pouech
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -802,21 +802,23 @@ static BOOL elf_load_debug_info_from_map(struct module* module,
* is the global debug file directory, and execdir has been turned
* into a relative path)." (from GDB manual)
*/
static
char
*
elf_locate_debug_link
(
const
char
*
filename
,
const
char
*
loaded_file
,
static
char
*
elf_locate_debug_link
(
const
char
*
filename
,
const
WCHAR
*
loaded_file
,
struct
elf_file_map
*
fmap_link
)
{
static
const
char
globalDebugDir
[]
=
"/usr/lib/debug/"
;
const
size_t
globalDebugDirLen
=
strlen
(
globalDebugDir
);
size_t
loaded_file_len
;
char
*
p
;
char
*
slash
;
loaded_file_len
=
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
loaded_file
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
p
=
HeapAlloc
(
GetProcessHeap
(),
0
,
globalDebugDirLen
+
strlen
(
loaded_file
)
+
1
+
6
+
1
+
strlen
(
filename
)
+
1
);
globalDebugDirLen
+
loaded_file_len
+
6
+
1
+
strlen
(
filename
)
+
1
);
if
(
!
p
)
return
FALSE
;
/* we prebuild the string with "execdir" */
strcpy
(
p
,
loaded_file
);
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
loaded_file
,
-
1
,
p
,
loaded_file_len
,
NULL
,
NULL
);
slash
=
strrchr
(
p
,
'/'
);
if
(
slash
==
NULL
)
slash
=
p
;
else
slash
++
;
...
...
@@ -879,7 +881,9 @@ static BOOL elf_debuglink_parse (struct module* module,
ret
=
elf_load_debug_info_from_map
(
module
,
&
fmap_link
,
pool
,
ht_symtab
);
if
(
ret
)
strcpy
(
module
->
module
.
LoadedPdbName
,
link_file
);
MultiByteToWideChar
(
CP_ACP
,
0
,
link_file
,
-
1
,
module
->
module
.
LoadedPdbName
,
sizeof
(
module
->
module
.
LoadedPdbName
));
else
WARN
(
"Couldn't load debug information from %s
\n
"
,
link_file
);
elf_unmap_file
(
&
fmap_link
);
...
...
@@ -928,7 +932,7 @@ static BOOL elf_load_debug_info_from_map(struct module* module,
if
(
fmap
->
with_crc
&&
(
fmap
->
crc
!=
calc_crc32
(
fmap
)))
{
ERR
(
"Bad CRC for module %s (got %08x while expecting %08lx)
\n
"
,
module
->
module
.
LoadedImageName
,
calc_crc32
(
fmap
),
fmap
->
crc
);
debugstr_w
(
module
->
module
.
LoadedImageName
)
,
calc_crc32
(
fmap
),
fmap
->
crc
);
/* we don't tolerate mis-matched files */
return
FALSE
;
}
...
...
@@ -1062,14 +1066,14 @@ static BOOL elf_load_debug_info_from_map(struct module* module,
lret
=
elf_debuglink_parse
(
module
,
pool
,
ht_symtab
,
dbg_link
);
if
(
!
lret
)
WARN
(
"Couldn't load linked debug file for %s
\n
"
,
module
->
module
.
ModuleName
);
debugstr_w
(
module
->
module
.
ModuleName
)
);
ret
=
ret
||
lret
;
}
elf_unmap_section
(
fmap
,
debuglink_sect
);
}
}
if
(
strstr
(
module
->
module
.
ModuleName
,
"<elf>"
)
||
!
strcmp
(
module
->
module
.
ModuleName
,
"<wine-loader>"
))
if
(
strstr
W
(
module
->
module
.
ModuleName
,
S_ElfW
)
||
!
strcmp
W
(
module
->
module
.
ModuleName
,
S_WineLoaderW
))
{
/* add the thunks for native libraries */
if
(
!
(
dbghelp_options
&
SYMOPT_PUBLICS_ONLY
))
...
...
@@ -1095,7 +1099,7 @@ BOOL elf_load_debug_info(struct module* module, struct elf_file_map* fmap)
if
(
module
->
type
!=
DMT_ELF
||
!
module
->
elf_info
)
{
ERR
(
"Bad elf module '%s'
\n
"
,
module
->
module
.
LoadedImageName
);
ERR
(
"Bad elf module '%s'
\n
"
,
debugstr_w
(
module
->
module
.
LoadedImageName
)
);
return
FALSE
;
}
...
...
@@ -1104,8 +1108,12 @@ BOOL elf_load_debug_info(struct module* module, struct elf_file_map* fmap)
if
(
!
fmap
)
{
char
LoadedImageName
[
MAX_PATH
];
fmap
=
&
my_fmap
;
ret
=
elf_map_file
(
module
->
module
.
LoadedImageName
,
fmap
);
WideCharToMultiByte
(
CP_ACP
,
0
,
module
->
module
.
LoadedImageName
,
-
1
,
LoadedImageName
,
MAX_PATH
,
NULL
,
NULL
);
ret
=
elf_map_file
(
LoadedImageName
,
fmap
);
}
if
(
ret
)
ret
=
elf_load_debug_info_from_map
(
module
,
fmap
,
&
pool
,
&
ht_symtab
);
...
...
@@ -1201,12 +1209,12 @@ static BOOL elf_load_file(struct process* pcs, const char* filename,
if
(
elf_info
->
flags
&
ELF_INFO_MODULE
)
{
struct
elf_module_info
*
elf_module_info
=
struct
elf_module_info
*
elf_module_info
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
elf_module_info
));
if
(
!
elf_module_info
)
goto
leave
;
elf_info
->
module
=
module_new
(
pcs
,
filename
,
DMT_ELF
,
FALSE
,
(
load_offset
)
?
load_offset
:
fmap
.
elf_start
,
fmap
.
elf_size
,
0
,
calc_crc32
(
&
fmap
));
elf_info
->
module
=
module_new
A
(
pcs
,
filename
,
DMT_ELF
,
FALSE
,
(
load_offset
)
?
load_offset
:
fmap
.
elf_start
,
fmap
.
elf_size
,
0
,
calc_crc32
(
&
fmap
));
if
(
!
elf_info
->
module
)
{
HeapFree
(
GetProcessHeap
(),
0
,
elf_module_info
);
...
...
@@ -1313,7 +1321,7 @@ static BOOL elf_search_and_load_file(struct process* pcs, const char* filename,
struct
module
*
module
;
if
(
filename
==
NULL
||
*
filename
==
'\0'
)
return
FALSE
;
if
((
module
=
module_find_by_name
(
pcs
,
filename
,
DMT_ELF
)))
if
((
module
=
module_find_by_name
A
(
pcs
,
filename
,
DMT_ELF
)))
{
elf_info
->
module
=
module
;
module
->
elf_info
->
elf_mark
=
1
;
...
...
@@ -1469,7 +1477,7 @@ BOOL elf_read_wine_loader_dbg_info(struct process* pcs)
elf_info
.
flags
=
ELF_INFO_DEBUG_HEADER
|
ELF_INFO_MODULE
;
if
(
!
elf_search_loader
(
pcs
,
&
elf_info
))
return
FALSE
;
elf_info
.
module
->
elf_info
->
elf_loader
=
1
;
strcpy
(
elf_info
.
module
->
module
.
ModuleName
,
"<wine-loader>"
);
module_set_module
(
elf_info
.
module
,
S_WineLoaderW
);
return
(
pcs
->
dbg_hdr_addr
=
elf_info
.
dbg_hdr_addr
)
!=
0
;
}
...
...
dlls/dbghelp/module.c
View file @
43dffcd0
This diff is collapsed.
Click to expand it.
dlls/dbghelp/msc.c
View file @
43dffcd0
...
...
@@ -2248,7 +2248,9 @@ static BOOL pdb_process_file(const struct process* pcs,
else
msc_dbg
->
module
->
module
.
PdbSig70
=
pdb_lookup
->
u
.
ds
.
guid
;
msc_dbg
->
module
->
module
.
PdbAge
=
pdb_lookup
->
age
;
strcpy
(
msc_dbg
->
module
->
module
.
LoadedPdbName
,
pdb_lookup
->
filename
);
MultiByteToWideChar
(
CP_ACP
,
0
,
pdb_lookup
->
filename
,
-
1
,
msc_dbg
->
module
->
module
.
LoadedPdbName
,
sizeof
(
msc_dbg
->
module
->
module
.
LoadedPdbName
)
/
sizeof
(
WCHAR
));
/* FIXME: we could have a finer grain here */
msc_dbg
->
module
->
module
.
LineNumbers
=
TRUE
;
msc_dbg
->
module
->
module
.
GlobalSymbols
=
TRUE
;
...
...
dlls/dbghelp/pe_module.c
View file @
43dffcd0
...
...
@@ -3,7 +3,7 @@
*
* Copyright (C) 1996, Eric Youngdale.
* Copyright (C) 1999-2000, Ulrich Weigand.
* Copyright (C) 2004
,
Eric Pouech.
* Copyright (C) 2004
-2007,
Eric Pouech.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -289,10 +289,10 @@ BOOL pe_load_debug_info(const struct process* pcs, struct module* module)
void
*
mapping
;
IMAGE_NT_HEADERS
*
nth
;
hFile
=
CreateFile
A
(
module
->
module
.
LoadedImageName
,
GENERIC_READ
,
FILE_SHARE_READ
,
hFile
=
CreateFile
W
(
module
->
module
.
LoadedImageName
,
GENERIC_READ
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
hFile
==
INVALID_HANDLE_VALUE
)
return
ret
;
if
((
hMap
=
CreateFileMapping
A
(
hFile
,
NULL
,
PAGE_READONLY
,
0
,
0
,
NULL
))
!=
0
)
if
((
hMap
=
CreateFileMapping
W
(
hFile
,
NULL
,
PAGE_READONLY
,
0
,
0
,
NULL
))
!=
0
)
{
if
((
mapping
=
MapViewOfFile
(
hMap
,
FILE_MAP_READ
,
0
,
0
,
0
))
!=
NULL
)
{
...
...
@@ -354,8 +354,8 @@ struct module* pe_load_module(struct process* pcs, const char* name,
else
if
(
name
)
strcpy
(
loaded_name
,
name
);
else
if
(
dbghelp_options
&
SYMOPT_DEFERRED_LOADS
)
FIXME
(
"Trouble ahead (no module name passed in deferred mode)
\n
"
);
if
(
!
(
module
=
module_find_by_name
(
pcs
,
loaded_name
,
DMT_PE
))
&&
(
hMap
=
CreateFileMapping
A
(
hFile
,
NULL
,
PAGE_READONLY
,
0
,
0
,
NULL
))
!=
NULL
)
if
(
!
(
module
=
module_find_by_name
A
(
pcs
,
loaded_name
,
DMT_PE
))
&&
(
hMap
=
CreateFileMapping
W
(
hFile
,
NULL
,
PAGE_READONLY
,
0
,
0
,
NULL
))
!=
NULL
)
{
if
((
mapping
=
MapViewOfFile
(
hMap
,
FILE_MAP_READ
,
0
,
0
,
0
))
!=
NULL
)
{
...
...
@@ -365,10 +365,10 @@ struct module* pe_load_module(struct process* pcs, const char* name,
{
if
(
!
base
)
base
=
nth
->
OptionalHeader
.
ImageBase
;
if
(
!
size
)
size
=
nth
->
OptionalHeader
.
SizeOfImage
;
module
=
module_new
(
pcs
,
loaded_name
,
DMT_PE
,
FALSE
,
base
,
size
,
nth
->
FileHeader
.
TimeDateStamp
,
nth
->
OptionalHeader
.
CheckSum
);
module
=
module_new
A
(
pcs
,
loaded_name
,
DMT_PE
,
FALSE
,
base
,
size
,
nth
->
FileHeader
.
TimeDateStamp
,
nth
->
OptionalHeader
.
CheckSum
);
if
(
module
)
{
if
(
dbghelp_options
&
SYMOPT_DEFERRED_LOADS
)
...
...
@@ -411,7 +411,7 @@ struct module* pe_load_module_from_pcs(struct process* pcs, const char* name,
struct
module
*
module
;
const
char
*
ptr
;
if
((
module
=
module_find_by_name
(
pcs
,
name
,
DMT_PE
)))
return
module
;
if
((
module
=
module_find_by_name
A
(
pcs
,
name
,
DMT_PE
)))
return
module
;
if
(
mod_name
)
ptr
=
mod_name
;
else
{
...
...
@@ -424,7 +424,7 @@ struct module* pe_load_module_from_pcs(struct process* pcs, const char* name,
}
}
}
if
(
ptr
&&
(
module
=
module_find_by_name
(
pcs
,
ptr
,
DMT_PE
)))
return
module
;
if
(
ptr
&&
(
module
=
module_find_by_name
A
(
pcs
,
ptr
,
DMT_PE
)))
return
module
;
if
(
base
)
{
if
(
pcs
->
dbg_hdr_addr
)
...
...
@@ -434,11 +434,13 @@ struct module* pe_load_module_from_pcs(struct process* pcs, const char* name,
if
(
pe_load_nt_header
(
pcs
->
handle
,
base
,
&
nth
))
{
if
(
!
size
)
size
=
nth
.
OptionalHeader
.
SizeOfImage
;
module
=
module_new
(
pcs
,
name
,
DMT_PE
,
FALSE
,
base
,
size
,
nth
.
FileHeader
.
TimeDateStamp
,
nth
.
OptionalHeader
.
CheckSum
);
module
=
module_newA
(
pcs
,
name
,
DMT_PE
,
FALSE
,
base
,
size
,
nth
.
FileHeader
.
TimeDateStamp
,
nth
.
OptionalHeader
.
CheckSum
);
}
}
else
if
(
size
)
module
=
module_new
(
pcs
,
name
,
DMT_PE
,
FALSE
,
base
,
size
,
0
/* FIXME */
,
0
/* FIXME */
);
module
=
module_newA
(
pcs
,
name
,
DMT_PE
,
FALSE
,
base
,
size
,
0
/* FIXME */
,
0
/* FIXME */
);
}
return
module
;
}
dlls/dbghelp/source.c
View file @
43dffcd0
...
...
@@ -133,7 +133,7 @@ BOOL WINAPI SymEnumSourceFiles(HANDLE hProcess, ULONG64 ModBase, PCSTR Mask,
{
if
(
Mask
[
0
]
==
'!'
)
{
pair
.
requested
=
module_find_by_name
(
pair
.
pcs
,
Mask
+
1
,
DMT_UNKNOWN
);
pair
.
requested
=
module_find_by_name
A
(
pair
.
pcs
,
Mask
+
1
,
DMT_UNKNOWN
);
if
(
!
module_get_debug
(
&
pair
))
return
FALSE
;
}
else
...
...
dlls/dbghelp/symbol.c
View file @
43dffcd0
...
...
@@ -1174,7 +1174,7 @@ BOOL WINAPI SymFromName(HANDLE hProcess, PCSTR Name, PSYMBOL_INFO Symbol)
assert
(
name
-
Name
<
sizeof
(
tmp
));
memcpy
(
tmp
,
Name
,
name
-
Name
);
tmp
[
name
-
Name
]
=
'\0'
;
module
=
module_find_by_name
(
pcs
,
tmp
,
DMT_UNKNOWN
);
module
=
module_find_by_name
A
(
pcs
,
tmp
,
DMT_UNKNOWN
);
return
find_name
(
pcs
,
module
,
name
+
1
,
Symbol
);
}
for
(
module
=
pcs
->
lmodules
;
module
;
module
=
module
->
next
)
...
...
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