HP-UX Reference (11i v2 07/12) - 2 System Calls (vol 5)

t
ttrace(2) ttrace(2)
[EINVAL] An offset in the
save_state structure is not word-aligned.
[EINVAL] An invalid register is targeted by
TT_LWP_WUREGS
.
[EINVAL] The core file argument to a
TT_PROC_CORE request exists and is not a regular file.
[ENOENT] The directory portion of the core file argument to a
TT_PROC_CORE request does not
exist.
[EINVAL] The size argument to a
TT_PROC_GET_PATHNAME
is larger than MAXPATHLEN.
[EACCES] The pid argument to the
TT_PROC_ATTACH
is the pid of the invoker.
[EACCES] The process is already being traced.
[EACCES] Attempting to trace a process whose binary resides on a soft/interruptible NFS mount
point.
[EACCES] The executable image of the process being attached resides across an interruptible
NFS mount.
[EFAULT] Invalid user address.
[EPERM] The specified thread cannot be attached for tracing.
[ESRCH] pid and/or lwpid identify a process or a thread to be traced that does not exist or has
not executed a
ttrace() with the TT_PROC_SETTRC
request.
[EINTR] Cannot suspend process or attach is interrupted (
TT_PROC_ATTACH
).
[EPROTO] Attempting to stop a thread already stopped by the debugger.
[EPROTO] Attempting to resume a thread not stopped by the debugger.
[EPROTO] Attempting to read or write registers while the thread is not stopped.
[EPROTO] Attempting to obtain the state of a thread which was not stopped by the debugger.
[EPROTO] Invoked before an exec event took place (
TT_PROC_GET_PATHNAME).
[EPROTO] The process is exiting and the request is not allowed in this condition.
[EPROTO] The debugger is attempting to modify wide registers after having modified narrow
registers.
[EPROTO] The debugger is attempting to first modify the text of a process in the middle of a
vfork. Text modification is allowed during vfork as long as it was first modified before
the vfork.
[ENODATA] Data in this register is not readable or not writable at this time.
[EDEADLK] One thread of a multithreaded process (p1) has performed a
vfork(), the child (p2)
is stopped at the vfork event and the debugger is attempting to stop or resume a
thread in the parent process (p1).
[ENOMEM] System is out of memory.
[EAGAIN] Unable to attach to a process. This error can only be encountered when attaching to a
process in the middle of an exec(2) syscall.
EXAMPLES
A simple no-frills system call tracer:
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/ttrace.h>
pid_t ppid;
typedef struct {
int val;
char *name;
} _exp_t;
494 Hewlett-Packard Company 14 HP-UX 11i Version 2: December 2007 Update