rpm -q --qf '%{name}-%{version}-%{release}.%{arch} ' gdb glibc gcc; uname -r gdb-6.5-8.fc6.x86_64 glibc-2.4.90-33.x86_64 glibc-2.4.90-33.i686 gcc-4.1.1-23.x86_64 2.6.17-1.2647.fc6 cat a.c long i; int main (void) { ++i; return i - 1; } cat .gdbinit watch i run cont quit gcc -g -o a1 a.c gcc -g -o a2 a.c -Dlong=int gdb ./a1 gdb ./a2 Apparently gdb can watch 32-bit objects, but can't watch 64-bit objects. Strace of gdb ./a1 shows (0x600800 is &i): ... ptrace(PTRACE_PEEKTEXT, 2301, 0x600800, [0]) = 0 ptrace(PTRACE_PEEKTEXT, 2301, 0x2aaaaaaabb50, [0x528e8e78948]) = 0 ptrace(PTRACE_PEEKTEXT, 2301, 0x2aaaaaaabb58, [0x21922b058bc48949]) = 0 ptrace(PTRACE_PEEKTEXT, 2301, 0x600800, [0]) = 0 ptrace(PTRACE_POKEUSER, 2301, offsetof(struct user, u_debugreg), 0x600800) = 0 ptrace(PTRACE_POKEUSER, 2301, offsetof(struct user, u_debugreg) + 56, 0x90101) = -1 EIO (Input/output error) Strace of gdb ./a2 shows (0x6007fc is &i): ptrace(PTRACE_PEEKTEXT, 2296, 0x6007f8, [0]) = 0 ptrace(PTRACE_PEEKTEXT, 2296, 0x2aaaaaaabb50, [0x528e8e78948]) = 0 ptrace(PTRACE_PEEKTEXT, 2296, 0x2aaaaaaabb58, [0x21922b058bc48949]) = 0 ptrace(PTRACE_PEEKTEXT, 2296, 0x6007f8, [0]) = 0 ptrace(PTRACE_POKEUSER, 2296, offsetof(struct user, u_debugreg), 0x6007fc) = 0 ptrace(PTRACE_POKEUSER, 2296, offsetof(struct user, u_debugreg) + 56, 0xd0101) = 0 ptrace(PTRACE_PEEKUSER, 2296, offsetof(struct user, u_debugreg), [0x6007fc]) = 0 ptrace(PTRACE_PEEKUSER, 2296, offsetof(struct user, u_debugreg) + 8, [0]) = 0 ptrace(PTRACE_PEEKUSER, 2296, offsetof(struct user, u_debugreg) + 16, [0]) = 0 ptrace(PTRACE_PEEKUSER, 2296, offsetof(struct user, u_debugreg) + 24, [0]) = 0 ptrace(PTRACE_PEEKUSER, 2296, offsetof(struct user, u_debugreg) + 56, [0xd0101]) = 0 I certainly don't remember any issues with this on FC5, is that related to utrace?
Created attachment 136860 [details] utrace fix, typo-like fix There is just a wrong constant, fixed to the one described in the comment there and referenced to come from AMD x86_64 manual.
Actually it should be 0x5554, see http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=893efca9279d7a78bae6532de0524e53370819d5 (which was for whatever reason not applied to arch/x86_64/ia32/ptrace32.c). Also, the comments explaining this in i386 ptrace.c is very confusing, writing binary 10 as 0x10 rather than either 10 or 2 means the comment is really hard to understand.
Created attachment 136892 [details] Updated fix, cryptocode sanitized; upon Jakub's advice
Well, I think the current code (with the right 0x5554 constant) is ok, only the comment could be made more readable. This isn't something that is changed every day and the code with mask is definitely shorter.
Created attachment 136900 [details] linux-2.6.18-utrace-x86-64-watchpoint.patch My proposed patch.
please send the comment change upstream; that comment is copied verbatim from pre-utrace code
committed utrace fix, pls rebuild and push to fc6/rhel