Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* 'ptrace'
@ 1998-09-20 22:17 Dave Gilbert
  0 siblings, 0 replies; only message in thread
From: Dave Gilbert @ 1998-09-20 22:17 UTC (permalink / raw)
  To: axp-list

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 __/


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-09-20 22:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-09-20 22:17 'ptrace' Dave Gilbert

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