Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Dave Gilbert <gilbertd@treblig.org>
To: axp-list@redhat.com
Subject: 'ptrace'
Date: Sun, 20 Sep 1998 23:17:01 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.3.96.980920231116.538D-100000@tardis.home.dave> (raw)

Hi,
  I've just downloaded 'ltrace' which is a package which
traces library calls; sounded damn useful - but unfortunatly it
doesn't work on Alpha yet, so I started looking at its system dependent
code.  The first thing I've had to look at is its use of 'ptrace' to get
register values.

As I read the comments in the GDB alpha config, ptrace on Linux/Alpha
reads/writes longs, so my first question is:

  Can I read/write an 8 byte value using ptrace at any 4 byte alignment?
  In particular I want to read the 4 bytes of an instruction and replace
  them with another instruction and thus using an instruction pointer of
  4 bytes.

The next question is regarding registers, In particular it uses code like
this on the x86:

int get_instruction_pointer(pid_t pid)
{
        return ptrace(PTRACE_PEEKUSER, pid, 4*EIP, 0);
}

Now ignoring for a second that it expects this to return an 'int',
what am I supposed to use instead of 4*EIP, from looking at the kernel
source we reckon the answer is 64, but where exactly do we find that magic
in the header files?

Dave

 --------------------------------------------------------------------   
/ Dr. David Alan Gilbert      | Running Linux on Alpha(LX) |  Happy  \ 
\   gro.gilbert @ treblig.org |   & ARM(EBSA285,old Arc)   |  In Hex /
 \____________________________|___ http://www.treblig.demon.co.uk __/


                 reply	other threads:[~1998-09-20 22:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox