1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
--- gdb/amd64bsd-nat.c.orig 2013-04-09 16:45:15.000000000 +0200
+++ gdb/amd64bsd-nat.c 2013-04-09 18:53:22.000000000 +0200
@@ -29,6 +29,7 @@
#include <sys/types.h>
#include <sys/ptrace.h>
#include <machine/reg.h>
+#include <machine/psl.h>
#include "amd64-tdep.h"
#include "amd64-nat.h"
@@ -81,14 +82,24 @@
if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum))
{
- struct reg regs;
+ struct reg regs, oldregs;
+ memset( ®s, 0, sizeof(struct reg));
+ memset( &oldregs, 0, sizeof(struct reg));
if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't get registers"));
+ ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
+ (PTRACE_TYPE_ARG3) &oldregs, 0);
amd64_collect_native_gregset (regcache, ®s, regnum);
+ if( (regs.r_rflags ^ oldregs.r_rflags ) & ~PSL_USERCHANGE) {
+ //printf("regs.r_rflags = 0x%8.8lX\n", regs.r_rflags );
+ //printf("oldregs.r_rflags = 0x%8.8lX\n", oldregs.r_rflags );
+ regs.r_rflags ^= (regs.r_rflags ^ oldregs.r_rflags ) & ~PSL_USERCHANGE;
+ //printf(" allowed regs.r_rflags = 0x%8.8X\n", regs.r_rflags );
+ }
if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
(PTRACE_TYPE_ARG3) ®s, 0) == -1)
perror_with_name (_("Couldn't write registers"));
|