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
5caaba7e
Commit
5caaba7e
authored
Jun 13, 2018
by
Zebediah Figura
Committed by
Alexandre Julliard
Jun 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedbg: Implement debugging 32-bit processes on x86_64.
Signed-off-by:
Zebediah Figura
<
zfigura@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8c48c632
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
25 deletions
+22
-25
be_i386.c
programs/winedbg/be_i386.c
+12
-10
db_disasm.c
programs/winedbg/db_disasm.c
+2
-2
winedbg.c
programs/winedbg/winedbg.c
+8
-13
No files found.
programs/winedbg/be_i386.c
View file @
5caaba7e
...
...
@@ -21,7 +21,7 @@
#include "debugger.h"
#include "wine/debug.h"
#if
def __i386__
#if
defined(__i386__) || defined(__x86_64__)
WINE_DEFAULT_DEBUG_CHANNEL
(
winedbg
);
...
...
@@ -33,6 +33,7 @@ extern void be_i386_disasm_one_insn(ADDRESS64* addr, int display);
#define IS_VM86_MODE(ctx) (ctx->EFlags & V86_FLAG)
#ifndef __x86_64__
typedef
struct
DECLSPEC_ALIGN
(
16
)
_M128A
{
ULONGLONG
Low
;
LONGLONG
High
;
...
...
@@ -56,6 +57,7 @@ typedef struct _XMM_SAVE_AREA32 {
M128A
XmmRegisters
[
16
];
/* 0a0 */
BYTE
Reserved4
[
96
];
/* 1a0 */
}
XMM_SAVE_AREA32
,
*
PXMM_SAVE_AREA32
;
#endif
static
ADDRESS_MODE
get_selector_type
(
HANDLE
hThread
,
const
WOW64_CONTEXT
*
ctx
,
WORD
sel
)
{
...
...
@@ -77,18 +79,18 @@ static void* be_i386_linearize(HANDLE hThread, const ADDRESS64* addr)
switch
(
addr
->
Mode
)
{
case
AddrModeReal
:
return
(
void
*
)((
DWORD
)(
LOWORD
(
addr
->
Segment
)
<<
4
)
+
(
DWORD
)
addr
->
Offset
);
return
(
void
*
)((
DWORD
_PTR
)(
LOWORD
(
addr
->
Segment
)
<<
4
)
+
(
DWORD_PTR
)
addr
->
Offset
);
case
AddrMode1632
:
if
(
!
(
addr
->
Segment
&
4
)
||
((
addr
->
Segment
>>
3
)
<
17
))
return
(
void
*
)(
DWORD
)
addr
->
Offset
;
return
(
void
*
)(
DWORD
_PTR
)
addr
->
Offset
;
/* fall through */
case
AddrMode1616
:
if
(
!
dbg_curr_process
->
process_io
->
get_selector
(
hThread
,
addr
->
Segment
,
&
le
))
return
NULL
;
return
(
void
*
)((
le
.
HighWord
.
Bits
.
BaseHi
<<
24
)
+
(
le
.
HighWord
.
Bits
.
BaseMid
<<
16
)
+
le
.
BaseLow
+
(
DWORD
)
addr
->
Offset
);
(
DWORD
_PTR
)
addr
->
Offset
);
case
AddrModeFlat
:
return
(
void
*
)(
DWORD
)
addr
->
Offset
;
return
(
void
*
)(
DWORD
_PTR
)
addr
->
Offset
;
}
return
NULL
;
}
...
...
@@ -502,7 +504,7 @@ static BOOL be_i386_is_func_call(const void* insn, ADDRESS64* callee)
if
(
!
fetch_value
((
const
char
*
)
insn
+
1
,
operand_size
,
&
delta
))
return
FALSE
;
callee
->
Segment
=
dbg_context
.
x86
.
SegCs
;
callee
->
Offset
=
(
DWORD
)
insn
+
1
+
(
operand_size
/
8
)
+
delta
;
callee
->
Offset
=
(
DWORD
_PTR
)
insn
+
1
+
(
operand_size
/
8
)
+
delta
;
return
TRUE
;
case
0x9a
:
/* absolute far call */
...
...
@@ -589,11 +591,11 @@ static BOOL be_i386_is_func_call(const void* insn, ADDRESS64* callee)
}
if
(((
ch
>>
3
)
&
0x07
)
==
0x03
)
/* LCALL */
{
if
(
!
dbg_read_memory
((
const
char
*
)
dst
+
operand_size
,
&
segment
,
sizeof
(
segment
)))
if
(
!
dbg_read_memory
((
const
char
*
)
(
UINT_PTR
)
dst
+
operand_size
,
&
segment
,
sizeof
(
segment
)))
return
FALSE
;
}
else
segment
=
dbg_context
.
x86
.
SegCs
;
if
(
!
dbg_read_memory
((
const
char
*
)
dst
,
&
delta
,
sizeof
(
delta
)))
if
(
!
dbg_read_memory
((
const
char
*
)
(
UINT_PTR
)
dst
,
&
delta
,
sizeof
(
delta
)))
return
FALSE
;
callee
->
Mode
=
get_selector_type
(
dbg_curr_thread
->
handle
,
&
dbg_context
.
x86
,
segment
);
...
...
@@ -643,7 +645,7 @@ static BOOL be_i386_is_jump(const void* insn, ADDRESS64* jumpee)
if
(
!
fetch_value
((
const
char
*
)
insn
+
1
,
operand_size
,
&
delta
))
return
FALSE
;
jumpee
->
Segment
=
dbg_context
.
x86
.
SegCs
;
jumpee
->
Offset
=
(
DWORD
)
insn
+
1
+
(
operand_size
/
8
)
+
delta
;
jumpee
->
Offset
=
(
DWORD
_PTR
)
insn
+
1
+
(
operand_size
/
8
)
+
delta
;
return
TRUE
;
default:
WINE_FIXME
(
"unknown %x
\n
"
,
ch
);
return
FALSE
;
}
...
...
@@ -733,7 +735,7 @@ static BOOL be_i386_insert_Xpoint(HANDLE hProcess, const struct be_process_io* p
bits
=
DR7_RW_WRITE
;
hw_bp:
if
((
reg
=
be_i386_get_unused_DR
(
ctx
,
&
pr
))
==
-
1
)
return
FALSE
;
*
pr
=
(
DWORD
)
addr
;
*
pr
=
(
DWORD
_PTR
)
addr
;
if
(
type
!=
be_xpoint_watch_exec
)
switch
(
size
)
{
case
4
:
bits
|=
DR7_LEN_4
;
break
;
...
...
programs/winedbg/db_disasm.c
View file @
5caaba7e
...
...
@@ -64,7 +64,7 @@
#include "debugger.h"
#if
def __i386__
#if
defined(__i386__) || defined(__x86_64__)
/*
* Switch to disassemble 16-bit code.
...
...
@@ -1225,7 +1225,7 @@ static void db_print_address(const char *seg, int size, struct i_addr *addrp, in
void
*
a2
;
dbg_printf
(
"0x%x -> "
,
addrp
->
disp
);
if
(
!
dbg_read_memory
((
void
*
)
addrp
->
disp
,
&
a1
,
sizeof
(
a1
)))
{
if
(
!
dbg_read_memory
((
void
*
)
(
INT_PTR
)
addrp
->
disp
,
&
a1
,
sizeof
(
a1
)))
{
dbg_printf
(
"(invalid source)"
);
}
else
if
(
!
dbg_read_memory
(
a1
,
&
a2
,
sizeof
(
a2
)))
{
dbg_printf
(
"(invalid destination)"
);
...
...
programs/winedbg/winedbg.c
View file @
5caaba7e
...
...
@@ -284,6 +284,7 @@ extern struct backend_cpu be_i386;
#elif defined(__powerpc__)
extern
struct
backend_cpu
be_ppc
;
#elif defined(__x86_64__)
extern
struct
backend_cpu
be_i386
;
extern
struct
backend_cpu
be_x86_64
;
#elif defined(__arm__) && !defined(__ARMEB__)
extern
struct
backend_cpu
be_arm
;
...
...
@@ -296,21 +297,13 @@ extern struct backend_cpu be_arm64;
struct
dbg_process
*
dbg_add_process
(
const
struct
be_process_io
*
pio
,
DWORD
pid
,
HANDLE
h
)
{
struct
dbg_process
*
p
;
BOOL
wow64
;
if
((
p
=
dbg_get_process
(
pid
)))
{
if
(
p
->
handle
!=
0
)
{
WINE_ERR
(
"Process (%04x) is already defined
\n
"
,
pid
);
}
else
{
p
->
handle
=
h
;
p
->
process_io
=
pio
;
p
->
imageName
=
NULL
;
}
return
p
;
}
if
(
!
h
)
h
=
OpenProcess
(
PROCESS_ALL_ACCESS
,
FALSE
,
pid
);
if
(
!
(
p
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
dbg_process
))))
return
NULL
;
p
->
handle
=
h
;
...
...
@@ -333,12 +326,14 @@ struct dbg_process* dbg_add_process(const struct be_process_io* pio, DWORD pid,
list_add_head
(
&
dbg_process_list
,
&
p
->
entry
);
IsWow64Process
(
h
,
&
wow64
);
#ifdef __i386__
p
->
be_cpu
=
&
be_i386
;
#elif defined(__powerpc__)
p
->
be_cpu
=
&
be_ppc
;
#elif defined(__x86_64__)
p
->
be_cpu
=
&
be_x86_64
;
p
->
be_cpu
=
wow64
?
&
be_i386
:
&
be_x86_64
;
#elif defined(__arm__) && !defined(__ARMEB__)
p
->
be_cpu
=
&
be_arm
;
#elif defined(__aarch64__) && !defined(__AARCH64EB__)
...
...
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