Package: user-mode-linux
Version: 3.2-1um-1
Severity: normal
Tags: patch

Hi!

Using gdbserver  inside an UML  instance displays "Couldn't  write debug
register". I have discovered this  patch from Barry Friedman which works
fine for me:
 
http://www.mail-archive.com/user-mode-linux-devel@lists.sourceforge.net/msg06753.html

I also attach a version rebased for Linux 3.2.

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (101, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages user-mode-linux depends on:
ii  libc6          2.13-33
ii  uml-utilities  20070815-1.3

user-mode-linux recommends no packages.

Versions of packages user-mode-linux suggests:
ii  rootstrap                           0.3.24-6.1
ii  rxvt-unicode [x-terminal-emulator]  9.15-1
ii  slirp                               <none>
ii  terminator [x-terminal-emulator]    0.95-1
ii  user-mode-linux-doc                 20060501-1
ii  vde2                                2.3.2-4
ii  xterm [x-terminal-emulator]         278-1

-- no debconf information
diff --git a/arch/x86/um/ptrace_64.c b/arch/x86/um/ptrace_64.c
index 3b52bf0..583070c 100644
--- a/arch/x86/um/ptrace_64.c
+++ b/arch/x86/um/ptrace_64.c
@@ -120,7 +120,7 @@ int poke_user(struct task_struct *child, long addr, long data)
 	else if ((addr >= offsetof(struct user, u_debugreg[0])) &&
 		(addr <= offsetof(struct user, u_debugreg[7]))) {
 		addr -= offsetof(struct user, u_debugreg[0]);
-		addr = addr >> 2;
+		addr = addr >> 3;
 		if ((addr == 4) || (addr == 5))
 			return -EIO;
 		child->thread.arch.debugregs[addr] = data;
@@ -187,7 +187,7 @@ int peek_user(struct task_struct *child, long addr, long data)
 	else if ((addr >= offsetof(struct user, u_debugreg[0])) &&
 		(addr <= offsetof(struct user, u_debugreg[7]))) {
 		addr -= offsetof(struct user, u_debugreg[0]);
-		addr = addr >> 2;
+		addr = addr >> 3;
 		tmp = child->thread.arch.debugregs[addr];
 	}
 	return put_user(tmp, (unsigned long *) data);

Reply via email to