This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: Accessing x86 general-purpose registers
- From: Daniel Jacobowitz <drow at false dot org>
- To: "Hanson, Jonathan M" <jonathan dot m dot hanson at intel dot com>
- Cc: gdb at sources dot redhat dot com
- Date: Mon, 18 Oct 2004 17:05:37 -0400
- Subject: Re: Accessing x86 general-purpose registers
- References: <C863B68032DED14E8EBA9F71EB8FE4C20508B471@azsmsx406>
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