diff options
author | midipix <writeonce@midipix.org> | 2019-09-15 19:12:33 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2019-09-16 07:07:34 +0000 |
commit | 0354669846be9be0d0353a6aa83297a1021c910d (patch) | |
tree | 0ed25c575bc3f8cf24cb4722565cf03d293ed5d4 /overlay/mgdb/gdb/amd64-winnt-regcache.c | |
parent | b3b28e32623963e72eee2849dca3b57b0cc215f8 (diff) | |
download | chainport-0354669846be9be0d0353a6aa83297a1021c910d.tar.bz2 chainport-0354669846be9be0d0353a6aa83297a1021c910d.tar.xz |
mgdb: struct winnt_thread and friends: initial implementation and integration.
Diffstat (limited to 'overlay/mgdb/gdb/amd64-winnt-regcache.c')
-rw-r--r-- | overlay/mgdb/gdb/amd64-winnt-regcache.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/overlay/mgdb/gdb/amd64-winnt-regcache.c b/overlay/mgdb/gdb/amd64-winnt-regcache.c index 83a836c..7a1dab6 100644 --- a/overlay/mgdb/gdb/amd64-winnt-regcache.c +++ b/overlay/mgdb/gdb/amd64-winnt-regcache.c @@ -8,6 +8,7 @@ #include "osabi.h" #include "regcache.h" #include "amd64-tdep.h" +#include "winnt-nat.h" #include <signal.h> #include <sys/debug.h> @@ -61,23 +62,29 @@ static void amd64_winnt_supply_core_regs( amd64_winnt_supply_reg(rcache,AMD64_EFLAGS_REGNUM,regctx->uc_eflags); } -int amd64_winnt_fetch_registers( - int pfd, struct regcache * rcache, - int regnum, pid_t tid) +void amd64_winnt_fetch_registers( + struct regcache * rcache, int regnum, + struct winnt_thread * thread) { - int ret; - mcontext_t regctx; + int pfd; + pid_t tid; + mcontext_t * regctx; - if ((ret = __dbg_regs_fetch(pfd,tid,®ctx)) < 0) - return ret; + pfd = thread->process->pfd; + tid = thread->tid; + regctx = &thread->regctx; + + if (thread->regctx.uc_context_flags) + if (__dbg_regs_fetch(pfd,tid,regctx) < 0) + return; if (regnum == AMD64_RIP_REGNUM) { - amd64_winnt_supply_pc_regs(rcache,®ctx); + amd64_winnt_supply_pc_regs(rcache,regctx); } else { - amd64_winnt_supply_core_regs(rcache,®ctx); + amd64_winnt_supply_core_regs(rcache,regctx); } - return 0; + regctx->uc_context_flags = WINNT_THREAD_CONTEXT_READY; } #define AMD64_WINNT_INIT_REG_OFFSET(regnum,regmem) \ |