HP-UX Reference (11i v1 05/09) - 2 System Calls (vol 5)

t
ttrace(2) ttrace(2)
All other requests, except non debug-related requests below, are targeted to a specific thread in the traced
process. Also, all other requests require both the pid of the traced process and an lwpid specifying a valid
thread in the process being traced. These requests are prefixed by
TT_LWP_ and are as follows:
TT_LWP_STOP
This request causes the thread identified by lwpid to stop executing. If the thread is
already stopped by the debugger,orby an event, an error is returned.
The addr, data and addr2 arguments must be zero.
TT_LWP_CONTINUE
This request causes the thread identified by lwpid to resume execution or, rather, to return
to the state it was in prior to being stopped by the debugger. If the thread had not previ-
ously been stopped by the debugger, an error is returned.
If addr is not
TT_NOPC, that value is loaded in the program counter before execution is
resumed. Unexpected behavior will result if this value is not within the same function since
only the PC, not the context, is being modified.
If data is non-zero, it is expected to be a valid signal number and the thread will continue
as if it had received this signal.
The addr2 argument must be zero.
TT_LWP_SINGLE
This request causes the stopped thread identified by lwpid to resume execution for one
machine instruction. It causes a flag to be set so that an interrupt occurs upon the comple-
tion of one machine instruction, and then executes the same steps as listed above for the
TT_LWP_CONTINUE request.
TT_LWP_GET_EVENT_MASK
This request is the same as TT_PROC_GET_EVENT_MASK
except for the thread
identified by lwpid.
TT_LWP_SET_EVENT_MASK
This request is the same as TT_PROC_SET_EVENT_MASK
except for the thread
identified by lwpid.
TT_LWP_GET_STATE
This calls returns the state of the thread identified by lwpid. If the thread was not previ-
ously stopped by the debugger or waiting to be continued after an event, an error is
returned.
There is currently only one non debug-related request:
TT_NDR_GET_FLEV
This call returns the feature level of the operating system and has been introduced to help
debugger developers make their tools more portable from one version to another. 11.0 sys-
tems can be identified by the fact that this call will return an error. Later releases will
return the TT_FEATURE_LEVEL
value the operating system was compiled with (see
ttrace.h). The release levels for systems newer than 11.0 are:
Level 5: internal change
Level 6: add DETACH_ON_EXIT attach option.
Level 7: add TTEVT_BPT_SSTEP event.
SECURITY FEATURES
For security reasons, ttrace() inhibits the set-user-ID facility on subsequent exec() calls.
EVENTS
As noted earlier, a tracing process can set event flags in the context of a traced process, or its individual
threads, to cause the threads to respond to specific events during their execution. When an event flag is set
in the context of the process, all threads in the process respond to the event. When set in the context of a
thread, only the specific thread will respond to the event.
IMPORTANT: If an event is requested by the process, the event mask of the thread is not examined. For
the event mask of the thread to be significant, the process event must be be unset. Similarly, if an event
option is enabled in the process, the option for the thread is not considered. Event masks may be inherited
Section 2440 Hewlett-Packard Company 6 HP-UX 11i Version 1: September 2005