This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Reading target registers


Thanks,  I also waituntil the target is stopped before reading the
registers. I get a value, just not the correct value. I noticed that I get
the same incorrect value as the lsstack application which uses
ptrace(PTRACE_PEEKUSER,l_pid,EIP*4,0)
But GDB gets the correc value. I'm assuming it is something with my linking
or which version of user I'm including. I may be way off here but any help
is appreciated.

-----Original Message-----
From: Daniel Jacobowitz [mailto:drow@false.org]
Sent: Monday, May 09, 2005 3:50 PM
To: Bloch, Jack
Cc: gdb@sources.redhat.com
Subject: Re: Reading target registers


On Mon, May 09, 2005 at 12:44:05PM -0700, Bloch, Jack wrote:
> While this is not a direct GDB question, I'm hoping someone can answer me.
I
> have an application which uses the ptrace interface to attach to a target
> process and read the target registers (I'm specifically interested in the
> EIP). It will run on a SuSE 2.6 Kernel x86 based machine. My code is
below.

You can only use PTRACE_GETREGS when the process is stopped; that may
be the problem.  After attaching be sure to wait().  Otherwise, try
stracing to see what's going on.


-- 
Daniel Jacobowitz
CodeSourcery, LLC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]