From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8050 invoked by alias); 18 Oct 2004 21:05:40 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 8038 invoked from network); 18 Oct 2004 21:05:39 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sourceware.org with SMTP; 18 Oct 2004 21:05:39 -0000 Received: from drow by nevyn.them.org with local (Exim 4.34 #1 (Debian)) id 1CJehF-0000x0-4r; Mon, 18 Oct 2004 17:05:37 -0400 Date: Tue, 19 Oct 2004 02:23:00 -0000 From: Daniel Jacobowitz To: "Hanson, Jonathan M" Cc: gdb@sources.redhat.com Subject: Re: Accessing x86 general-purpose registers Message-ID: <20041018210537.GA1582@nevyn.them.org> Mail-Followup-To: "Hanson, Jonathan M" , gdb@sources.redhat.com References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.5.1+cvs20040105i X-SW-Source: 2004-10/txt/msg00349.txt.bz2 On Mon, Oct 18, 2004 at 01:03:42PM -0700, Hanson, Jonathan M wrote: > My question really isn't about GDB per se but I was hoping some > of the developers on this list would be able to help with what I'm > trying to do. > I have written a kernel module that, when triggered by an event, > dumps out the contents of memory and the architectural state of the > system to two files. The problem I'm running into is that the general > purpose registers (EAX, EBX, EIP, etc.) I'm storing are incorrect. To > investigate this problem I've downloaded the source to GDB and I've been > looking at how GDB accomplishes this. > In include/asm-i386/user.h is a structure called struct user > with a member struct user_pt_regs, which is where GDB gets the general > purpose register information for a program being debugged. I can see > nowhere else in the kernel where this structure is written to. How is > this information populated? Is there a way I can access this structure > from the kernel itself? I am inferring from context that you are talking about Linux. You may have better luck on a Linux development list; GDB uses ptrace, and the kernel takes care of connecting the registers to that. -- Daniel Jacobowitz