OLD | NEW |
1 /* Native-dependent code for GNU/Linux x86-64. | 1 /* Native-dependent code for GNU/Linux x86-64. |
2 | 2 |
3 Copyright (C) 2001-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2001-2012 Free Software Foundation, Inc. |
4 Contributed by Jiri Smid, SuSE Labs. | 4 Contributed by Jiri Smid, SuSE Labs. |
5 | 5 |
6 This file is part of GDB. | 6 This file is part of GDB. |
7 | 7 |
8 This program is free software; you can redistribute it and/or modify | 8 This program is free software; you can redistribute it and/or modify |
9 it under the terms of the GNU General Public License as published by | 9 it under the terms of the GNU General Public License as published by |
10 the Free Software Foundation; either version 3 of the License, or | 10 the Free Software Foundation; either version 3 of the License, or |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "amd64-linux-tdep.h" | 27 #include "amd64-linux-tdep.h" |
28 | 28 |
29 #include "gdb_assert.h" | 29 #include "gdb_assert.h" |
30 #include "gdb_string.h" | 30 #include "gdb_string.h" |
31 #include "elf/common.h" | 31 #include "elf/common.h" |
32 #include <sys/uio.h> | 32 #include <sys/uio.h> |
33 #include <sys/ptrace.h> | 33 #include <sys/ptrace.h> |
34 #include <sys/debugreg.h> | 34 #include <sys/debugreg.h> |
35 #include <sys/syscall.h> | 35 #include <sys/syscall.h> |
36 #include <sys/procfs.h> | 36 #include <sys/procfs.h> |
| 37 #include <sys/user.h> |
37 #include <asm/prctl.h> | 38 #include <asm/prctl.h> |
38 /* FIXME ezannoni-2003-07-09: we need <sys/reg.h> to be included after | 39 /* FIXME ezannoni-2003-07-09: we need <sys/reg.h> to be included after |
39 <asm/ptrace.h> because the latter redefines FS and GS for no apparent | 40 <asm/ptrace.h> because the latter redefines FS and GS for no apparent |
40 reason, and those definitions don't match the ones that libpthread_db | 41 reason, and those definitions don't match the ones that libpthread_db |
41 uses, which come from <sys/reg.h>. */ | 42 uses, which come from <sys/reg.h>. */ |
42 /* ezannoni-2003-07-09: I think this is fixed. The extraneous defs have | 43 /* ezannoni-2003-07-09: I think this is fixed. The extraneous defs have |
43 been removed from ptrace.h in the kernel. However, better safe than | 44 been removed from ptrace.h in the kernel. However, better safe than |
44 sorry. */ | 45 sorry. */ |
45 #include <asm/ptrace.h> | 46 #include <asm/ptrace.h> |
46 #include <sys/reg.h> | 47 #include <sys/reg.h> |
47 #include "gdb_proc_service.h" | 48 #include "gdb_proc_service.h" |
48 | 49 |
49 /* Prototypes for supply_gregset etc. */ | 50 /* Prototypes for supply_gregset etc. */ |
50 #include "gregset.h" | 51 #include "gregset.h" |
51 | 52 |
52 #include "amd64-tdep.h" | 53 #include "amd64-tdep.h" |
53 #include "i386-linux-tdep.h" | 54 #include "i386-linux-tdep.h" |
54 #include "amd64-nat.h" | 55 #include "amd64-nat.h" |
55 #include "i386-nat.h" | 56 #include "i386-nat.h" |
56 #include "i386-xstate.h" | 57 #include "i386-xstate.h" |
57 | 58 |
58 #ifndef PTRACE_GETREGSET | 59 #ifndef PTRACE_GETREGSET |
59 #define PTRACE_GETREGSET 0x4204 | 60 #define PTRACE_GETREGSET 0x4204 |
60 #endif | 61 #endif |
61 | 62 |
62 #ifndef PTRACE_SETREGSET | 63 #ifndef PTRACE_SETREGSET |
63 #define PTRACE_SETREGSET 0x4205 | 64 #define PTRACE_SETREGSET 0x4205 |
64 #endif | 65 #endif |
65 | 66 |
| 67 /* Per-thread arch-specific data we want to keep. */ |
| 68 |
| 69 struct arch_lwp_info |
| 70 { |
| 71 /* Non-zero if our copy differs from what's recorded in the thread. */ |
| 72 int debug_registers_changed; |
| 73 }; |
| 74 |
66 /* Does the current host support PTRACE_GETREGSET? */ | 75 /* Does the current host support PTRACE_GETREGSET? */ |
67 static int have_ptrace_getregset = -1; | 76 static int have_ptrace_getregset = -1; |
68 | 77 |
69 /* Mapping between the general-purpose registers in GNU/Linux x86-64 | 78 /* Mapping between the general-purpose registers in GNU/Linux x86-64 |
70 `struct user' format and GDB's register cache layout for GNU/Linux | 79 `struct user' format and GDB's register cache layout for GNU/Linux |
71 i386. | 80 i386. |
72 | 81 |
73 Note that most GNU/Linux x86-64 registers are 64-bit, while the | 82 Note that most GNU/Linux x86-64 registers are 64-bit, while the |
74 GNU/Linux i386 registers are all 32-bit, but since we're | 83 GNU/Linux i386 registers are all 32-bit, but since we're |
75 little-endian we get away with that. */ | 84 little-endian we get away with that. */ |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 else | 263 else |
255 { | 264 { |
256 if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0) | 265 if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0) |
257 perror_with_name (_("Couldn't get floating point status")); | 266 perror_with_name (_("Couldn't get floating point status")); |
258 | 267 |
259 amd64_collect_fxsave (regcache, regnum, &fpregs); | 268 amd64_collect_fxsave (regcache, regnum, &fpregs); |
260 | 269 |
261 if (ptrace (PTRACE_SETFPREGS, tid, 0, (long) &fpregs) < 0) | 270 if (ptrace (PTRACE_SETFPREGS, tid, 0, (long) &fpregs) < 0) |
262 perror_with_name (_("Couldn't write floating point status")); | 271 perror_with_name (_("Couldn't write floating point status")); |
263 } | 272 } |
error: old chunk mismatch |
None
OLD | NEW |