Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
cbb84fdb
Commit
cbb84fdb
authored
Oct 18, 2008
by
Eric Pouech
Committed by
Alexandre Julliard
Oct 20, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedbg: Added a command to allow loading mismatched modules.
parent
5c8ad491
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
58 additions
and
16 deletions
+58
-16
dbg.y
programs/winedbg/dbg.y
+2
-0
debugger.h
programs/winedbg/debugger.h
+2
-0
gdbproxy.c
programs/winedbg/gdbproxy.c
+4
-5
tgt_active.c
programs/winedbg/tgt_active.c
+4
-4
tgt_minidump.c
programs/winedbg/tgt_minidump.c
+6
-6
tgt_module.c
programs/winedbg/tgt_module.c
+15
-1
winedbg.c
programs/winedbg/winedbg.c
+25
-0
No files found.
programs/winedbg/dbg.y
View file @
cbb84fdb
...
...
@@ -209,6 +209,8 @@ set_command:
| tSET '-' tIDENTIFIER { info_wine_dbg_channel(FALSE, NULL, $3); }
| tSET tIDENTIFIER '+' tIDENTIFIER { info_wine_dbg_channel(TRUE, $2, $4); }
| tSET tIDENTIFIER '-' tIDENTIFIER { info_wine_dbg_channel(FALSE, $2, $4); }
| tSET '!' tIDENTIFIER '+' { dbg_set_option($3, TRUE); }
| tSET '!' tIDENTIFIER '-' { dbg_set_option($3, FALSE); }
;
x_command:
...
...
programs/winedbg/debugger.h
View file @
cbb84fdb
...
...
@@ -448,7 +448,9 @@ struct dbg_thread* dbg_add_thread(struct dbg_process* p, DWORD tid, HANDLE h, vo
extern
struct
dbg_thread
*
dbg_get_thread
(
struct
dbg_process
*
p
,
DWORD
tid
);
extern
void
dbg_del_thread
(
struct
dbg_thread
*
t
);
extern
BOOL
dbg_init
(
HANDLE
hProc
,
const
WCHAR
*
in
,
BOOL
invade
);
extern
BOOL
dbg_load_module
(
HANDLE
hProc
,
HANDLE
hFile
,
const
WCHAR
*
name
,
DWORD
base
,
DWORD
size
);
extern
BOOL
dbg_get_debuggee_info
(
HANDLE
hProcess
,
IMAGEHLP_MODULE
*
imh_mod
);
extern
void
dbg_set_option
(
const
char
*
,
BOOL
);
/* gdbproxy.c */
extern
int
gdb_main
(
int
argc
,
char
*
argv
[]);
...
...
programs/winedbg/gdbproxy.c
View file @
cbb84fdb
...
...
@@ -63,7 +63,6 @@
#include "windef.h"
#include "winbase.h"
#include "tlhelp32.h"
#include "wine/debug.h"
#define GDBPXY_TRC_LOWLEVEL 0x01
#define GDBPXY_TRC_PACKET 0x02
...
...
@@ -537,16 +536,16 @@ static void handle_debug_event(struct gdb_context* gdbctx, DEBUG_EVENT* de)
de
->
u
.
LoadDll
.
lpBaseOfDll
,
de
->
u
.
LoadDll
.
dwDebugInfoFileOffset
,
de
->
u
.
LoadDll
.
nDebugInfoSize
);
SymLoadModuleExW
(
gdbctx
->
process
->
handle
,
de
->
u
.
LoadDll
.
hFile
,
u
.
buffer
,
NULL
,
(
unsigned
long
)
de
->
u
.
LoadDll
.
lpBaseOfDll
,
0
,
NULL
,
0
);
dbg_load_module
(
gdbctx
->
process
->
handle
,
de
->
u
.
LoadDll
.
hFile
,
u
.
buffer
,
(
DWORD_PTR
)
de
->
u
.
LoadDll
.
lpBaseOfDll
,
0
);
break
;
case
UNLOAD_DLL_DEBUG_EVENT
:
if
(
gdbctx
->
trace
&
GDBPXY_TRC_WIN32_EVENT
)
fprintf
(
stderr
,
"%08x:%08x: unload DLL @%p
\n
"
,
de
->
dwProcessId
,
de
->
dwThreadId
,
de
->
u
.
UnloadDll
.
lpBaseOfDll
);
SymUnloadModule
(
gdbctx
->
process
->
handle
,
(
unsigned
long
)
de
->
u
.
UnloadDll
.
lpBaseOfDll
);
SymUnloadModule
(
gdbctx
->
process
->
handle
,
(
DWORD_PTR
)
de
->
u
.
UnloadDll
.
lpBaseOfDll
);
break
;
case
EXCEPTION_DEBUG_EVENT
:
...
...
programs/winedbg/tgt_active.c
View file @
cbb84fdb
...
...
@@ -519,8 +519,8 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de)
if
(
!
dbg_init
(
dbg_curr_process
->
handle
,
u
.
buffer
,
FALSE
))
dbg_printf
(
"Couldn't initiate DbgHelp
\n
"
);
if
(
!
SymLoadModuleExW
(
dbg_curr_process
->
handle
,
de
->
u
.
CreateProcessInfo
.
hFile
,
u
.
buffer
,
NULL
,
(
unsigned
long
)
de
->
u
.
CreateProcessInfo
.
lpBaseOfImage
,
0
,
NULL
,
0
))
if
(
!
dbg_load_module
(
dbg_curr_process
->
handle
,
de
->
u
.
CreateProcessInfo
.
hFile
,
u
.
buffer
,
(
DWORD_PTR
)
de
->
u
.
CreateProcessInfo
.
lpBaseOfImage
,
0
))
dbg_printf
(
"couldn't load main module (%u)
\n
"
,
GetLastError
());
WINE_TRACE
(
"%04x:%04x: create thread I @%p
\n
"
,
...
...
@@ -608,8 +608,8 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de)
wine_dbgstr_w
(
u
.
buffer
),
de
->
u
.
LoadDll
.
lpBaseOfDll
,
de
->
u
.
LoadDll
.
dwDebugInfoFileOffset
,
de
->
u
.
LoadDll
.
nDebugInfoSize
);
SymLoadModuleExW
(
dbg_curr_process
->
handle
,
de
->
u
.
LoadDll
.
hFile
,
u
.
buffer
,
NULL
,
(
unsigned
long
)
de
->
u
.
LoadDll
.
lpBaseOfDll
,
0
,
NULL
,
0
);
dbg_load_module
(
dbg_curr_process
->
handle
,
de
->
u
.
LoadDll
.
hFile
,
u
.
buffer
,
(
DWORD_PTR
)
de
->
u
.
LoadDll
.
lpBaseOfDll
,
0
);
break_set_xpoints
(
FALSE
);
break_check_delayed_bp
();
break_set_xpoints
(
TRUE
);
...
...
programs/winedbg/tgt_minidump.c
View file @
cbb84fdb
...
...
@@ -331,8 +331,8 @@ static enum dbg_start minidump_do_reload(struct tgt_process_minidump_data* data)
nameW
[
mds
->
Length
/
sizeof
(
WCHAR
)]
=
0
;
if
(
SymFindFileInPathW
(
hProc
,
NULL
,
nameW
,
(
void
*
)(
DWORD_PTR
)
mm
->
CheckSum
,
0
,
0
,
SSRVOPT_DWORD
,
buffer
,
validate_file
,
NULL
))
SymLoadModuleExW
(
hProc
,
NULL
,
buffer
,
NULL
,
get_addr64
(
mm
->
BaseOfImage
),
mm
->
SizeOfImage
,
NULL
,
0
);
dbg_load_module
(
hProc
,
NULL
,
buffer
,
get_addr64
(
mm
->
BaseOfImage
),
mm
->
SizeOfImage
);
else
SymLoadModuleExW
(
hProc
,
NULL
,
nameW
,
NULL
,
get_addr64
(
mm
->
BaseOfImage
),
mm
->
SizeOfImage
,
NULL
,
SLMFLAG_VIRTUAL
);
...
...
@@ -350,11 +350,11 @@ static enum dbg_start minidump_do_reload(struct tgt_process_minidump_data* data)
nameW
[
mds
->
Length
/
sizeof
(
WCHAR
)]
=
0
;
if
(
SymFindFileInPathW
(
hProc
,
NULL
,
nameW
,
(
void
*
)(
DWORD_PTR
)
mm
->
TimeDateStamp
,
mm
->
SizeOfImage
,
0
,
SSRVOPT_DWORD
,
buffer
,
validate_file
,
NULL
))
SymLoadModuleExW
(
hProc
,
NULL
,
buffer
,
NULL
,
get_addr64
(
mm
->
BaseOfImage
),
mm
->
SizeOfImage
,
NULL
,
0
);
dbg_load_module
(
hProc
,
NULL
,
buffer
,
get_addr64
(
mm
->
BaseOfImage
),
mm
->
SizeOfImage
);
else
if
(
is_pe_module_embedded
(
data
,
mm
))
SymLoadModuleExW
(
hProc
,
NULL
,
nameW
,
NULL
,
get_addr64
(
mm
->
BaseOfImage
),
mm
->
SizeOfImage
,
NULL
,
0
);
dbg_load_module
(
hProc
,
NULL
,
nameW
,
get_addr64
(
mm
->
BaseOfImage
),
mm
->
SizeOfImage
);
else
SymLoadModuleExW
(
hProc
,
NULL
,
nameW
,
NULL
,
get_addr64
(
mm
->
BaseOfImage
),
mm
->
SizeOfImage
,
NULL
,
SLMFLAG_VIRTUAL
);
...
...
programs/winedbg/tgt_module.c
View file @
cbb84fdb
...
...
@@ -52,16 +52,30 @@ enum dbg_start tgt_module_load(const char* name, BOOL keep)
DWORD
opts
=
SymGetOptions
();
HANDLE
hDummy
=
(
HANDLE
)
0x87654321
;
enum
dbg_start
ret
=
start_ok
;
WCHAR
*
nameW
;
unsigned
len
;
SymSetOptions
((
opts
&
~
(
SYMOPT_UNDNAME
|
SYMOPT_DEFERRED_LOADS
))
|
SYMOPT_LOAD_LINES
|
SYMOPT_AUTO_PUBLICS
|
0x40000000
);
if
(
!
dbg_init
(
hDummy
,
NULL
,
FALSE
))
return
start_error_init
;
if
(
!
SymLoadModule
(
hDummy
,
NULL
,
name
,
NULL
,
0
,
0
))
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
NULL
,
0
);
nameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
if
(
!
nameW
)
{
ret
=
start_error_init
;
keep
=
FALSE
;
}
else
{
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
nameW
,
len
);
if
(
!
dbg_load_module
(
hDummy
,
NULL
,
nameW
,
0
,
0
))
{
ret
=
start_error_init
;
keep
=
FALSE
;
}
HeapFree
(
GetProcessHeap
(),
0
,
nameW
);
}
if
(
keep
)
{
...
...
programs/winedbg/winedbg.c
View file @
cbb84fdb
...
...
@@ -435,6 +435,19 @@ BOOL dbg_get_debuggee_info(HANDLE hProcess, IMAGEHLP_MODULE* imh_mod)
return
imh_mod
->
BaseOfImage
!=
0
;
}
BOOL
dbg_load_module
(
HANDLE
hProc
,
HANDLE
hFile
,
const
WCHAR
*
name
,
DWORD
base
,
DWORD
size
)
{
BOOL
ret
=
SymLoadModuleExW
(
hProc
,
NULL
,
name
,
NULL
,
base
,
size
,
NULL
,
0
);
if
(
ret
)
{
IMAGEHLP_MODULEW64
ihm
;
ihm
.
SizeOfStruct
=
sizeof
(
ihm
);
if
(
SymGetModuleInfoW64
(
hProc
,
base
,
&
ihm
)
&&
(
ihm
.
PdbUnmatched
||
ihm
.
DbgUnmatched
))
dbg_printf
(
"Loaded unmatched debug information for %s
\n
"
,
wine_dbgstr_w
(
name
));
}
return
ret
;
}
struct
dbg_thread
*
dbg_get_thread
(
struct
dbg_process
*
p
,
DWORD
tid
)
{
struct
dbg_thread
*
t
;
...
...
@@ -488,6 +501,18 @@ void dbg_del_thread(struct dbg_thread* t)
HeapFree
(
GetProcessHeap
(),
0
,
t
);
}
void
dbg_set_option
(
const
char
*
option
,
BOOL
enable
)
{
if
(
!
strcmp
(
option
,
"module"
))
{
DWORD
opt
=
SymGetOptions
();
if
(
enable
)
opt
|=
SYMOPT_LOAD_ANYTHING
;
else
opt
&=
~
SYMOPT_LOAD_ANYTHING
;
SymSetOptions
(
opt
);
}
else
dbg_printf
(
"Unknown option '%s'
\n
"
,
option
);
}
BOOL
dbg_interrupt_debuggee
(
void
)
{
if
(
!
dbg_process_list
)
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