public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Andi Kleen <ak@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: Fix 32-bit thread debugging on x86_64
Date: Sun, 31 Jul 2005 16:05:58 -0400	[thread overview]
Message-ID: <20050731200557.GA4156@nevyn.them.org> (raw)

The IA32 ptrace emulation currently returns the wrong registers for
fs/gs; it's returning what x86_64 calls gs_base.  We need regs.gsindex
in order for GDB to correctly locate the TLS area.  Without this patch,
the 32-bit GDB testsuite bombs on a 64-bit kernel.  With it, results
look about like I'd expect, although there are still a handful of
kernel-related failures (vsyscall related?).

Signed-off-by: Daniel Jacobowitz <dan@codesourcery.com>

diff -r -p -u z/linux-2.6.11/arch/x86_64/ia32/ptrace32.c linux-2.6.11/arch/x86_64/ia32/ptrace32.c
--- linux-2.6.12.3.orig/arch/x86_64/ia32/ptrace32.c	2005-03-02 02:37:52.000000000 -0500
+++ linux-2.6.12.3/arch/x86_64/ia32/ptrace32.c	2005-07-31 15:29:48.000000000 -0400
@@ -43,11 +43,11 @@ static int putreg32(struct task_struct *
 	switch (regno) {
 	case offsetof(struct user32, regs.fs):
 		if (val && (val & 3) != 3) return -EIO; 
-		child->thread.fs = val & 0xffff; 
+		child->thread.fsindex = val & 0xffff; 
 		break;
 	case offsetof(struct user32, regs.gs):
 		if (val && (val & 3) != 3) return -EIO; 
-		child->thread.gs = val & 0xffff;
+		child->thread.gsindex = val & 0xffff;
 		break;
 	case offsetof(struct user32, regs.ds):
 		if (val && (val & 3) != 3) return -EIO; 
@@ -138,10 +138,10 @@ static int getreg32(struct task_struct *
 
 	switch (regno) {
 	case offsetof(struct user32, regs.fs):
-	        *val = child->thread.fs; 
+	        *val = child->thread.fsindex;
 		break;
 	case offsetof(struct user32, regs.gs):
-		*val = child->thread.gs;
+		*val = child->thread.gsindex;
 		break;
 	case offsetof(struct user32, regs.ds):
 		*val = child->thread.ds;

-- 
Daniel Jacobowitz
CodeSourcery, LLC

             reply	other threads:[~2005-07-31 20:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-31 20:05 Daniel Jacobowitz [this message]
2005-08-03  9:10 ` Fix 32-bit thread debugging on x86_64 Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050731200557.GA4156@nevyn.them.org \
    --to=drow@false.org \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox