diff options
Diffstat (limited to 'overlay/mgdb')
-rw-r--r-- | overlay/mgdb/gdb/amd64-winnt-regcache.c | 39 | ||||
-rw-r--r-- | overlay/mgdb/gdb/i386-winnt-regcache.c | 10 | ||||
-rw-r--r-- | overlay/mgdb/gdb/winnt-nat.c | 19 | ||||
-rw-r--r-- | overlay/mgdb/gdb/winnt-nat.h | 8 |
4 files changed, 73 insertions, 3 deletions
diff --git a/overlay/mgdb/gdb/amd64-winnt-regcache.c b/overlay/mgdb/gdb/amd64-winnt-regcache.c index 7a1dab6..86a4b28 100644 --- a/overlay/mgdb/gdb/amd64-winnt-regcache.c +++ b/overlay/mgdb/gdb/amd64-winnt-regcache.c @@ -13,6 +13,8 @@ #include <signal.h> #include <sys/debug.h> +#define AMD64_KNOWN_REG_CAP AMD64_MXCSR_REGNUM + struct regcache; static unsigned regoffs[AMD64_NUM_REGS]; @@ -87,6 +89,43 @@ void amd64_winnt_fetch_registers( regctx->uc_context_flags = WINNT_THREAD_CONTEXT_READY; } +void amd64_winnt_store_registers( + const struct regcache * rcache, + int regnum, + struct winnt_thread * thread) +{ + int pfd; + pid_t tid; + int rmin; + int rmax; + char * mark; + mcontext_t * regctx; + + if (regnum > AMD64_KNOWN_REG_CAP) + return; + + if (regnum < 0) { + rmin = 0; + rmax = AMD64_KNOWN_REG_CAP; + } else { + rmin = regnum; + rmax = regnum; + } + + pfd = thread->process->pfd; + tid = thread->tid; + regctx = &thread->regctx; + mark = (char *)regctx; + + for (regnum=rmin; regnum<=rmax; regnum++) + regcache_raw_collect( + rcache,regnum, + mark + regoffs[regnum]); + + if (!__dbg_regs_store(pfd,tid,regctx)) + regctx->uc_context_flags = WINNT_THREAD_CONTEXT_READY; +} + #define AMD64_WINNT_INIT_REG_OFFSET(regnum,regmem) \ regoffs[regnum] = offsetof(mcontext_t,regmem) diff --git a/overlay/mgdb/gdb/i386-winnt-regcache.c b/overlay/mgdb/gdb/i386-winnt-regcache.c index 7941fd3..d3745a1 100644 --- a/overlay/mgdb/gdb/i386-winnt-regcache.c +++ b/overlay/mgdb/gdb/i386-winnt-regcache.c @@ -20,3 +20,13 @@ void i386_winnt_fetch_registers( (void)regnum; (void)thread; } + +void i386_winnt_store_registers( + const struct regcache * rcache, + int regnum, + struct winnt_thread * thread) +{ + (void)rcache; + (void)regnum; + (void)thread; +} diff --git a/overlay/mgdb/gdb/winnt-nat.c b/overlay/mgdb/gdb/winnt-nat.c index 5ce4a4c..a52ce8e 100644 --- a/overlay/mgdb/gdb/winnt-nat.c +++ b/overlay/mgdb/gdb/winnt-nat.c @@ -678,9 +678,22 @@ static void winnt_store_registers ( struct regcache * rcache, int regnum) { - (void)t; - (void)rcache; - (void)regnum; + pid_t tid; + struct winnt_thread * thread; + + tid = inferior_ptid.tid; + + if (!(thread = winnt_get_thread_from_ptid(inferior_ptid))) + winnt_perror("internal error: thread record not found",tid); + + if (sizeof(uintptr_t) == 8) + amd64_winnt_store_registers( + rcache,regnum, + thread); + else + i386_winnt_store_registers( + rcache,regnum, + thread); } static void winnt_attach (struct target_ops * t, const char * args, int from_tty) diff --git a/overlay/mgdb/gdb/winnt-nat.h b/overlay/mgdb/gdb/winnt-nat.h index c99d3f4..473c2a9 100644 --- a/overlay/mgdb/gdb/winnt-nat.h +++ b/overlay/mgdb/gdb/winnt-nat.h @@ -50,8 +50,16 @@ void amd64_winnt_fetch_registers( struct regcache *, int regnum, struct winnt_thread *); +void amd64_winnt_store_registers( + const struct regcache *, int regnum, + struct winnt_thread *); + void i386_winnt_fetch_registers( struct regcache *, int regnum, struct winnt_thread *); +void i386_winnt_store_registers( + const struct regcache *, int regnum, + struct winnt_thread *); + #endif |