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
f23cb66d
Commit
f23cb66d
authored
Nov 14, 2013
by
Frédéric Delanoy
Committed by
Alexandre Julliard
Nov 14, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedbg: Use BOOL type where appropriate.
parent
baf4757c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
174 additions
and
174 deletions
+174
-174
be_arm.c
programs/winedbg/be_arm.c
+29
-29
be_arm64.c
programs/winedbg/be_arm64.c
+29
-29
be_cpu.h
programs/winedbg/be_cpu.h
+16
-16
be_i386.c
programs/winedbg/be_i386.c
+35
-35
be_ppc.c
programs/winedbg/be_ppc.c
+30
-30
be_x86_64.c
programs/winedbg/be_x86_64.c
+33
-33
memory.c
programs/winedbg/memory.c
+2
-2
No files found.
programs/winedbg/be_arm.c
View file @
f23cb66d
...
@@ -1658,8 +1658,8 @@ void be_arm_disasm_one_insn(ADDRESS64 *addr, int display)
...
@@ -1658,8 +1658,8 @@ void be_arm_disasm_one_insn(ADDRESS64 *addr, int display)
}
}
}
}
static
unsigned
be_arm_get_addr
(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
static
BOOL
be_arm_get_addr
(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
enum
be_cpu_addr
bca
,
ADDRESS64
*
addr
)
enum
be_cpu_addr
bca
,
ADDRESS64
*
addr
)
{
{
switch
(
bca
)
switch
(
bca
)
{
{
...
@@ -1673,7 +1673,7 @@ static unsigned be_arm_get_addr(HANDLE hThread, const CONTEXT* ctx,
...
@@ -1673,7 +1673,7 @@ static unsigned be_arm_get_addr(HANDLE hThread, const CONTEXT* ctx,
return
FALSE
;
return
FALSE
;
}
}
static
unsigned
be_arm_get_register_info
(
int
regno
,
enum
be_cpu_addr
*
kind
)
static
BOOL
be_arm_get_register_info
(
int
regno
,
enum
be_cpu_addr
*
kind
)
{
{
switch
(
regno
)
switch
(
regno
)
{
{
...
@@ -1755,72 +1755,72 @@ static struct dbg_internal_var be_arm_ctx[] =
...
@@ -1755,72 +1755,72 @@ static struct dbg_internal_var be_arm_ctx[] =
{
0
,
NULL
,
0
,
dbg_itype_none
}
{
0
,
NULL
,
0
,
dbg_itype_none
}
};
};
static
unsigned
be_arm_is_step_over_insn
(
const
void
*
insn
)
static
BOOL
be_arm_is_step_over_insn
(
const
void
*
insn
)
{
{
dbg_printf
(
"be_arm_is_step_over_insn: not done
\n
"
);
dbg_printf
(
"be_arm_is_step_over_insn: not done
\n
"
);
return
FALSE
;
return
FALSE
;
}
}
static
unsigned
be_arm_is_function_return
(
const
void
*
insn
)
static
BOOL
be_arm_is_function_return
(
const
void
*
insn
)
{
{
dbg_printf
(
"be_arm_is_function_return: not done
\n
"
);
dbg_printf
(
"be_arm_is_function_return: not done
\n
"
);
return
FALSE
;
return
FALSE
;
}
}
static
unsigned
be_arm_is_break_insn
(
const
void
*
insn
)
static
BOOL
be_arm_is_break_insn
(
const
void
*
insn
)
{
{
dbg_printf
(
"be_arm_is_break_insn: not done
\n
"
);
dbg_printf
(
"be_arm_is_break_insn: not done
\n
"
);
return
FALSE
;
return
FALSE
;
}
}
static
unsigned
be_arm_is_func_call
(
const
void
*
insn
,
ADDRESS64
*
callee
)
static
BOOL
be_arm_is_func_call
(
const
void
*
insn
,
ADDRESS64
*
callee
)
{
{
return
FALSE
;
return
FALSE
;
}
}
static
unsigned
be_arm_is_jump
(
const
void
*
insn
,
ADDRESS64
*
jumpee
)
static
BOOL
be_arm_is_jump
(
const
void
*
insn
,
ADDRESS64
*
jumpee
)
{
{
return
FALSE
;
return
FALSE
;
}
}
static
unsigned
be_arm_insert_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
static
BOOL
be_arm_insert_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
void
*
addr
,
unsigned
long
*
val
,
unsigned
size
)
void
*
addr
,
unsigned
long
*
val
,
unsigned
size
)
{
{
SIZE_T
sz
;
SIZE_T
sz
;
switch
(
type
)
switch
(
type
)
{
{
case
be_xpoint_break
:
case
be_xpoint_break
:
if
(
!
size
)
return
0
;
if
(
!
size
)
return
FALSE
;
if
(
!
pio
->
read
(
hProcess
,
addr
,
val
,
4
,
&
sz
)
||
sz
!=
4
)
return
0
;
if
(
!
pio
->
read
(
hProcess
,
addr
,
val
,
4
,
&
sz
)
||
sz
!=
4
)
return
FALSE
;
default:
default:
dbg_printf
(
"Unknown/unsupported bp type %c
\n
"
,
type
);
dbg_printf
(
"Unknown/unsupported bp type %c
\n
"
,
type
);
return
0
;
return
FALSE
;
}
}
return
1
;
return
TRUE
;
}
}
static
unsigned
be_arm_remove_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
static
BOOL
be_arm_remove_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
void
*
addr
,
unsigned
long
val
,
unsigned
size
)
void
*
addr
,
unsigned
long
val
,
unsigned
size
)
{
{
SIZE_T
sz
;
SIZE_T
sz
;
switch
(
type
)
switch
(
type
)
{
{
case
be_xpoint_break
:
case
be_xpoint_break
:
if
(
!
size
)
return
0
;
if
(
!
size
)
return
FALSE
;
if
(
!
pio
->
write
(
hProcess
,
addr
,
&
val
,
4
,
&
sz
)
||
sz
==
4
)
return
0
;
if
(
!
pio
->
write
(
hProcess
,
addr
,
&
val
,
4
,
&
sz
)
||
sz
==
4
)
return
FALSE
;
break
;
break
;
default:
default:
dbg_printf
(
"Unknown/unsupported bp type %c
\n
"
,
type
);
dbg_printf
(
"Unknown/unsupported bp type %c
\n
"
,
type
);
return
0
;
return
FALSE
;
}
}
return
1
;
return
TRUE
;
}
}
static
unsigned
be_arm_is_watchpoint_set
(
const
CONTEXT
*
ctx
,
unsigned
idx
)
static
BOOL
be_arm_is_watchpoint_set
(
const
CONTEXT
*
ctx
,
unsigned
idx
)
{
{
dbg_printf
(
"be_arm_is_watchpoint_set: not done
\n
"
);
dbg_printf
(
"be_arm_is_watchpoint_set: not done
\n
"
);
return
FALSE
;
return
FALSE
;
...
@@ -1844,8 +1844,8 @@ static int be_arm_adjust_pc_for_break(CONTEXT* ctx, BOOL way)
...
@@ -1844,8 +1844,8 @@ static int be_arm_adjust_pc_for_break(CONTEXT* ctx, BOOL way)
return
step
;
return
step
;
}
}
static
int
be_arm_fetch_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
static
BOOL
be_arm_fetch_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
unsigned
is_signed
,
LONGLONG
*
ret
)
BOOL
is_signed
,
LONGLONG
*
ret
)
{
{
if
(
size
!=
1
&&
size
!=
2
&&
size
!=
4
&&
size
!=
8
)
return
FALSE
;
if
(
size
!=
1
&&
size
!=
2
&&
size
!=
4
&&
size
!=
8
)
return
FALSE
;
...
@@ -1864,8 +1864,8 @@ static int be_arm_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size,
...
@@ -1864,8 +1864,8 @@ static int be_arm_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size,
return
TRUE
;
return
TRUE
;
}
}
static
int
be_arm_fetch_float
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
static
BOOL
be_arm_fetch_float
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
long
double
*
ret
)
long
double
*
ret
)
{
{
char
tmp
[
sizeof
(
long
double
)];
char
tmp
[
sizeof
(
long
double
)];
...
@@ -1882,8 +1882,8 @@ static int be_arm_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
...
@@ -1882,8 +1882,8 @@ static int be_arm_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
return
TRUE
;
return
TRUE
;
}
}
static
int
be_arm_store_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
static
BOOL
be_arm_store_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
unsigned
is_signed
,
LONGLONG
val
)
BOOL
is_signed
,
LONGLONG
val
)
{
{
/* this is simple if we're on a little endian CPU */
/* this is simple if we're on a little endian CPU */
return
memory_write_value
(
lvalue
,
size
,
&
val
);
return
memory_write_value
(
lvalue
,
size
,
&
val
);
...
...
programs/winedbg/be_arm64.c
View file @
f23cb66d
...
@@ -22,8 +22,8 @@
...
@@ -22,8 +22,8 @@
#if defined(__aarch64__) && !defined(__AARCH64EB__)
#if defined(__aarch64__) && !defined(__AARCH64EB__)
static
unsigned
be_arm64_get_addr
(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
static
BOOL
be_arm64_get_addr
(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
enum
be_cpu_addr
bca
,
ADDRESS64
*
addr
)
enum
be_cpu_addr
bca
,
ADDRESS64
*
addr
)
{
{
switch
(
bca
)
switch
(
bca
)
{
{
...
@@ -38,7 +38,7 @@ static unsigned be_arm64_get_addr(HANDLE hThread, const CONTEXT* ctx,
...
@@ -38,7 +38,7 @@ static unsigned be_arm64_get_addr(HANDLE hThread, const CONTEXT* ctx,
return
FALSE
;
return
FALSE
;
}
}
static
unsigned
be_arm64_get_register_info
(
int
regno
,
enum
be_cpu_addr
*
kind
)
static
BOOL
be_arm64_get_register_info
(
int
regno
,
enum
be_cpu_addr
*
kind
)
{
{
switch
(
regno
)
switch
(
regno
)
{
{
...
@@ -142,72 +142,72 @@ static struct dbg_internal_var be_arm64_ctx[] =
...
@@ -142,72 +142,72 @@ static struct dbg_internal_var be_arm64_ctx[] =
{
0
,
NULL
,
0
,
dbg_itype_none
}
{
0
,
NULL
,
0
,
dbg_itype_none
}
};
};
static
unsigned
be_arm64_is_step_over_insn
(
const
void
*
insn
)
static
BOOL
be_arm64_is_step_over_insn
(
const
void
*
insn
)
{
{
dbg_printf
(
"be_arm64_is_step_over_insn: not done
\n
"
);
dbg_printf
(
"be_arm64_is_step_over_insn: not done
\n
"
);
return
FALSE
;
return
FALSE
;
}
}
static
unsigned
be_arm64_is_function_return
(
const
void
*
insn
)
static
BOOL
be_arm64_is_function_return
(
const
void
*
insn
)
{
{
dbg_printf
(
"be_arm64_is_function_return: not done
\n
"
);
dbg_printf
(
"be_arm64_is_function_return: not done
\n
"
);
return
FALSE
;
return
FALSE
;
}
}
static
unsigned
be_arm64_is_break_insn
(
const
void
*
insn
)
static
BOOL
be_arm64_is_break_insn
(
const
void
*
insn
)
{
{
dbg_printf
(
"be_arm64_is_break_insn: not done
\n
"
);
dbg_printf
(
"be_arm64_is_break_insn: not done
\n
"
);
return
FALSE
;
return
FALSE
;
}
}
static
unsigned
be_arm64_is_func_call
(
const
void
*
insn
,
ADDRESS64
*
callee
)
static
BOOL
be_arm64_is_func_call
(
const
void
*
insn
,
ADDRESS64
*
callee
)
{
{
return
FALSE
;
return
FALSE
;
}
}
static
unsigned
be_arm64_is_jump
(
const
void
*
insn
,
ADDRESS64
*
jumpee
)
static
BOOL
be_arm64_is_jump
(
const
void
*
insn
,
ADDRESS64
*
jumpee
)
{
{
return
FALSE
;
return
FALSE
;
}
}
static
unsigned
be_arm64_insert_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
static
BOOL
be_arm64_insert_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
void
*
addr
,
unsigned
long
*
val
,
unsigned
size
)
void
*
addr
,
unsigned
long
*
val
,
unsigned
size
)
{
{
SIZE_T
sz
;
SIZE_T
sz
;
switch
(
type
)
switch
(
type
)
{
{
case
be_xpoint_break
:
case
be_xpoint_break
:
if
(
!
size
)
return
0
;
if
(
!
size
)
return
FALSE
;
if
(
!
pio
->
read
(
hProcess
,
addr
,
val
,
4
,
&
sz
)
||
sz
!=
4
)
return
0
;
if
(
!
pio
->
read
(
hProcess
,
addr
,
val
,
4
,
&
sz
)
||
sz
!=
4
)
return
FALSE
;
default:
default:
dbg_printf
(
"Unknown/unsupported bp type %c
\n
"
,
type
);
dbg_printf
(
"Unknown/unsupported bp type %c
\n
"
,
type
);
return
0
;
return
FALSE
;
}
}
return
1
;
return
TRUE
;
}
}
static
unsigned
be_arm64_remove_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
static
BOOL
be_arm64_remove_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
void
*
addr
,
unsigned
long
val
,
unsigned
size
)
void
*
addr
,
unsigned
long
val
,
unsigned
size
)
{
{
SIZE_T
sz
;
SIZE_T
sz
;
switch
(
type
)
switch
(
type
)
{
{
case
be_xpoint_break
:
case
be_xpoint_break
:
if
(
!
size
)
return
0
;
if
(
!
size
)
return
FALSE
;
if
(
!
pio
->
write
(
hProcess
,
addr
,
&
val
,
4
,
&
sz
)
||
sz
==
4
)
return
0
;
if
(
!
pio
->
write
(
hProcess
,
addr
,
&
val
,
4
,
&
sz
)
||
sz
==
4
)
return
FALSE
;
break
;
break
;
default:
default:
dbg_printf
(
"Unknown/unsupported bp type %c
\n
"
,
type
);
dbg_printf
(
"Unknown/unsupported bp type %c
\n
"
,
type
);
return
0
;
return
FALSE
;
}
}
return
1
;
return
TRUE
;
}
}
static
unsigned
be_arm64_is_watchpoint_set
(
const
CONTEXT
*
ctx
,
unsigned
idx
)
static
BOOL
be_arm64_is_watchpoint_set
(
const
CONTEXT
*
ctx
,
unsigned
idx
)
{
{
dbg_printf
(
"be_arm64_is_watchpoint_set: not done
\n
"
);
dbg_printf
(
"be_arm64_is_watchpoint_set: not done
\n
"
);
return
FALSE
;
return
FALSE
;
...
@@ -229,8 +229,8 @@ static int be_arm64_adjust_pc_for_break(CONTEXT* ctx, BOOL way)
...
@@ -229,8 +229,8 @@ static int be_arm64_adjust_pc_for_break(CONTEXT* ctx, BOOL way)
return
4
;
return
4
;
}
}
static
int
be_arm64_fetch_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
static
BOOL
be_arm64_fetch_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
unsigned
is_signed
,
LONGLONG
*
ret
)
BOOL
is_signed
,
LONGLONG
*
ret
)
{
{
if
(
size
!=
1
&&
size
!=
2
&&
size
!=
4
&&
size
!=
8
)
return
FALSE
;
if
(
size
!=
1
&&
size
!=
2
&&
size
!=
4
&&
size
!=
8
)
return
FALSE
;
...
@@ -249,8 +249,8 @@ static int be_arm64_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size
...
@@ -249,8 +249,8 @@ static int be_arm64_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size
return
TRUE
;
return
TRUE
;
}
}
static
int
be_arm64_fetch_float
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
static
BOOL
be_arm64_fetch_float
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
long
double
*
ret
)
long
double
*
ret
)
{
{
char
tmp
[
sizeof
(
long
double
)];
char
tmp
[
sizeof
(
long
double
)];
...
@@ -267,8 +267,8 @@ static int be_arm64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
...
@@ -267,8 +267,8 @@ static int be_arm64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
return
TRUE
;
return
TRUE
;
}
}
static
int
be_arm64_store_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
static
BOOL
be_arm64_store_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
unsigned
is_signed
,
LONGLONG
val
)
BOOL
is_signed
,
LONGLONG
val
)
{
{
/* this is simple if we're on a little endian CPU */
/* this is simple if we're on a little endian CPU */
return
memory_write_value
(
lvalue
,
size
,
&
val
);
return
memory_write_value
(
lvalue
,
size
,
&
val
);
...
...
programs/winedbg/be_cpu.h
View file @
f23cb66d
...
@@ -37,17 +37,17 @@ struct backend_cpu
...
@@ -37,17 +37,17 @@ struct backend_cpu
* in an ADDRESS64 (except an linear one).
* in an ADDRESS64 (except an linear one).
* Non segmented CPU shall use be_cpu_build_addr
* Non segmented CPU shall use be_cpu_build_addr
*/
*/
unsigned
(
*
build_addr
)(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
BOOL
(
*
build_addr
)(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
ADDRESS64
*
addr
,
unsigned
seg
,
ADDRESS64
*
addr
,
unsigned
seg
,
unsigned
long
offset
);
unsigned
long
offset
);
/* Retrieves in addr an address related to the context (program counter, stack
/* Retrieves in addr an address related to the context (program counter, stack
* pointer, frame pointer)
* pointer, frame pointer)
*/
*/
unsigned
(
*
get_addr
)(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
BOOL
(
*
get_addr
)(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
enum
be_cpu_addr
,
ADDRESS64
*
addr
);
enum
be_cpu_addr
,
ADDRESS64
*
addr
);
/* returns which kind of information a given register number refers to */
/* returns which kind of information a given register number refers to */
unsigned
(
*
get_register_info
)(
int
regno
,
enum
be_cpu_addr
*
kind
);
BOOL
(
*
get_register_info
)(
int
regno
,
enum
be_cpu_addr
*
kind
);
/* -------------------------------------------------------------------------------
/* -------------------------------------------------------------------------------
* context manipulation
* context manipulation
...
@@ -69,17 +69,17 @@ struct backend_cpu
...
@@ -69,17 +69,17 @@ struct backend_cpu
/* Check whether the instruction at addr is an insn to step over
/* Check whether the instruction at addr is an insn to step over
* (like function call, interruption...)
* (like function call, interruption...)
*/
*/
unsigned
(
*
is_step_over_insn
)(
const
void
*
addr
);
BOOL
(
*
is_step_over_insn
)(
const
void
*
addr
);
/* Check whether instruction at 'addr' is the return from a function call */
/* Check whether instruction at 'addr' is the return from a function call */
unsigned
(
*
is_function_return
)(
const
void
*
addr
);
BOOL
(
*
is_function_return
)(
const
void
*
addr
);
/* Check whether instruction at 'addr' is the CPU break instruction. On i386,
/* Check whether instruction at 'addr' is the CPU break instruction. On i386,
* it's INT3 (0xCC)
* it's INT3 (0xCC)
*/
*/
unsigned
(
*
is_break_insn
)(
const
void
*
);
BOOL
(
*
is_break_insn
)(
const
void
*
);
/* Check whether instruction at 'addr' is a function call */
/* Check whether instruction at 'addr' is a function call */
unsigned
(
*
is_function_call
)(
const
void
*
insn
,
ADDRESS64
*
callee
);
BOOL
(
*
is_function_call
)(
const
void
*
insn
,
ADDRESS64
*
callee
);
/* Check whether instruction at 'addr' is a jump */
/* Check whether instruction at 'addr' is a jump */
unsigned
(
*
is_jump
)(
const
void
*
insn
,
ADDRESS64
*
jumpee
);
BOOL
(
*
is_jump
)(
const
void
*
insn
,
ADDRESS64
*
jumpee
);
/* Ask for disassembling one instruction. If display is true, assembly code
/* Ask for disassembling one instruction. If display is true, assembly code
* will be printed. In all cases, 'addr' is advanced at next instruction
* will be printed. In all cases, 'addr' is advanced at next instruction
*/
*/
...
@@ -88,15 +88,15 @@ struct backend_cpu
...
@@ -88,15 +88,15 @@ struct backend_cpu
* break points / watchpoints handling
* break points / watchpoints handling
* -------------------------------------------------------------------------------*/
* -------------------------------------------------------------------------------*/
/* Inserts an Xpoint in the CPU context and/or debuggee address space */
/* Inserts an Xpoint in the CPU context and/or debuggee address space */
unsigned
(
*
insert_Xpoint
)(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
BOOL
(
*
insert_Xpoint
)(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
void
*
addr
,
unsigned
long
*
val
,
unsigned
size
);
void
*
addr
,
unsigned
long
*
val
,
unsigned
size
);
/* Removes an Xpoint in the CPU context and/or debuggee address space */
/* Removes an Xpoint in the CPU context and/or debuggee address space */
unsigned
(
*
remove_Xpoint
)(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
BOOL
(
*
remove_Xpoint
)(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
void
*
addr
,
unsigned
long
val
,
unsigned
size
);
void
*
addr
,
unsigned
long
val
,
unsigned
size
);
/* Checks whether a given watchpoint has been triggered */
/* Checks whether a given watchpoint has been triggered */
unsigned
(
*
is_watchpoint_set
)(
const
CONTEXT
*
ctx
,
unsigned
idx
);
BOOL
(
*
is_watchpoint_set
)(
const
CONTEXT
*
ctx
,
unsigned
idx
);
/* Clears the watchpoint indicator */
/* Clears the watchpoint indicator */
void
(
*
clear_watchpoint
)(
CONTEXT
*
ctx
,
unsigned
idx
);
void
(
*
clear_watchpoint
)(
CONTEXT
*
ctx
,
unsigned
idx
);
/* After a break instruction is executed, in the corresponding exception handler,
/* After a break instruction is executed, in the corresponding exception handler,
...
@@ -109,16 +109,16 @@ struct backend_cpu
...
@@ -109,16 +109,16 @@ struct backend_cpu
* basic type read/write
* basic type read/write
* -------------------------------------------------------------------------------*/
* -------------------------------------------------------------------------------*/
/* Reads an integer from memory and stores it inside a long long int */
/* Reads an integer from memory and stores it inside a long long int */
int
(
*
fetch_integer
)(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
unsigned
is_signed
,
LONGLONG
*
);
BOOL
(
*
fetch_integer
)(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
BOOL
is_signed
,
LONGLONG
*
);
/* Reads a real from memory and stores it inside a long double */
/* Reads a real from memory and stores it inside a long double */
int
(
*
fetch_float
)(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
long
double
*
);
BOOL
(
*
fetch_float
)(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
long
double
*
);
/* Writes an integer to memory */
/* Writes an integer to memory */
int
(
*
store_integer
)(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
unsigned
is_signed
,
LONGLONG
);
BOOL
(
*
store_integer
)(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
BOOL
is_signed
,
LONGLONG
);
};
};
extern
struct
backend_cpu
*
be_cpu
;
extern
struct
backend_cpu
*
be_cpu
;
/* some handy functions for non segmented CPUs */
/* some handy functions for non segmented CPUs */
void
*
be_cpu_linearize
(
HANDLE
hThread
,
const
ADDRESS64
*
);
void
*
be_cpu_linearize
(
HANDLE
hThread
,
const
ADDRESS64
*
);
unsigned
be_cpu_build_addr
(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
ADDRESS64
*
addr
,
BOOL
be_cpu_build_addr
(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
ADDRESS64
*
addr
,
unsigned
seg
,
unsigned
long
offset
);
unsigned
seg
,
unsigned
long
offset
);
programs/winedbg/be_i386.c
View file @
f23cb66d
...
@@ -69,8 +69,8 @@ static void* be_i386_linearize(HANDLE hThread, const ADDRESS64* addr)
...
@@ -69,8 +69,8 @@ static void* be_i386_linearize(HANDLE hThread, const ADDRESS64* addr)
return
NULL
;
return
NULL
;
}
}
static
unsigned
be_i386_build_addr
(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
ADDRESS64
*
addr
,
static
BOOL
be_i386_build_addr
(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
ADDRESS64
*
addr
,
unsigned
seg
,
unsigned
long
offset
)
unsigned
seg
,
unsigned
long
offset
)
{
{
addr
->
Mode
=
AddrModeFlat
;
addr
->
Mode
=
AddrModeFlat
;
addr
->
Segment
=
seg
;
addr
->
Segment
=
seg
;
...
@@ -95,8 +95,8 @@ static unsigned be_i386_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64
...
@@ -95,8 +95,8 @@ static unsigned be_i386_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64
return
TRUE
;
return
TRUE
;
}
}
static
unsigned
be_i386_get_addr
(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
static
BOOL
be_i386_get_addr
(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
enum
be_cpu_addr
bca
,
ADDRESS64
*
addr
)
enum
be_cpu_addr
bca
,
ADDRESS64
*
addr
)
{
{
switch
(
bca
)
switch
(
bca
)
{
{
...
@@ -110,7 +110,7 @@ static unsigned be_i386_get_addr(HANDLE hThread, const CONTEXT* ctx,
...
@@ -110,7 +110,7 @@ static unsigned be_i386_get_addr(HANDLE hThread, const CONTEXT* ctx,
return
FALSE
;
return
FALSE
;
}
}
static
unsigned
be_i386_get_register_info
(
int
regno
,
enum
be_cpu_addr
*
kind
)
static
BOOL
be_i386_get_register_info
(
int
regno
,
enum
be_cpu_addr
*
kind
)
{
{
switch
(
regno
)
switch
(
regno
)
{
{
...
@@ -290,7 +290,7 @@ static struct dbg_internal_var be_i386_ctx[] =
...
@@ -290,7 +290,7 @@ static struct dbg_internal_var be_i386_ctx[] =
{
0
,
NULL
,
0
,
dbg_itype_none
}
{
0
,
NULL
,
0
,
dbg_itype_none
}
};
};
static
unsigned
be_i386_is_step_over_insn
(
const
void
*
insn
)
static
BOOL
be_i386_is_step_over_insn
(
const
void
*
insn
)
{
{
BYTE
ch
;
BYTE
ch
;
...
@@ -349,7 +349,7 @@ static unsigned be_i386_is_step_over_insn(const void* insn)
...
@@ -349,7 +349,7 @@ static unsigned be_i386_is_step_over_insn(const void* insn)
}
}
}
}
static
unsigned
be_i386_is_function_return
(
const
void
*
insn
)
static
BOOL
be_i386_is_function_return
(
const
void
*
insn
)
{
{
BYTE
ch
;
BYTE
ch
;
...
@@ -362,7 +362,7 @@ static unsigned be_i386_is_function_return(const void* insn)
...
@@ -362,7 +362,7 @@ static unsigned be_i386_is_function_return(const void* insn)
return
(
ch
==
0xC2
)
||
(
ch
==
0xC3
);
return
(
ch
==
0xC2
)
||
(
ch
==
0xC3
);
}
}
static
unsigned
be_i386_is_break_insn
(
const
void
*
insn
)
static
BOOL
be_i386_is_break_insn
(
const
void
*
insn
)
{
{
BYTE
c
;
BYTE
c
;
...
@@ -402,7 +402,7 @@ static BOOL fetch_value(const char* addr, unsigned sz, int* value)
...
@@ -402,7 +402,7 @@ static BOOL fetch_value(const char* addr, unsigned sz, int* value)
return
TRUE
;
return
TRUE
;
}
}
static
unsigned
be_i386_is_func_call
(
const
void
*
insn
,
ADDRESS64
*
callee
)
static
BOOL
be_i386_is_func_call
(
const
void
*
insn
,
ADDRESS64
*
callee
)
{
{
BYTE
ch
;
BYTE
ch
;
int
delta
;
int
delta
;
...
@@ -545,7 +545,7 @@ static unsigned be_i386_is_func_call(const void* insn, ADDRESS64* callee)
...
@@ -545,7 +545,7 @@ static unsigned be_i386_is_func_call(const void* insn, ADDRESS64* callee)
}
}
}
}
static
unsigned
be_i386_is_jump
(
const
void
*
insn
,
ADDRESS64
*
jumpee
)
static
BOOL
be_i386_is_jump
(
const
void
*
insn
,
ADDRESS64
*
jumpee
)
{
{
BYTE
ch
;
BYTE
ch
;
int
delta
;
int
delta
;
...
@@ -633,9 +633,9 @@ static inline int be_i386_get_unused_DR(CONTEXT* ctx, DWORD** r)
...
@@ -633,9 +633,9 @@ static inline int be_i386_get_unused_DR(CONTEXT* ctx, DWORD** r)
return
-
1
;
return
-
1
;
}
}
static
unsigned
be_i386_insert_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
static
BOOL
be_i386_insert_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
void
*
addr
,
unsigned
long
*
val
,
unsigned
size
)
void
*
addr
,
unsigned
long
*
val
,
unsigned
size
)
{
{
unsigned
char
ch
;
unsigned
char
ch
;
SIZE_T
sz
;
SIZE_T
sz
;
...
@@ -646,11 +646,11 @@ static unsigned be_i386_insert_Xpoint(HANDLE hProcess, const struct be_process_i
...
@@ -646,11 +646,11 @@ static unsigned be_i386_insert_Xpoint(HANDLE hProcess, const struct be_process_i
switch
(
type
)
switch
(
type
)
{
{
case
be_xpoint_break
:
case
be_xpoint_break
:
if
(
size
!=
0
)
return
0
;
if
(
size
!=
0
)
return
FALSE
;
if
(
!
pio
->
read
(
hProcess
,
addr
,
&
ch
,
1
,
&
sz
)
||
sz
!=
1
)
return
0
;
if
(
!
pio
->
read
(
hProcess
,
addr
,
&
ch
,
1
,
&
sz
)
||
sz
!=
1
)
return
FALSE
;
*
val
=
ch
;
*
val
=
ch
;
ch
=
0xcc
;
ch
=
0xcc
;
if
(
!
pio
->
write
(
hProcess
,
addr
,
&
ch
,
1
,
&
sz
)
||
sz
!=
1
)
return
0
;
if
(
!
pio
->
write
(
hProcess
,
addr
,
&
ch
,
1
,
&
sz
)
||
sz
!=
1
)
return
FALSE
;
break
;
break
;
case
be_xpoint_watch_exec
:
case
be_xpoint_watch_exec
:
bits
=
DR7_RW_EXECUTE
;
bits
=
DR7_RW_EXECUTE
;
...
@@ -661,14 +661,14 @@ static unsigned be_i386_insert_Xpoint(HANDLE hProcess, const struct be_process_i
...
@@ -661,14 +661,14 @@ static unsigned be_i386_insert_Xpoint(HANDLE hProcess, const struct be_process_i
case
be_xpoint_watch_write
:
case
be_xpoint_watch_write
:
bits
=
DR7_RW_WRITE
;
bits
=
DR7_RW_WRITE
;
hw_bp:
hw_bp:
if
((
reg
=
be_i386_get_unused_DR
(
ctx
,
&
pr
))
==
-
1
)
return
0
;
if
((
reg
=
be_i386_get_unused_DR
(
ctx
,
&
pr
))
==
-
1
)
return
FALSE
;
*
pr
=
(
DWORD
)
addr
;
*
pr
=
(
DWORD
)
addr
;
if
(
type
!=
be_xpoint_watch_exec
)
switch
(
size
)
if
(
type
!=
be_xpoint_watch_exec
)
switch
(
size
)
{
{
case
4
:
bits
|=
DR7_LEN_4
;
break
;
case
4
:
bits
|=
DR7_LEN_4
;
break
;
case
2
:
bits
|=
DR7_LEN_2
;
break
;
case
2
:
bits
|=
DR7_LEN_2
;
break
;
case
1
:
bits
|=
DR7_LEN_1
;
break
;
case
1
:
bits
|=
DR7_LEN_1
;
break
;
default:
return
0
;
default:
return
FALSE
;
}
}
*
val
=
reg
;
*
val
=
reg
;
/* clear old values */
/* clear old values */
...
@@ -679,14 +679,14 @@ static unsigned be_i386_insert_Xpoint(HANDLE hProcess, const struct be_process_i
...
@@ -679,14 +679,14 @@ static unsigned be_i386_insert_Xpoint(HANDLE hProcess, const struct be_process_i
break
;
break
;
default:
default:
dbg_printf
(
"Unknown bp type %c
\n
"
,
type
);
dbg_printf
(
"Unknown bp type %c
\n
"
,
type
);
return
0
;
return
FALSE
;
}
}
return
1
;
return
TRUE
;
}
}
static
unsigned
be_i386_remove_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
static
BOOL
be_i386_remove_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
void
*
addr
,
unsigned
long
val
,
unsigned
size
)
void
*
addr
,
unsigned
long
val
,
unsigned
size
)
{
{
SIZE_T
sz
;
SIZE_T
sz
;
unsigned
char
ch
;
unsigned
char
ch
;
...
@@ -694,13 +694,13 @@ static unsigned be_i386_remove_Xpoint(HANDLE hProcess, const struct be_process_i
...
@@ -694,13 +694,13 @@ static unsigned be_i386_remove_Xpoint(HANDLE hProcess, const struct be_process_i
switch
(
type
)
switch
(
type
)
{
{
case
be_xpoint_break
:
case
be_xpoint_break
:
if
(
size
!=
0
)
return
0
;
if
(
size
!=
0
)
return
FALSE
;
if
(
!
pio
->
read
(
hProcess
,
addr
,
&
ch
,
1
,
&
sz
)
||
sz
!=
1
)
return
0
;
if
(
!
pio
->
read
(
hProcess
,
addr
,
&
ch
,
1
,
&
sz
)
||
sz
!=
1
)
return
FALSE
;
if
(
ch
!=
(
unsigned
char
)
0xCC
)
if
(
ch
!=
(
unsigned
char
)
0xCC
)
WINE_FIXME
(
"Cannot get back %02x instead of 0xCC at %08lx
\n
"
,
WINE_FIXME
(
"Cannot get back %02x instead of 0xCC at %08lx
\n
"
,
ch
,
(
unsigned
long
)
addr
);
ch
,
(
unsigned
long
)
addr
);
ch
=
(
unsigned
char
)
val
;
ch
=
(
unsigned
char
)
val
;
if
(
!
pio
->
write
(
hProcess
,
addr
,
&
ch
,
1
,
&
sz
)
||
sz
!=
1
)
return
0
;
if
(
!
pio
->
write
(
hProcess
,
addr
,
&
ch
,
1
,
&
sz
)
||
sz
!=
1
)
return
FALSE
;
break
;
break
;
case
be_xpoint_watch_exec
:
case
be_xpoint_watch_exec
:
case
be_xpoint_watch_read
:
case
be_xpoint_watch_read
:
...
@@ -710,12 +710,12 @@ static unsigned be_i386_remove_Xpoint(HANDLE hProcess, const struct be_process_i
...
@@ -710,12 +710,12 @@ static unsigned be_i386_remove_Xpoint(HANDLE hProcess, const struct be_process_i
break
;
break
;
default:
default:
dbg_printf
(
"Unknown bp type %c
\n
"
,
type
);
dbg_printf
(
"Unknown bp type %c
\n
"
,
type
);
return
0
;
return
FALSE
;
}
}
return
1
;
return
TRUE
;
}
}
static
unsigned
be_i386_is_watchpoint_set
(
const
CONTEXT
*
ctx
,
unsigned
idx
)
static
BOOL
be_i386_is_watchpoint_set
(
const
CONTEXT
*
ctx
,
unsigned
idx
)
{
{
return
ctx
->
Dr6
&
(
1
<<
idx
);
return
ctx
->
Dr6
&
(
1
<<
idx
);
}
}
...
@@ -736,8 +736,8 @@ static int be_i386_adjust_pc_for_break(CONTEXT* ctx, BOOL way)
...
@@ -736,8 +736,8 @@ static int be_i386_adjust_pc_for_break(CONTEXT* ctx, BOOL way)
return
1
;
return
1
;
}
}
static
int
be_i386_fetch_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
static
BOOL
be_i386_fetch_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
unsigned
is_signed
,
LONGLONG
*
ret
)
BOOL
is_signed
,
LONGLONG
*
ret
)
{
{
if
(
size
!=
1
&&
size
!=
2
&&
size
!=
4
&&
size
!=
8
)
return
FALSE
;
if
(
size
!=
1
&&
size
!=
2
&&
size
!=
4
&&
size
!=
8
)
return
FALSE
;
...
@@ -756,8 +756,8 @@ static int be_i386_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size,
...
@@ -756,8 +756,8 @@ static int be_i386_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size,
return
TRUE
;
return
TRUE
;
}
}
static
int
be_i386_fetch_float
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
static
BOOL
be_i386_fetch_float
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
long
double
*
ret
)
long
double
*
ret
)
{
{
char
tmp
[
sizeof
(
long
double
)];
char
tmp
[
sizeof
(
long
double
)];
...
@@ -775,8 +775,8 @@ static int be_i386_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
...
@@ -775,8 +775,8 @@ static int be_i386_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
return
TRUE
;
return
TRUE
;
}
}
static
int
be_i386_store_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
static
BOOL
be_i386_store_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
unsigned
is_signed
,
LONGLONG
val
)
BOOL
is_signed
,
LONGLONG
val
)
{
{
/* this is simple as we're on a little endian CPU */
/* this is simple as we're on a little endian CPU */
return
memory_write_value
(
lvalue
,
size
,
&
val
);
return
memory_write_value
(
lvalue
,
size
,
&
val
);
...
...
programs/winedbg/be_ppc.c
View file @
f23cb66d
...
@@ -23,8 +23,8 @@
...
@@ -23,8 +23,8 @@
#if defined(__powerpc__)
#if defined(__powerpc__)
static
unsigned
be_ppc_get_addr
(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
static
BOOL
be_ppc_get_addr
(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
enum
be_cpu_addr
bca
,
ADDRESS64
*
addr
)
enum
be_cpu_addr
bca
,
ADDRESS64
*
addr
)
{
{
switch
(
bca
)
switch
(
bca
)
{
{
...
@@ -38,7 +38,7 @@ static unsigned be_ppc_get_addr(HANDLE hThread, const CONTEXT* ctx,
...
@@ -38,7 +38,7 @@ static unsigned be_ppc_get_addr(HANDLE hThread, const CONTEXT* ctx,
return
FALSE
;
return
FALSE
;
}
}
static
unsigned
be_ppc_get_register_info
(
int
regno
,
enum
be_cpu_addr
*
kind
)
static
BOOL
be_ppc_get_register_info
(
int
regno
,
enum
be_cpu_addr
*
kind
)
{
{
dbg_printf
(
"not done
\n
"
);
dbg_printf
(
"not done
\n
"
);
return
FALSE
;
return
FALSE
;
...
@@ -67,30 +67,30 @@ static struct dbg_internal_var be_ppc_ctx[] =
...
@@ -67,30 +67,30 @@ static struct dbg_internal_var be_ppc_ctx[] =
{
0
,
NULL
,
0
,
dbg_itype_none
}
{
0
,
NULL
,
0
,
dbg_itype_none
}
};
};
static
unsigned
be_ppc_is_step_over_insn
(
const
void
*
insn
)
static
BOOL
be_ppc_is_step_over_insn
(
const
void
*
insn
)
{
{
dbg_printf
(
"not done
\n
"
);
dbg_printf
(
"not done
\n
"
);
return
FALSE
;
return
FALSE
;
}
}
static
unsigned
be_ppc_is_function_return
(
const
void
*
insn
)
static
BOOL
be_ppc_is_function_return
(
const
void
*
insn
)
{
{
dbg_printf
(
"not done
\n
"
);
dbg_printf
(
"not done
\n
"
);
return
FALSE
;
return
FALSE
;
}
}
static
unsigned
be_ppc_is_break_insn
(
const
void
*
insn
)
static
BOOL
be_ppc_is_break_insn
(
const
void
*
insn
)
{
{
dbg_printf
(
"not done
\n
"
);
dbg_printf
(
"not done
\n
"
);
return
FALSE
;
return
FALSE
;
}
}
static
unsigned
be_ppc_is_func_call
(
const
void
*
insn
,
ADDRESS64
*
callee
)
static
BOOL
be_ppc_is_func_call
(
const
void
*
insn
,
ADDRESS64
*
callee
)
{
{
return
FALSE
;
return
FALSE
;
}
}
static
unsigned
be_ppc_is_jump
(
const
void
*
insn
,
ADDRESS64
*
jumpee
)
static
BOOL
be_ppc_is_jump
(
const
void
*
insn
,
ADDRESS64
*
jumpee
)
{
{
return
FALSE
;
return
FALSE
;
}
}
...
@@ -101,9 +101,9 @@ static void be_ppc_disasm_one_insn(ADDRESS64* addr, int display)
...
@@ -101,9 +101,9 @@ static void be_ppc_disasm_one_insn(ADDRESS64* addr, int display)
dbg_printf
(
"Disasm NIY
\n
"
);
dbg_printf
(
"Disasm NIY
\n
"
);
}
}
static
unsigned
be_ppc_insert_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
static
BOOL
be_ppc_insert_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
void
*
addr
,
unsigned
long
*
val
,
unsigned
size
)
void
*
addr
,
unsigned
long
*
val
,
unsigned
size
)
{
{
unsigned
long
xbp
;
unsigned
long
xbp
;
SIZE_T
sz
;
SIZE_T
sz
;
...
@@ -111,38 +111,38 @@ static unsigned be_ppc_insert_Xpoint(HANDLE hProcess, const struct be_process_io
...
@@ -111,38 +111,38 @@ static unsigned be_ppc_insert_Xpoint(HANDLE hProcess, const struct be_process_io
switch
(
type
)
switch
(
type
)
{
{
case
be_xpoint_break
:
case
be_xpoint_break
:
if
(
!
size
)
return
0
;
if
(
!
size
)
return
FALSE
;
if
(
!
pio
->
read
(
hProcess
,
addr
,
val
,
4
,
&
sz
)
||
sz
!=
4
)
return
0
;
if
(
!
pio
->
read
(
hProcess
,
addr
,
val
,
4
,
&
sz
)
||
sz
!=
4
)
return
FALSE
;
xbp
=
0x7d821008
;
/* 7d 82 10 08 ... in big endian */
xbp
=
0x7d821008
;
/* 7d 82 10 08 ... in big endian */
if
(
!
pio
->
write
(
hProcess
,
addr
,
&
xbp
,
4
,
&
sz
)
||
sz
!=
4
)
return
0
;
if
(
!
pio
->
write
(
hProcess
,
addr
,
&
xbp
,
4
,
&
sz
)
||
sz
!=
4
)
return
FALSE
;
break
;
break
;
default:
default:
dbg_printf
(
"Unknown/unsupported bp type %c
\n
"
,
type
);
dbg_printf
(
"Unknown/unsupported bp type %c
\n
"
,
type
);
return
0
;
return
FALSE
;
}
}
return
1
;
return
TRUE
;
}
}
static
unsigned
be_ppc_remove_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
static
BOOL
be_ppc_remove_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
void
*
addr
,
unsigned
long
val
,
unsigned
size
)
void
*
addr
,
unsigned
long
val
,
unsigned
size
)
{
{
SIZE_T
sz
;
SIZE_T
sz
;
switch
(
type
)
switch
(
type
)
{
{
case
be_xpoint_break
:
case
be_xpoint_break
:
if
(
!
size
)
return
0
;
if
(
!
size
)
return
FALSE
;
if
(
!
pio
->
write
(
hProcess
,
addr
,
&
val
,
4
,
&
sz
)
||
sz
==
4
)
return
0
;
if
(
!
pio
->
write
(
hProcess
,
addr
,
&
val
,
4
,
&
sz
)
||
sz
==
4
)
return
FALSE
;
break
;
break
;
default:
default:
dbg_printf
(
"Unknown/unsupported bp type %c
\n
"
,
type
);
dbg_printf
(
"Unknown/unsupported bp type %c
\n
"
,
type
);
return
0
;
return
FALSE
;
}
}
return
1
;
return
TRUE
;
}
}
static
unsigned
be_ppc_is_watchpoint_set
(
const
CONTEXT
*
ctx
,
unsigned
idx
)
static
BOOL
be_ppc_is_watchpoint_set
(
const
CONTEXT
*
ctx
,
unsigned
idx
)
{
{
dbg_printf
(
"not done
\n
"
);
dbg_printf
(
"not done
\n
"
);
return
FALSE
;
return
FALSE
;
...
@@ -159,22 +159,22 @@ static int be_ppc_adjust_pc_for_break(CONTEXT* ctx, BOOL way)
...
@@ -159,22 +159,22 @@ static int be_ppc_adjust_pc_for_break(CONTEXT* ctx, BOOL way)
return
0
;
return
0
;
}
}
static
int
be_ppc_fetch_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
static
BOOL
be_ppc_fetch_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
unsigned
is_signed
,
LONGLONG
*
ret
)
BOOL
is_signed
,
LONGLONG
*
ret
)
{
{
dbg_printf
(
"not done
\n
"
);
dbg_printf
(
"not done
\n
"
);
return
FALSE
;
return
FALSE
;
}
}
static
int
be_ppc_fetch_float
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
static
BOOL
be_ppc_fetch_float
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
long
double
*
ret
)
long
double
*
ret
)
{
{
dbg_printf
(
"not done
\n
"
);
dbg_printf
(
"not done
\n
"
);
return
FALSE
;
return
FALSE
;
}
}
static
int
be_ppc_store_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
static
BOOL
be_ppc_store_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
unsigned
is_signed
,
LONGLONG
val
)
BOOL
is_signed
,
LONGLONG
val
)
{
{
dbg_printf
(
"be_ppc_store_integer: not done
\n
"
);
dbg_printf
(
"be_ppc_store_integer: not done
\n
"
);
return
FALSE
;
return
FALSE
;
...
...
programs/winedbg/be_x86_64.c
View file @
f23cb66d
...
@@ -28,8 +28,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
...
@@ -28,8 +28,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
#define STEP_FLAG 0x00000100
/* single step flag */
#define STEP_FLAG 0x00000100
/* single step flag */
static
unsigned
be_x86_64_get_addr
(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
static
BOOL
be_x86_64_get_addr
(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
enum
be_cpu_addr
bca
,
ADDRESS64
*
addr
)
enum
be_cpu_addr
bca
,
ADDRESS64
*
addr
)
{
{
addr
->
Mode
=
AddrModeFlat
;
addr
->
Mode
=
AddrModeFlat
;
switch
(
bca
)
switch
(
bca
)
...
@@ -52,7 +52,7 @@ static unsigned be_x86_64_get_addr(HANDLE hThread, const CONTEXT* ctx,
...
@@ -52,7 +52,7 @@ static unsigned be_x86_64_get_addr(HANDLE hThread, const CONTEXT* ctx,
}
}
}
}
static
unsigned
be_x86_64_get_register_info
(
int
regno
,
enum
be_cpu_addr
*
kind
)
static
BOOL
be_x86_64_get_register_info
(
int
regno
,
enum
be_cpu_addr
*
kind
)
{
{
/* this is true when running in 32bit mode... and wrong in 64 :-/ */
/* this is true when running in 32bit mode... and wrong in 64 :-/ */
switch
(
regno
)
switch
(
regno
)
...
@@ -242,7 +242,7 @@ static struct dbg_internal_var be_x86_64_ctx[] =
...
@@ -242,7 +242,7 @@ static struct dbg_internal_var be_x86_64_ctx[] =
#define f_reg(b) (((b)>>3)&0x7)
#define f_reg(b) (((b)>>3)&0x7)
#define f_rm(b) ((b)&0x7)
#define f_rm(b) ((b)&0x7)
static
unsigned
be_x86_64_is_step_over_insn
(
const
void
*
insn
)
static
BOOL
be_x86_64_is_step_over_insn
(
const
void
*
insn
)
{
{
BYTE
ch
;
BYTE
ch
;
...
@@ -301,7 +301,7 @@ static unsigned be_x86_64_is_step_over_insn(const void* insn)
...
@@ -301,7 +301,7 @@ static unsigned be_x86_64_is_step_over_insn(const void* insn)
}
}
}
}
static
unsigned
be_x86_64_is_function_return
(
const
void
*
insn
)
static
BOOL
be_x86_64_is_function_return
(
const
void
*
insn
)
{
{
BYTE
c
;
BYTE
c
;
...
@@ -315,7 +315,7 @@ static unsigned be_x86_64_is_function_return(const void* insn)
...
@@ -315,7 +315,7 @@ static unsigned be_x86_64_is_function_return(const void* insn)
return
c
==
0xC2
/* ret */
||
c
==
0xC3
/* ret NN */
;
return
c
==
0xC2
/* ret */
||
c
==
0xC3
/* ret NN */
;
}
}
static
unsigned
be_x86_64_is_break_insn
(
const
void
*
insn
)
static
BOOL
be_x86_64_is_break_insn
(
const
void
*
insn
)
{
{
BYTE
c
;
BYTE
c
;
return
dbg_read_memory
(
insn
,
&
c
,
sizeof
(
c
))
&&
c
==
0xCC
;
return
dbg_read_memory
(
insn
,
&
c
,
sizeof
(
c
))
&&
c
==
0xCC
;
...
@@ -343,7 +343,7 @@ static BOOL fetch_value(const char* addr, unsigned sz, int* value)
...
@@ -343,7 +343,7 @@ static BOOL fetch_value(const char* addr, unsigned sz, int* value)
return
TRUE
;
return
TRUE
;
}
}
static
unsigned
be_x86_64_is_func_call
(
const
void
*
insn
,
ADDRESS64
*
callee
)
static
BOOL
be_x86_64_is_func_call
(
const
void
*
insn
,
ADDRESS64
*
callee
)
{
{
BYTE
ch
;
BYTE
ch
;
LONG
delta
;
LONG
delta
;
...
@@ -436,7 +436,7 @@ static unsigned be_x86_64_is_func_call(const void* insn, ADDRESS64* callee)
...
@@ -436,7 +436,7 @@ static unsigned be_x86_64_is_func_call(const void* insn, ADDRESS64* callee)
}
}
}
}
static
unsigned
be_x86_64_is_jump
(
const
void
*
insn
,
ADDRESS64
*
jumpee
)
static
BOOL
be_x86_64_is_jump
(
const
void
*
insn
,
ADDRESS64
*
jumpee
)
{
{
return
FALSE
;
return
FALSE
;
}
}
...
@@ -496,9 +496,9 @@ static inline int be_x86_64_get_unused_DR(CONTEXT* ctx, DWORD64** r)
...
@@ -496,9 +496,9 @@ static inline int be_x86_64_get_unused_DR(CONTEXT* ctx, DWORD64** r)
return
-
1
;
return
-
1
;
}
}
static
unsigned
be_x86_64_insert_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
static
BOOL
be_x86_64_insert_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
void
*
addr
,
unsigned
long
*
val
,
unsigned
size
)
void
*
addr
,
unsigned
long
*
val
,
unsigned
size
)
{
{
unsigned
char
ch
;
unsigned
char
ch
;
SIZE_T
sz
;
SIZE_T
sz
;
...
@@ -509,11 +509,11 @@ static unsigned be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process
...
@@ -509,11 +509,11 @@ static unsigned be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process
switch
(
type
)
switch
(
type
)
{
{
case
be_xpoint_break
:
case
be_xpoint_break
:
if
(
size
!=
0
)
return
0
;
if
(
size
!=
0
)
return
FALSE
;
if
(
!
pio
->
read
(
hProcess
,
addr
,
&
ch
,
1
,
&
sz
)
||
sz
!=
1
)
return
0
;
if
(
!
pio
->
read
(
hProcess
,
addr
,
&
ch
,
1
,
&
sz
)
||
sz
!=
1
)
return
FALSE
;
*
val
=
ch
;
*
val
=
ch
;
ch
=
0xcc
;
ch
=
0xcc
;
if
(
!
pio
->
write
(
hProcess
,
addr
,
&
ch
,
1
,
&
sz
)
||
sz
!=
1
)
return
0
;
if
(
!
pio
->
write
(
hProcess
,
addr
,
&
ch
,
1
,
&
sz
)
||
sz
!=
1
)
return
FALSE
;
break
;
break
;
case
be_xpoint_watch_exec
:
case
be_xpoint_watch_exec
:
bits
=
DR7_RW_EXECUTE
;
bits
=
DR7_RW_EXECUTE
;
...
@@ -524,7 +524,7 @@ static unsigned be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process
...
@@ -524,7 +524,7 @@ static unsigned be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process
case
be_xpoint_watch_write
:
case
be_xpoint_watch_write
:
bits
=
DR7_RW_WRITE
;
bits
=
DR7_RW_WRITE
;
hw_bp:
hw_bp:
if
((
reg
=
be_x86_64_get_unused_DR
(
ctx
,
&
pr
))
==
-
1
)
return
0
;
if
((
reg
=
be_x86_64_get_unused_DR
(
ctx
,
&
pr
))
==
-
1
)
return
FALSE
;
*
pr
=
(
DWORD64
)
addr
;
*
pr
=
(
DWORD64
)
addr
;
if
(
type
!=
be_xpoint_watch_exec
)
switch
(
size
)
if
(
type
!=
be_xpoint_watch_exec
)
switch
(
size
)
{
{
...
@@ -532,7 +532,7 @@ static unsigned be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process
...
@@ -532,7 +532,7 @@ static unsigned be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process
case
4
:
bits
|=
DR7_LEN_4
;
break
;
case
4
:
bits
|=
DR7_LEN_4
;
break
;
case
2
:
bits
|=
DR7_LEN_2
;
break
;
case
2
:
bits
|=
DR7_LEN_2
;
break
;
case
1
:
bits
|=
DR7_LEN_1
;
break
;
case
1
:
bits
|=
DR7_LEN_1
;
break
;
default:
WINE_FIXME
(
"Unsupported xpoint_watch of size %d
\n
"
,
size
);
return
0
;
default:
WINE_FIXME
(
"Unsupported xpoint_watch of size %d
\n
"
,
size
);
return
FALSE
;
}
}
*
val
=
reg
;
*
val
=
reg
;
/* clear old values */
/* clear old values */
...
@@ -543,14 +543,14 @@ static unsigned be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process
...
@@ -543,14 +543,14 @@ static unsigned be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process
break
;
break
;
default:
default:
dbg_printf
(
"Unknown bp type %c
\n
"
,
type
);
dbg_printf
(
"Unknown bp type %c
\n
"
,
type
);
return
0
;
return
FALSE
;
}
}
return
1
;
return
TRUE
;
}
}
static
unsigned
be_x86_64_remove_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
static
BOOL
be_x86_64_remove_Xpoint
(
HANDLE
hProcess
,
const
struct
be_process_io
*
pio
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
CONTEXT
*
ctx
,
enum
be_xpoint_type
type
,
void
*
addr
,
unsigned
long
val
,
unsigned
size
)
void
*
addr
,
unsigned
long
val
,
unsigned
size
)
{
{
SIZE_T
sz
;
SIZE_T
sz
;
unsigned
char
ch
;
unsigned
char
ch
;
...
@@ -558,12 +558,12 @@ static unsigned be_x86_64_remove_Xpoint(HANDLE hProcess, const struct be_process
...
@@ -558,12 +558,12 @@ static unsigned be_x86_64_remove_Xpoint(HANDLE hProcess, const struct be_process
switch
(
type
)
switch
(
type
)
{
{
case
be_xpoint_break
:
case
be_xpoint_break
:
if
(
size
!=
0
)
return
0
;
if
(
size
!=
0
)
return
FALSE
;
if
(
!
pio
->
read
(
hProcess
,
addr
,
&
ch
,
1
,
&
sz
)
||
sz
!=
1
)
return
0
;
if
(
!
pio
->
read
(
hProcess
,
addr
,
&
ch
,
1
,
&
sz
)
||
sz
!=
1
)
return
FALSE
;
if
(
ch
!=
(
unsigned
char
)
0xCC
)
if
(
ch
!=
(
unsigned
char
)
0xCC
)
WINE_FIXME
(
"Cannot get back %02x instead of 0xCC at %p
\n
"
,
ch
,
addr
);
WINE_FIXME
(
"Cannot get back %02x instead of 0xCC at %p
\n
"
,
ch
,
addr
);
ch
=
(
unsigned
char
)
val
;
ch
=
(
unsigned
char
)
val
;
if
(
!
pio
->
write
(
hProcess
,
addr
,
&
ch
,
1
,
&
sz
)
||
sz
!=
1
)
return
0
;
if
(
!
pio
->
write
(
hProcess
,
addr
,
&
ch
,
1
,
&
sz
)
||
sz
!=
1
)
return
FALSE
;
break
;
break
;
case
be_xpoint_watch_exec
:
case
be_xpoint_watch_exec
:
case
be_xpoint_watch_read
:
case
be_xpoint_watch_read
:
...
@@ -573,12 +573,12 @@ static unsigned be_x86_64_remove_Xpoint(HANDLE hProcess, const struct be_process
...
@@ -573,12 +573,12 @@ static unsigned be_x86_64_remove_Xpoint(HANDLE hProcess, const struct be_process
break
;
break
;
default:
default:
dbg_printf
(
"Unknown bp type %c
\n
"
,
type
);
dbg_printf
(
"Unknown bp type %c
\n
"
,
type
);
return
0
;
return
FALSE
;
}
}
return
1
;
return
TRUE
;
}
}
static
unsigned
be_x86_64_is_watchpoint_set
(
const
CONTEXT
*
ctx
,
unsigned
idx
)
static
BOOL
be_x86_64_is_watchpoint_set
(
const
CONTEXT
*
ctx
,
unsigned
idx
)
{
{
return
ctx
->
Dr6
&
(
1
<<
idx
);
return
ctx
->
Dr6
&
(
1
<<
idx
);
}
}
...
@@ -599,8 +599,8 @@ static int be_x86_64_adjust_pc_for_break(CONTEXT* ctx, BOOL way)
...
@@ -599,8 +599,8 @@ static int be_x86_64_adjust_pc_for_break(CONTEXT* ctx, BOOL way)
return
1
;
return
1
;
}
}
static
int
be_x86_64_fetch_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
static
BOOL
be_x86_64_fetch_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
unsigned
is_signed
,
LONGLONG
*
ret
)
BOOL
is_signed
,
LONGLONG
*
ret
)
{
{
if
(
size
!=
1
&&
size
!=
2
&&
size
!=
4
&&
size
!=
8
&&
size
!=
16
)
if
(
size
!=
1
&&
size
!=
2
&&
size
!=
4
&&
size
!=
8
&&
size
!=
16
)
return
FALSE
;
return
FALSE
;
...
@@ -620,8 +620,8 @@ static int be_x86_64_fetch_integer(const struct dbg_lvalue* lvalue, unsigned siz
...
@@ -620,8 +620,8 @@ static int be_x86_64_fetch_integer(const struct dbg_lvalue* lvalue, unsigned siz
return
TRUE
;
return
TRUE
;
}
}
static
int
be_x86_64_fetch_float
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
static
BOOL
be_x86_64_fetch_float
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
long
double
*
ret
)
long
double
*
ret
)
{
{
char
tmp
[
sizeof
(
long
double
)];
char
tmp
[
sizeof
(
long
double
)];
...
@@ -639,8 +639,8 @@ static int be_x86_64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
...
@@ -639,8 +639,8 @@ static int be_x86_64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
return
TRUE
;
return
TRUE
;
}
}
static
int
be_x86_64_store_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
static
BOOL
be_x86_64_store_integer
(
const
struct
dbg_lvalue
*
lvalue
,
unsigned
size
,
unsigned
is_signed
,
LONGLONG
val
)
BOOL
is_signed
,
LONGLONG
val
)
{
{
/* this is simple as we're on a little endian CPU */
/* this is simple as we're on a little endian CPU */
return
memory_write_value
(
lvalue
,
size
,
&
val
);
return
memory_write_value
(
lvalue
,
size
,
&
val
);
...
...
programs/winedbg/memory.c
View file @
f23cb66d
...
@@ -39,8 +39,8 @@ void* be_cpu_linearize(HANDLE hThread, const ADDRESS64* addr)
...
@@ -39,8 +39,8 @@ void* be_cpu_linearize(HANDLE hThread, const ADDRESS64* addr)
return
(
void
*
)(
DWORD_PTR
)
addr
->
Offset
;
return
(
void
*
)(
DWORD_PTR
)
addr
->
Offset
;
}
}
unsigned
be_cpu_build_addr
(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
ADDRESS64
*
addr
,
BOOL
be_cpu_build_addr
(
HANDLE
hThread
,
const
CONTEXT
*
ctx
,
ADDRESS64
*
addr
,
unsigned
seg
,
unsigned
long
offset
)
unsigned
seg
,
unsigned
long
offset
)
{
{
addr
->
Mode
=
AddrModeFlat
;
addr
->
Mode
=
AddrModeFlat
;
addr
->
Segment
=
0
;
/* don't need segment */
addr
->
Segment
=
0
;
/* don't need segment */
...
...
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