winedbg: process_io

- added ability to specify process_io at process creation/attachment
  time
- created a process_io structure for gdbproxy
oldstable
Eric Pouech 2006-03-01 21:05:31 +01:00 committed by Alexandre Julliard
parent f29d084c37
commit c918e80ed2
4 changed files with 20 additions and 12 deletions

View File

@ -375,6 +375,7 @@ extern void dbg_wait_next_exception(DWORD cont, int count, int mode)
extern enum dbg_start dbg_active_attach(int argc, char* argv[]);
extern enum dbg_start dbg_active_launch(int argc, char* argv[]);
extern enum dbg_start dbg_active_auto(int argc, char* argv[]);
extern BOOL dbg_attach_debuggee(DWORD pid, BOOL cofe, BOOL wfe);
/* tgt_minidump.c */
extern void minidump_write(const char*, const EXCEPTION_RECORD*);
@ -401,9 +402,8 @@ extern int dbg_printf(const char* format, ...) __attribute__((format (pr
extern int dbg_printf(const char* format, ...);
#endif
extern const struct dbg_internal_var* dbg_get_internal_var(const char*);
extern BOOL dbg_attach_debuggee(DWORD pid, BOOL cofe, BOOL wfe);
extern BOOL dbg_interrupt_debuggee(void);
extern struct dbg_process* dbg_add_process(DWORD pid, HANDLE h);
extern struct dbg_process* dbg_add_process(const struct be_process_io* pio, DWORD pid, HANDLE h);
extern void dbg_set_process_name(struct dbg_process* p, const char* name);
extern struct dbg_process* dbg_get_process(DWORD pid);
extern void dbg_del_process(struct dbg_process* p);

View File

@ -102,6 +102,8 @@ struct gdb_context
unsigned long wine_segs[3]; /* load addresses of the ELF wine exec segments (text, bss and data) */
};
static struct be_process_io be_process_gdbproxy_io;
/* =============================================== *
* B A S I C M A N I P U L A T I O N S *
* =============================================== *
@ -444,7 +446,7 @@ static void handle_debug_event(struct gdb_context* gdbctx, DEBUG_EVENT* de)
switch (de->dwDebugEventCode)
{
case CREATE_PROCESS_DEBUG_EVENT:
gdbctx->process = dbg_add_process(de->dwProcessId,
gdbctx->process = dbg_add_process(&be_process_gdbproxy_io, de->dwProcessId,
de->u.CreateProcessInfo.hProcess);
if (!gdbctx->process) break;
memory_get_string_indirect(gdbctx->process,
@ -2278,3 +2280,10 @@ int gdb_main(int argc, char* argv[])
return gdb_remote(gdb_flags);
return -1;
}
static struct be_process_io be_process_gdbproxy_io =
{
NULL, /* we shouldn't use close_process() in gdbproxy */
ReadProcessMemory,
WriteProcessMemory
};

View File

@ -33,6 +33,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
static char* dbg_last_cmd_line;
static struct be_process_io be_process_active_io;
static void dbg_init_current_process(void)
{
@ -72,7 +73,7 @@ BOOL dbg_attach_debuggee(DWORD pid, BOOL cofe, BOOL wfe)
{
DEBUG_EVENT de;
if (!(dbg_curr_process = dbg_add_process(pid, 0))) return FALSE;
if (!(dbg_curr_process = dbg_add_process(&be_process_active_io, pid, 0))) return FALSE;
if (!DebugActiveProcess(pid))
{
@ -436,7 +437,7 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de)
break;
case CREATE_PROCESS_DEBUG_EVENT:
dbg_curr_process = dbg_add_process(de->dwProcessId,
dbg_curr_process = dbg_add_process(&be_process_active_io, de->dwProcessId,
de->u.CreateProcessInfo.hProcess);
if (dbg_curr_process == NULL)
{
@ -698,7 +699,7 @@ static unsigned dbg_start_debuggee(LPSTR cmdLine)
return TRUE;
}
dbg_curr_pid = info.dwProcessId;
if (!(dbg_curr_process = dbg_add_process(dbg_curr_pid, 0))) return FALSE;
if (!(dbg_curr_process = dbg_add_process(&be_process_active_io, dbg_curr_pid, 0))) return FALSE;
dbg_wait_for_first_exception();
return TRUE;
@ -920,7 +921,7 @@ static BOOL tgt_process_active_close_process(struct dbg_process* pcs, BOOL kill)
return TRUE;
}
struct be_process_io be_process_active_io =
static struct be_process_io be_process_active_io =
{
tgt_process_active_close_process,
ReadProcessMemory,

View File

@ -250,11 +250,8 @@ struct dbg_process* dbg_get_process(DWORD pid)
return p;
}
struct dbg_process* dbg_add_process(DWORD pid, HANDLE h)
struct dbg_process* dbg_add_process(const struct be_process_io* pio, DWORD pid, HANDLE h)
{
/* FIXME: temporary */
extern struct be_process_io be_process_active_io;
struct dbg_process* p;
if ((p = dbg_get_process(pid)))
@ -266,6 +263,7 @@ struct dbg_process* dbg_add_process(DWORD pid, HANDLE h)
else
{
p->handle = h;
p->process_io = pio;
p->imageName = NULL;
}
return p;
@ -274,7 +272,7 @@ struct dbg_process* dbg_add_process(DWORD pid, HANDLE h)
if (!(p = HeapAlloc(GetProcessHeap(), 0, sizeof(struct dbg_process)))) return NULL;
p->handle = h;
p->pid = pid;
p->process_io = &be_process_active_io;
p->process_io = pio;
p->imageName = NULL;
p->threads = NULL;
p->continue_on_first_exception = FALSE;