winedbg: Cleanup the process_io usage.
- made be_process_io references 'const'
- make use of it for dbg_read_memory and dbg_write_memory
diff --git a/programs/winedbg/be_alpha.c b/programs/winedbg/be_alpha.c
index 98bbe9a..221fd46 100644
--- a/programs/winedbg/be_alpha.c
+++ b/programs/winedbg/be_alpha.c
@@ -82,7 +82,7 @@
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,
void* addr, unsigned long* val, unsigned size)
{
@@ -104,9 +104,9 @@
return 1;
}
-static unsigned be_alpha_remove_Xpoint(HANDLE hProcess, CONTEXT* ctx,
- enum be_xpoint_type type, void* addr,
- unsigned long val, unsigned size)
+static unsigned be_alpha_remove_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
+ CONTEXT* ctx, enum be_xpoint_type type,
+ void* addr, unsigned long val, unsigned size)
{
dbg_printf("not done\n");
return FALSE;
diff --git a/programs/winedbg/be_cpu.h b/programs/winedbg/be_cpu.h
index d776cf1..988a147 100644
--- a/programs/winedbg/be_cpu.h
+++ b/programs/winedbg/be_cpu.h
@@ -82,11 +82,11 @@
* break points / watchpoints handling
* -------------------------------------------------------------------------------*/
/* 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,
void* addr, unsigned long* val, unsigned size);
/* 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,
void* addr, unsigned long val, unsigned size);
/* Checks whether a given watchpoint has been triggered */
diff --git a/programs/winedbg/be_i386.c b/programs/winedbg/be_i386.c
index f1ee7be..1dc001d 100644
--- a/programs/winedbg/be_i386.c
+++ b/programs/winedbg/be_i386.c
@@ -392,7 +392,7 @@
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,
void* addr, unsigned long* val, unsigned size)
{
@@ -443,7 +443,7 @@
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,
void* addr, unsigned long val, unsigned size)
{
diff --git a/programs/winedbg/be_ppc.c b/programs/winedbg/be_ppc.c
index e943dfa..2ea7164 100644
--- a/programs/winedbg/be_ppc.c
+++ b/programs/winedbg/be_ppc.c
@@ -95,7 +95,7 @@
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,
void* addr, unsigned long* val, unsigned size)
{
@@ -117,7 +117,7 @@
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,
void* addr, unsigned long val, unsigned size)
{
diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h
index 3c4acbf..97ad754 100644
--- a/programs/winedbg/debugger.h
+++ b/programs/winedbg/debugger.h
@@ -201,7 +201,7 @@
{
HANDLE handle;
DWORD pid;
- struct be_process_io* process_io;
+ const struct be_process_io* process_io;
const char* imageName;
struct dbg_thread* threads;
unsigned continue_on_first_exception;
@@ -417,13 +417,13 @@
static inline BOOL dbg_read_memory(const void* addr, void* buffer, size_t len)
{
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)
{
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)