Commit f16f847c authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winedbg: Cleanup the process_io usage.

- made be_process_io references 'const' - make use of it for dbg_read_memory and dbg_write_memory
parent 829e002c
...@@ -82,7 +82,7 @@ static void be_alpha_disasm_one_insn(ADDRESS* addr, int display) ...@@ -82,7 +82,7 @@ static void be_alpha_disasm_one_insn(ADDRESS* addr, int display)
dbg_printf("Disasm NIY\n"); dbg_printf("Disasm NIY\n");
} }
static unsigned be_alpha_insert_Xpoint(HANDLE hProcess, struct be_process_io* pio, static unsigned be_alpha_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)
{ {
...@@ -104,9 +104,9 @@ static unsigned be_alpha_insert_Xpoint(HANDLE hProcess, struct be_process_io* pi ...@@ -104,9 +104,9 @@ static unsigned be_alpha_insert_Xpoint(HANDLE hProcess, struct be_process_io* pi
return 1; return 1;
} }
static unsigned be_alpha_remove_Xpoint(HANDLE hProcess, CONTEXT* ctx, static unsigned be_alpha_remove_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
enum be_xpoint_type type, void* addr, CONTEXT* ctx, enum be_xpoint_type type,
unsigned long val, unsigned size) void* addr, unsigned long val, unsigned size)
{ {
dbg_printf("not done\n"); dbg_printf("not done\n");
return FALSE; return FALSE;
......
...@@ -82,11 +82,11 @@ struct backend_cpu ...@@ -82,11 +82,11 @@ 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, struct be_process_io* pio, unsigned (*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, struct be_process_io* pio, unsigned (*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 */
......
...@@ -392,7 +392,7 @@ static inline int be_i386_get_unused_DR(CONTEXT* ctx, unsigned long** r) ...@@ -392,7 +392,7 @@ static inline int be_i386_get_unused_DR(CONTEXT* ctx, unsigned long** r)
return -1; return -1;
} }
static unsigned be_i386_insert_Xpoint(HANDLE hProcess, struct be_process_io* pio, static unsigned 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)
{ {
...@@ -443,7 +443,7 @@ static unsigned be_i386_insert_Xpoint(HANDLE hProcess, struct be_process_io* pio ...@@ -443,7 +443,7 @@ static unsigned be_i386_insert_Xpoint(HANDLE hProcess, struct be_process_io* pio
return 1; return 1;
} }
static unsigned be_i386_remove_Xpoint(HANDLE hProcess, struct be_process_io* pio, static unsigned 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)
{ {
......
...@@ -95,7 +95,7 @@ static void be_ppc_disasm_one_insn(ADDRESS* addr, int display) ...@@ -95,7 +95,7 @@ static void be_ppc_disasm_one_insn(ADDRESS* addr, int display)
dbg_printf("Disasm NIY\n"); dbg_printf("Disasm NIY\n");
} }
static unsigned be_ppc_insert_Xpoint(HANDLE hProcess, struct be_process_io* pio, static unsigned 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)
{ {
...@@ -117,7 +117,7 @@ static unsigned be_ppc_insert_Xpoint(HANDLE hProcess, struct be_process_io* pio, ...@@ -117,7 +117,7 @@ static unsigned be_ppc_insert_Xpoint(HANDLE hProcess, struct be_process_io* pio,
return 1; return 1;
} }
static unsigned be_ppc_remove_Xpoint(HANDLE hProcess, struct be_process_io* pio, static unsigned 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)
{ {
......
...@@ -201,7 +201,7 @@ struct dbg_process ...@@ -201,7 +201,7 @@ struct dbg_process
{ {
HANDLE handle; HANDLE handle;
DWORD pid; DWORD pid;
struct be_process_io* process_io; const struct be_process_io* process_io;
const char* imageName; const char* imageName;
struct dbg_thread* threads; struct dbg_thread* threads;
unsigned continue_on_first_exception; unsigned continue_on_first_exception;
...@@ -417,13 +417,13 @@ extern BOOL gdb_remote(unsigned int); ...@@ -417,13 +417,13 @@ extern BOOL gdb_remote(unsigned int);
static inline BOOL dbg_read_memory(const void* addr, void* buffer, size_t len) static inline BOOL dbg_read_memory(const void* addr, void* buffer, size_t len)
{ {
DWORD rlen; DWORD rlen;
return ReadProcessMemory(dbg_curr_process->handle, addr, buffer, len, &rlen) && len == rlen; return dbg_curr_process->process_io->read(dbg_curr_process->handle, addr, buffer, len, &rlen) && len == rlen;
} }
static inline BOOL dbg_write_memory(void* addr, const void* buffer, size_t len) static inline BOOL dbg_write_memory(void* addr, const void* buffer, size_t len)
{ {
DWORD wlen; DWORD wlen;
return WriteProcessMemory(dbg_curr_process->handle, addr, buffer, len, &wlen) && len == wlen; return dbg_curr_process->process_io->write(dbg_curr_process->handle, addr, buffer, len, &wlen) && len == wlen;
} }
static inline void* dbg_heap_realloc(void* buffer, size_t size) static inline void* dbg_heap_realloc(void* buffer, size_t size)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment