ttrace.2 (2010 09)
t
ttrace(2) ttrace(2)
[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.
[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.
EXAMPLES
A simple no-frills system call tracer:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/ttrace.h>
#include <sys/scall_define.h>
pid_t ppid;
typedef struct {
int val;
char *name;
} _exp_t;
static char *
gen_name(_exp_t *base, int val)
{
_exp_t *rp;
for (rp = base; rp->name; rp++) {
if (val == rp->val) {
return rp->name;
}
}
return NULL;
}
static char *
ev_name(ttevents_t ev)
{
static char buf[32];
char *p;
static _exp_t tab[] = {
TTEVT_SIGNAL, "SIGNAL",
TTEVT_FORK, "FORK",
TTEVT_EXEC, "EXEC",
TTEVT_EXIT, "EXIT",
TTEVT_VFORK, "VFORK",
TTEVT_SYSCALL, "SYSCALL",
TTEVT_SYSCALL_ENTRY, "SYSCALL_ENTRY",
TTEVT_LWP_CREATE, "LWP_CREATE",
TTEVT_LWP_TERMINATE, "LWP_TERMINATE",
TTEVT_LWP_EXIT, "LWP_EXIT",
TTEVT_LWP_ABORT_SYSCALL,"LWP_ABORT_SYSCALL",
#if TT_FEATURE_LEVEL >= 7
TTEVT_BPT_SSTEP, "LWP_BPT_SSTEP",
#endif
-1, NULL
};
p = gen_name(tab, (int) ev);
if (p) {
HP-UX 11i Version 3: September 2010 − 17 − Hewlett-Packard Company 17