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
1afb6d3f
Commit
1afb6d3f
authored
Feb 01, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 01, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedbg: Use longer module names when printing module list.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d1641163
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
29 deletions
+40
-29
info.c
programs/winedbg/info.c
+40
-29
No files found.
programs/winedbg/info.c
View file @
1afb6d3f
...
...
@@ -147,50 +147,61 @@ static const char* get_symtype_str(const IMAGEHLP_MODULE64* mi)
struct
info_module
{
IMAGEHLP_MODULE64
*
mi
;
IMAGEHLP_MODULE64
mi
;
char
name
[
64
];
};
struct
info_modules
{
struct
info_module
*
modules
;
unsigned
num_alloc
;
unsigned
num_used
;
};
static
void
module_print_info
(
const
IMAGEHLP_MODULE64
*
mi
,
BOOL
is_embedded
)
static
void
module_print_info
(
const
struct
info_module
*
module
,
BOOL
is_embedded
)
{
dbg_printf
(
"%*.*s-%*.*s
\t
%-16s%s
\n
"
,
ADDRWIDTH
,
ADDRWIDTH
,
wine_dbgstr_longlong
(
m
i
->
BaseOfImage
),
ADDRWIDTH
,
ADDRWIDTH
,
wine_dbgstr_longlong
(
m
i
->
BaseOfImage
+
mi
->
ImageSize
),
is_embedded
?
"
\\
"
:
get_symtype_str
(
mi
),
mi
->
ModuleN
ame
);
ADDRWIDTH
,
ADDRWIDTH
,
wine_dbgstr_longlong
(
m
odule
->
mi
.
BaseOfImage
),
ADDRWIDTH
,
ADDRWIDTH
,
wine_dbgstr_longlong
(
m
odule
->
mi
.
BaseOfImage
+
module
->
mi
.
ImageSize
),
is_embedded
?
"
\\
"
:
get_symtype_str
(
&
module
->
mi
),
module
->
n
ame
);
}
static
int
module_compare
(
const
void
*
p1
,
const
void
*
p2
)
{
LONGLONG
val
=
((
const
IMAGEHLP_MODULE64
*
)
p1
)
->
BaseOfImage
-
((
const
IMAGEHLP_MODULE64
*
)
p2
)
->
BaseOfImage
;
struct
info_module
*
left
=
(
struct
info_module
*
)
p1
;
struct
info_module
*
right
=
(
struct
info_module
*
)
p2
;
LONGLONG
val
=
left
->
mi
.
BaseOfImage
-
right
->
mi
.
BaseOfImage
;
if
(
val
<
0
)
return
-
1
;
else
if
(
val
>
0
)
return
1
;
else
return
0
;
}
static
inline
BOOL
module_is_container
(
const
IMAGEHLP_MODULE64
*
wmod_cntnr
,
const
IMAGEHLP_MODULE64
*
wmod_child
)
static
inline
BOOL
module_is_container
(
const
struct
info_module
*
wmod_cntnr
,
const
struct
info_module
*
wmod_child
)
{
return
wmod_cntnr
->
BaseOfImage
<=
wmod_child
->
BaseOfImage
&&
wmod_cntnr
->
BaseOfImage
+
wmod_cntnr
->
ImageSize
>=
wmod_child
->
BaseOfImage
+
wmod_child
->
ImageSize
;
return
wmod_cntnr
->
mi
.
BaseOfImage
<=
wmod_child
->
mi
.
BaseOfImage
&&
wmod_cntnr
->
mi
.
BaseOfImage
+
wmod_cntnr
->
mi
.
ImageSize
>=
wmod_child
->
mi
.
BaseOfImage
+
wmod_child
->
mi
.
ImageSize
;
}
static
BOOL
CALLBACK
info_mod_cb
(
PCSTR
mod_name
,
DWORD64
base
,
PVOID
ctx
)
{
struct
info_module
*
im
=
ctx
;
struct
info_module
s
*
im
=
ctx
;
if
(
im
->
num_used
+
1
>
im
->
num_alloc
)
{
im
->
num_alloc
+=
16
;
im
->
m
i
=
dbg_heap_realloc
(
im
->
mi
,
im
->
num_alloc
*
sizeof
(
*
im
->
mi
));
im
->
m
odules
=
dbg_heap_realloc
(
im
->
modules
,
im
->
num_alloc
*
sizeof
(
*
im
->
modules
));
}
im
->
m
i
[
im
->
num_used
].
SizeOfStruct
=
sizeof
(
im
->
mi
[
im
->
num_used
]
);
if
(
SymGetModuleInfo64
(
dbg_curr_process
->
handle
,
base
,
&
im
->
m
i
[
im
->
num_used
]
))
im
->
m
odules
[
im
->
num_used
].
mi
.
SizeOfStruct
=
sizeof
(
im
->
modules
[
im
->
num_used
].
mi
);
if
(
SymGetModuleInfo64
(
dbg_curr_process
->
handle
,
base
,
&
im
->
m
odules
[
im
->
num_used
].
mi
))
{
const
int
dst_len
=
sizeof
(
im
->
modules
[
im
->
num_used
].
name
);
lstrcpynA
(
im
->
modules
[
im
->
num_used
].
name
,
mod_name
,
dst_len
-
1
);
im
->
modules
[
im
->
num_used
].
name
[
dst_len
-
1
]
=
0
;
im
->
num_used
++
;
}
}
return
TRUE
;
}
...
...
@@ -201,7 +212,7 @@ static BOOL CALLBACK info_mod_cb(PCSTR mod_name, DWORD64 base, PVOID ctx)
*/
void
info_win32_module
(
DWORD64
base
)
{
struct
info_module
im
;
struct
info_module
s
im
;
UINT
i
,
j
,
num_printed
=
0
;
DWORD
opt
;
...
...
@@ -211,7 +222,7 @@ void info_win32_module(DWORD64 base)
return
;
}
im
.
m
i
=
NULL
;
im
.
m
odules
=
NULL
;
im
.
num_alloc
=
im
.
num_used
=
0
;
/* this is a wine specific options to return also ELF modules in the
...
...
@@ -221,7 +232,7 @@ void info_win32_module(DWORD64 base)
SymEnumerateModules64
(
dbg_curr_process
->
handle
,
info_mod_cb
,
&
im
);
SymSetOptions
(
opt
);
qsort
(
im
.
m
i
,
im
.
num_used
,
sizeof
(
im
.
mi
[
0
]),
module_compare
);
qsort
(
im
.
m
odules
,
im
.
num_used
,
sizeof
(
im
.
modules
[
0
]),
module_compare
);
dbg_printf
(
"Module
\t
Address
\t\t\t
%sDebug info
\t
Name (%d modules)
\n
"
,
ADDRWIDTH
==
16
?
"
\t\t
"
:
""
,
im
.
num_used
);
...
...
@@ -229,19 +240,19 @@ void info_win32_module(DWORD64 base)
for
(
i
=
0
;
i
<
im
.
num_used
;
i
++
)
{
if
(
base
&&
(
base
<
im
.
m
i
[
i
].
BaseOfImage
||
base
>=
im
.
mi
[
i
].
BaseOfImage
+
im
.
mi
[
i
]
.
ImageSize
))
(
base
<
im
.
m
odules
[
i
].
mi
.
BaseOfImage
||
base
>=
im
.
modules
[
i
].
mi
.
BaseOfImage
+
im
.
modules
[
i
].
mi
.
ImageSize
))
continue
;
if
(
strstr
(
im
.
m
i
[
i
].
ModuleN
ame
,
"<elf>"
))
if
(
strstr
(
im
.
m
odules
[
i
].
n
ame
,
"<elf>"
))
{
dbg_printf
(
"ELF
\t
"
);
module_print_info
(
&
im
.
m
i
[
i
],
FALSE
);
module_print_info
(
&
im
.
m
odules
[
i
],
FALSE
);
/* print all modules embedded in this one */
for
(
j
=
0
;
j
<
im
.
num_used
;
j
++
)
{
if
(
!
strstr
(
im
.
m
i
[
j
].
ModuleName
,
"<elf>"
)
&&
module_is_container
(
&
im
.
mi
[
i
],
&
im
.
mi
[
j
]))
if
(
!
strstr
(
im
.
m
odules
[
j
].
name
,
"<elf>"
)
&&
module_is_container
(
&
im
.
modules
[
i
],
&
im
.
modules
[
j
]))
{
dbg_printf
(
"
\\
-PE
\t
"
);
module_print_info
(
&
im
.
m
i
[
j
],
TRUE
);
module_print_info
(
&
im
.
m
odules
[
j
],
TRUE
);
}
}
}
...
...
@@ -250,19 +261,19 @@ void info_win32_module(DWORD64 base)
/* check module is not embedded in another module */
for
(
j
=
0
;
j
<
im
.
num_used
;
j
++
)
{
if
(
strstr
(
im
.
m
i
[
j
].
ModuleName
,
"<elf>"
)
&&
module_is_container
(
&
im
.
mi
[
j
],
&
im
.
mi
[
i
]))
if
(
strstr
(
im
.
m
odules
[
j
].
name
,
"<elf>"
)
&&
module_is_container
(
&
im
.
modules
[
j
],
&
im
.
modules
[
i
]))
break
;
}
if
(
j
<
im
.
num_used
)
continue
;
if
(
strstr
(
im
.
m
i
[
i
].
ModuleName
,
".so"
)
||
strchr
(
im
.
mi
[
i
].
ModuleN
ame
,
'<'
))
if
(
strstr
(
im
.
m
odules
[
i
].
name
,
".so"
)
||
strchr
(
im
.
modules
[
i
].
n
ame
,
'<'
))
dbg_printf
(
"ELF
\t
"
);
else
dbg_printf
(
"PE
\t
"
);
module_print_info
(
&
im
.
m
i
[
i
],
FALSE
);
module_print_info
(
&
im
.
m
odules
[
i
],
FALSE
);
}
num_printed
++
;
}
HeapFree
(
GetProcessHeap
(),
0
,
im
.
m
i
);
HeapFree
(
GetProcessHeap
(),
0
,
im
.
m
odules
);
if
(
base
&&
!
num_printed
)
dbg_printf
(
"'0x%x%08x' is not a valid module address
\n
"
,
(
DWORD
)(
base
>>
32
),
(
DWORD
)
base
);
...
...
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