From f23cb66db69680a2bfef4d41742de0fc2170dd6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delanoy?= Date: Thu, 14 Nov 2013 03:53:02 +0100 Subject: [PATCH] winedbg: Use BOOL type where appropriate. --- programs/winedbg/be_arm.c | 58 +++++++++++++++--------------- programs/winedbg/be_arm64.c | 58 +++++++++++++++--------------- programs/winedbg/be_cpu.h | 32 ++++++++--------- programs/winedbg/be_i386.c | 70 ++++++++++++++++++------------------ programs/winedbg/be_ppc.c | 60 +++++++++++++++---------------- programs/winedbg/be_x86_64.c | 66 +++++++++++++++++----------------- programs/winedbg/memory.c | 4 +-- 7 files changed, 174 insertions(+), 174 deletions(-) diff --git a/programs/winedbg/be_arm.c b/programs/winedbg/be_arm.c index 77696ad03f0..1bbefd44ee4 100644 --- a/programs/winedbg/be_arm.c +++ b/programs/winedbg/be_arm.c @@ -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, - enum be_cpu_addr bca, ADDRESS64* addr) +static BOOL be_arm_get_addr(HANDLE hThread, const CONTEXT* ctx, + enum be_cpu_addr bca, ADDRESS64* addr) { switch (bca) { @@ -1673,7 +1673,7 @@ static unsigned be_arm_get_addr(HANDLE hThread, const CONTEXT* ctx, 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) { @@ -1755,72 +1755,72 @@ static struct dbg_internal_var be_arm_ctx[] = {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"); 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"); 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"); 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; } -static unsigned be_arm_is_jump(const void* insn, ADDRESS64* jumpee) +static BOOL be_arm_is_jump(const void* insn, ADDRESS64* jumpee) { return FALSE; } -static unsigned be_arm_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio, - CONTEXT* ctx, enum be_xpoint_type type, - void* addr, unsigned long* val, unsigned size) +static BOOL be_arm_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio, + CONTEXT* ctx, enum be_xpoint_type type, + void* addr, unsigned long* val, unsigned size) { SIZE_T sz; switch (type) { case be_xpoint_break: - if (!size) return 0; - if (!pio->read(hProcess, addr, val, 4, &sz) || sz != 4) return 0; + if (!size) return FALSE; + if (!pio->read(hProcess, addr, val, 4, &sz) || sz != 4) return FALSE; default: 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, - CONTEXT* ctx, enum be_xpoint_type type, - void* addr, unsigned long val, unsigned size) +static BOOL be_arm_remove_Xpoint(HANDLE hProcess, const struct be_process_io* pio, + CONTEXT* ctx, enum be_xpoint_type type, + void* addr, unsigned long val, unsigned size) { SIZE_T sz; switch (type) { case be_xpoint_break: - if (!size) return 0; - if (!pio->write(hProcess, addr, &val, 4, &sz) || sz == 4) return 0; + if (!size) return FALSE; + if (!pio->write(hProcess, addr, &val, 4, &sz) || sz == 4) return FALSE; break; default: 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"); return FALSE; @@ -1844,8 +1844,8 @@ static int be_arm_adjust_pc_for_break(CONTEXT* ctx, BOOL way) return step; } -static int be_arm_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size, - unsigned is_signed, LONGLONG* ret) +static BOOL be_arm_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size, + BOOL is_signed, LONGLONG* ret) { 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, return TRUE; } -static int be_arm_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, - long double* ret) +static BOOL be_arm_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, + long double* ret) { char tmp[sizeof(long double)]; @@ -1882,8 +1882,8 @@ static int be_arm_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, return TRUE; } -static int be_arm_store_integer(const struct dbg_lvalue* lvalue, unsigned size, - unsigned is_signed, LONGLONG val) +static BOOL be_arm_store_integer(const struct dbg_lvalue* lvalue, unsigned size, + BOOL is_signed, LONGLONG val) { /* this is simple if we're on a little endian CPU */ return memory_write_value(lvalue, size, &val); diff --git a/programs/winedbg/be_arm64.c b/programs/winedbg/be_arm64.c index 433026708c7..8c4b58edcb4 100644 --- a/programs/winedbg/be_arm64.c +++ b/programs/winedbg/be_arm64.c @@ -22,8 +22,8 @@ #if defined(__aarch64__) && !defined(__AARCH64EB__) -static unsigned be_arm64_get_addr(HANDLE hThread, const CONTEXT* ctx, - enum be_cpu_addr bca, ADDRESS64* addr) +static BOOL be_arm64_get_addr(HANDLE hThread, const CONTEXT* ctx, + enum be_cpu_addr bca, ADDRESS64* addr) { switch (bca) { @@ -38,7 +38,7 @@ static unsigned be_arm64_get_addr(HANDLE hThread, const CONTEXT* ctx, 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) { @@ -142,72 +142,72 @@ static struct dbg_internal_var be_arm64_ctx[] = {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"); 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"); 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"); 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; } -static unsigned be_arm64_is_jump(const void* insn, ADDRESS64* jumpee) +static BOOL be_arm64_is_jump(const void* insn, ADDRESS64* jumpee) { return FALSE; } -static unsigned be_arm64_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio, - CONTEXT* ctx, enum be_xpoint_type type, - void* addr, unsigned long* val, unsigned size) +static BOOL be_arm64_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio, + CONTEXT* ctx, enum be_xpoint_type type, + void* addr, unsigned long* val, unsigned size) { SIZE_T sz; switch (type) { case be_xpoint_break: - if (!size) return 0; - if (!pio->read(hProcess, addr, val, 4, &sz) || sz != 4) return 0; + if (!size) return FALSE; + if (!pio->read(hProcess, addr, val, 4, &sz) || sz != 4) return FALSE; default: 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, - CONTEXT* ctx, enum be_xpoint_type type, - void* addr, unsigned long val, unsigned size) +static BOOL be_arm64_remove_Xpoint(HANDLE hProcess, const struct be_process_io* pio, + CONTEXT* ctx, enum be_xpoint_type type, + void* addr, unsigned long val, unsigned size) { SIZE_T sz; switch (type) { case be_xpoint_break: - if (!size) return 0; - if (!pio->write(hProcess, addr, &val, 4, &sz) || sz == 4) return 0; + if (!size) return FALSE; + if (!pio->write(hProcess, addr, &val, 4, &sz) || sz == 4) return FALSE; break; default: 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"); return FALSE; @@ -229,8 +229,8 @@ static int be_arm64_adjust_pc_for_break(CONTEXT* ctx, BOOL way) return 4; } -static int be_arm64_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size, - unsigned is_signed, LONGLONG* ret) +static BOOL be_arm64_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size, + BOOL is_signed, LONGLONG* ret) { 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 return TRUE; } -static int be_arm64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, - long double* ret) +static BOOL be_arm64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, + long double* ret) { char tmp[sizeof(long double)]; @@ -267,8 +267,8 @@ static int be_arm64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, return TRUE; } -static int be_arm64_store_integer(const struct dbg_lvalue* lvalue, unsigned size, - unsigned is_signed, LONGLONG val) +static BOOL be_arm64_store_integer(const struct dbg_lvalue* lvalue, unsigned size, + BOOL is_signed, LONGLONG val) { /* this is simple if we're on a little endian CPU */ return memory_write_value(lvalue, size, &val); diff --git a/programs/winedbg/be_cpu.h b/programs/winedbg/be_cpu.h index 1f0ca2dc7a8..889f638ec00 100644 --- a/programs/winedbg/be_cpu.h +++ b/programs/winedbg/be_cpu.h @@ -37,17 +37,17 @@ struct backend_cpu * in an ADDRESS64 (except an linear one). * 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, unsigned long offset); /* Retrieves in addr an address related to the context (program counter, stack * 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); /* 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 @@ -69,17 +69,17 @@ struct backend_cpu /* Check whether the instruction at addr is an insn to step over * (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 */ - 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, * 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 */ - 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 */ - 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 * will be printed. In all cases, 'addr' is advanced at next instruction */ @@ -88,15 +88,15 @@ struct backend_cpu * break points / watchpoints handling * -------------------------------------------------------------------------------*/ /* 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, void* addr, unsigned long* val, unsigned size); /* 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, void* addr, unsigned long val, unsigned size); /* 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 */ void (*clear_watchpoint)(CONTEXT* ctx, unsigned idx); /* After a break instruction is executed, in the corresponding exception handler, @@ -109,16 +109,16 @@ struct backend_cpu * basic type read/write * -------------------------------------------------------------------------------*/ /* 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 */ - 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 */ - 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; /* some handy functions for non segmented CPUs */ void* be_cpu_linearize(HANDLE hThread, const ADDRESS64*); -unsigned be_cpu_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* addr, - unsigned seg, unsigned long offset); +BOOL be_cpu_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* addr, + unsigned seg, unsigned long offset); diff --git a/programs/winedbg/be_i386.c b/programs/winedbg/be_i386.c index ca1ae5cde93..0aafe6589dc 100644 --- a/programs/winedbg/be_i386.c +++ b/programs/winedbg/be_i386.c @@ -69,8 +69,8 @@ static void* be_i386_linearize(HANDLE hThread, const ADDRESS64* addr) return NULL; } -static unsigned be_i386_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* addr, - unsigned seg, unsigned long offset) +static BOOL be_i386_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* addr, + unsigned seg, unsigned long offset) { addr->Mode = AddrModeFlat; addr->Segment = seg; @@ -95,8 +95,8 @@ static unsigned be_i386_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64 return TRUE; } -static unsigned be_i386_get_addr(HANDLE hThread, const CONTEXT* ctx, - enum be_cpu_addr bca, ADDRESS64* addr) +static BOOL be_i386_get_addr(HANDLE hThread, const CONTEXT* ctx, + enum be_cpu_addr bca, ADDRESS64* addr) { switch (bca) { @@ -110,7 +110,7 @@ static unsigned be_i386_get_addr(HANDLE hThread, const CONTEXT* ctx, 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) { @@ -290,7 +290,7 @@ static struct dbg_internal_var be_i386_ctx[] = {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; @@ -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; @@ -362,7 +362,7 @@ static unsigned be_i386_is_function_return(const void* insn) 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; @@ -402,7 +402,7 @@ static BOOL fetch_value(const char* addr, unsigned sz, int* value) 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; int delta; @@ -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; int delta; @@ -633,9 +633,9 @@ static inline int be_i386_get_unused_DR(CONTEXT* ctx, DWORD** r) return -1; } -static unsigned be_i386_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio, - CONTEXT* ctx, enum be_xpoint_type type, - void* addr, unsigned long* val, unsigned size) +static BOOL be_i386_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio, + CONTEXT* ctx, enum be_xpoint_type type, + void* addr, unsigned long* val, unsigned size) { unsigned char ch; SIZE_T sz; @@ -646,11 +646,11 @@ static unsigned be_i386_insert_Xpoint(HANDLE hProcess, const struct be_process_i switch (type) { case be_xpoint_break: - if (size != 0) return 0; - if (!pio->read(hProcess, addr, &ch, 1, &sz) || sz != 1) return 0; + if (size != 0) return FALSE; + if (!pio->read(hProcess, addr, &ch, 1, &sz) || sz != 1) return FALSE; *val = ch; 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; case be_xpoint_watch_exec: bits = DR7_RW_EXECUTE; @@ -661,14 +661,14 @@ static unsigned be_i386_insert_Xpoint(HANDLE hProcess, const struct be_process_i case be_xpoint_watch_write: bits = DR7_RW_WRITE; 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; if (type != be_xpoint_watch_exec) switch (size) { case 4: bits |= DR7_LEN_4; break; case 2: bits |= DR7_LEN_2; break; case 1: bits |= DR7_LEN_1; break; - default: return 0; + default: return FALSE; } *val = reg; /* clear old values */ @@ -679,14 +679,14 @@ static unsigned be_i386_insert_Xpoint(HANDLE hProcess, const struct be_process_i break; default: 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, - CONTEXT* ctx, enum be_xpoint_type type, - void* addr, unsigned long val, unsigned size) +static BOOL be_i386_remove_Xpoint(HANDLE hProcess, const struct be_process_io* pio, + CONTEXT* ctx, enum be_xpoint_type type, + void* addr, unsigned long val, unsigned size) { SIZE_T sz; unsigned char ch; @@ -694,13 +694,13 @@ static unsigned be_i386_remove_Xpoint(HANDLE hProcess, const struct be_process_i switch (type) { case be_xpoint_break: - if (size != 0) return 0; - if (!pio->read(hProcess, addr, &ch, 1, &sz) || sz != 1) return 0; + if (size != 0) return FALSE; + if (!pio->read(hProcess, addr, &ch, 1, &sz) || sz != 1) return FALSE; if (ch != (unsigned char)0xCC) WINE_FIXME("Cannot get back %02x instead of 0xCC at %08lx\n", ch, (unsigned long)addr); 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; case be_xpoint_watch_exec: case be_xpoint_watch_read: @@ -710,12 +710,12 @@ static unsigned be_i386_remove_Xpoint(HANDLE hProcess, const struct be_process_i break; default: 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); } @@ -736,8 +736,8 @@ static int be_i386_adjust_pc_for_break(CONTEXT* ctx, BOOL way) return 1; } -static int be_i386_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size, - unsigned is_signed, LONGLONG* ret) +static BOOL be_i386_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size, + BOOL is_signed, LONGLONG* ret) { 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, return TRUE; } -static int be_i386_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, - long double* ret) +static BOOL be_i386_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, + long double* ret) { char tmp[sizeof(long double)]; @@ -775,8 +775,8 @@ static int be_i386_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, return TRUE; } -static int be_i386_store_integer(const struct dbg_lvalue* lvalue, unsigned size, - unsigned is_signed, LONGLONG val) +static BOOL be_i386_store_integer(const struct dbg_lvalue* lvalue, unsigned size, + BOOL is_signed, LONGLONG val) { /* this is simple as we're on a little endian CPU */ return memory_write_value(lvalue, size, &val); diff --git a/programs/winedbg/be_ppc.c b/programs/winedbg/be_ppc.c index 0f6115a9924..f1543bf38da 100644 --- a/programs/winedbg/be_ppc.c +++ b/programs/winedbg/be_ppc.c @@ -23,8 +23,8 @@ #if defined(__powerpc__) -static unsigned be_ppc_get_addr(HANDLE hThread, const CONTEXT* ctx, - enum be_cpu_addr bca, ADDRESS64* addr) +static BOOL be_ppc_get_addr(HANDLE hThread, const CONTEXT* ctx, + enum be_cpu_addr bca, ADDRESS64* addr) { switch (bca) { @@ -38,7 +38,7 @@ static unsigned be_ppc_get_addr(HANDLE hThread, const CONTEXT* ctx, 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"); return FALSE; @@ -67,30 +67,30 @@ static struct dbg_internal_var be_ppc_ctx[] = {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"); 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"); 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"); 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; } -static unsigned be_ppc_is_jump(const void* insn, ADDRESS64* jumpee) +static BOOL be_ppc_is_jump(const void* insn, ADDRESS64* jumpee) { return FALSE; } @@ -101,9 +101,9 @@ static void be_ppc_disasm_one_insn(ADDRESS64* addr, int display) dbg_printf("Disasm NIY\n"); } -static unsigned be_ppc_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio, - CONTEXT* ctx, enum be_xpoint_type type, - void* addr, unsigned long* val, unsigned size) +static BOOL be_ppc_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio, + CONTEXT* ctx, enum be_xpoint_type type, + void* addr, unsigned long* val, unsigned size) { unsigned long xbp; SIZE_T sz; @@ -111,38 +111,38 @@ static unsigned be_ppc_insert_Xpoint(HANDLE hProcess, const struct be_process_io switch (type) { case be_xpoint_break: - if (!size) return 0; - if (!pio->read(hProcess, addr, val, 4, &sz) || sz != 4) return 0; + if (!size) return FALSE; + if (!pio->read(hProcess, addr, val, 4, &sz) || sz != 4) return FALSE; 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; default: 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, - CONTEXT* ctx, enum be_xpoint_type type, - void* addr, unsigned long val, unsigned size) +static BOOL be_ppc_remove_Xpoint(HANDLE hProcess, const struct be_process_io* pio, + CONTEXT* ctx, enum be_xpoint_type type, + void* addr, unsigned long val, unsigned size) { SIZE_T sz; switch (type) { case be_xpoint_break: - if (!size) return 0; - if (!pio->write(hProcess, addr, &val, 4, &sz) || sz == 4) return 0; + if (!size) return FALSE; + if (!pio->write(hProcess, addr, &val, 4, &sz) || sz == 4) return FALSE; break; default: 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"); return FALSE; @@ -159,22 +159,22 @@ static int be_ppc_adjust_pc_for_break(CONTEXT* ctx, BOOL way) return 0; } -static int be_ppc_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size, - unsigned is_signed, LONGLONG* ret) +static BOOL be_ppc_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size, + BOOL is_signed, LONGLONG* ret) { dbg_printf("not done\n"); return FALSE; } -static int be_ppc_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, - long double* ret) +static BOOL be_ppc_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, + long double* ret) { dbg_printf("not done\n"); return FALSE; } -static int be_ppc_store_integer(const struct dbg_lvalue* lvalue, unsigned size, - unsigned is_signed, LONGLONG val) +static BOOL be_ppc_store_integer(const struct dbg_lvalue* lvalue, unsigned size, + BOOL is_signed, LONGLONG val) { dbg_printf("be_ppc_store_integer: not done\n"); return FALSE; diff --git a/programs/winedbg/be_x86_64.c b/programs/winedbg/be_x86_64.c index aedf3a38df8..18032d419a8 100644 --- a/programs/winedbg/be_x86_64.c +++ b/programs/winedbg/be_x86_64.c @@ -28,8 +28,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(winedbg); #define STEP_FLAG 0x00000100 /* single step flag */ -static unsigned be_x86_64_get_addr(HANDLE hThread, const CONTEXT* ctx, - enum be_cpu_addr bca, ADDRESS64* addr) +static BOOL be_x86_64_get_addr(HANDLE hThread, const CONTEXT* ctx, + enum be_cpu_addr bca, ADDRESS64* addr) { addr->Mode = AddrModeFlat; switch (bca) @@ -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 :-/ */ switch (regno) @@ -242,7 +242,7 @@ static struct dbg_internal_var be_x86_64_ctx[] = #define f_reg(b) (((b)>>3)&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; @@ -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; @@ -315,7 +315,7 @@ static unsigned be_x86_64_is_function_return(const void* insn) 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; 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) 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; LONG delta; @@ -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; } @@ -496,9 +496,9 @@ static inline int be_x86_64_get_unused_DR(CONTEXT* ctx, DWORD64** r) return -1; } -static unsigned be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio, - CONTEXT* ctx, enum be_xpoint_type type, - void* addr, unsigned long* val, unsigned size) +static BOOL be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio, + CONTEXT* ctx, enum be_xpoint_type type, + void* addr, unsigned long* val, unsigned size) { unsigned char ch; SIZE_T sz; @@ -509,11 +509,11 @@ static unsigned be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process switch (type) { case be_xpoint_break: - if (size != 0) return 0; - if (!pio->read(hProcess, addr, &ch, 1, &sz) || sz != 1) return 0; + if (size != 0) return FALSE; + if (!pio->read(hProcess, addr, &ch, 1, &sz) || sz != 1) return FALSE; *val = ch; 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; case be_xpoint_watch_exec: bits = DR7_RW_EXECUTE; @@ -524,7 +524,7 @@ static unsigned be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process case be_xpoint_watch_write: bits = DR7_RW_WRITE; 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; 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 case 4: bits |= DR7_LEN_4; break; case 2: bits |= DR7_LEN_2; 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; /* clear old values */ @@ -543,14 +543,14 @@ static unsigned be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process break; default: 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, - CONTEXT* ctx, enum be_xpoint_type type, - void* addr, unsigned long val, unsigned size) +static BOOL be_x86_64_remove_Xpoint(HANDLE hProcess, const struct be_process_io* pio, + CONTEXT* ctx, enum be_xpoint_type type, + void* addr, unsigned long val, unsigned size) { SIZE_T sz; unsigned char ch; @@ -558,12 +558,12 @@ static unsigned be_x86_64_remove_Xpoint(HANDLE hProcess, const struct be_process switch (type) { case be_xpoint_break: - if (size != 0) return 0; - if (!pio->read(hProcess, addr, &ch, 1, &sz) || sz != 1) return 0; + if (size != 0) return FALSE; + if (!pio->read(hProcess, addr, &ch, 1, &sz) || sz != 1) return FALSE; if (ch != (unsigned char)0xCC) WINE_FIXME("Cannot get back %02x instead of 0xCC at %p\n", ch, addr); 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; case be_xpoint_watch_exec: case be_xpoint_watch_read: @@ -573,12 +573,12 @@ static unsigned be_x86_64_remove_Xpoint(HANDLE hProcess, const struct be_process break; default: 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); } @@ -599,8 +599,8 @@ static int be_x86_64_adjust_pc_for_break(CONTEXT* ctx, BOOL way) return 1; } -static int be_x86_64_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size, - unsigned is_signed, LONGLONG* ret) +static BOOL be_x86_64_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size, + BOOL is_signed, LONGLONG* ret) { if (size != 1 && size != 2 && size != 4 && size != 8 && size != 16) return FALSE; @@ -620,8 +620,8 @@ static int be_x86_64_fetch_integer(const struct dbg_lvalue* lvalue, unsigned siz return TRUE; } -static int be_x86_64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, - long double* ret) +static BOOL be_x86_64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, + long double* ret) { char tmp[sizeof(long double)]; @@ -639,8 +639,8 @@ static int be_x86_64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, return TRUE; } -static int be_x86_64_store_integer(const struct dbg_lvalue* lvalue, unsigned size, - unsigned is_signed, LONGLONG val) +static BOOL be_x86_64_store_integer(const struct dbg_lvalue* lvalue, unsigned size, + BOOL is_signed, LONGLONG val) { /* this is simple as we're on a little endian CPU */ return memory_write_value(lvalue, size, &val); diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c index cfbf1612c5e..af99229f775 100644 --- a/programs/winedbg/memory.c +++ b/programs/winedbg/memory.c @@ -39,8 +39,8 @@ void* be_cpu_linearize(HANDLE hThread, const ADDRESS64* addr) return (void*)(DWORD_PTR)addr->Offset; } -unsigned be_cpu_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* addr, - unsigned seg, unsigned long offset) +BOOL be_cpu_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* addr, + unsigned seg, unsigned long offset) { addr->Mode = AddrModeFlat; addr->Segment = 0; /* don't need segment */