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


On Mon, May 09, 2005 at 12:53:20PM -0700, Bloch, Jack wrote:
> 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.

A couple of things:
  - Always cast the arguments to ptrace.  They are generally of type
    "long", which may not be the same as "int".
  - If you are debugging a 64-bit program you need a 64-bit GDB. 
    Sounds like you're on a 32-bit system though.
  - Verify whether your headers are messed up.  I already recommended
    the use of strace for this.  It can decode the arguments.

What is the incorrect value?  What is the correct value?

-- 
Daniel Jacobowitz
CodeSourcery, LLC


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