[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1


pthdb_pthread_context or pthdb_pthread_setcontext Subroutine

Purpose

Provides access to the pthread context via the struct context64 structure.

Library

pthread debug library (libpthdebug.a)

Syntax


#include <sys/pthdebug.h>


int pthdb_pthread_context (pthdb_session_t session,
pthdb_pthread_t pthread,
pthdb_context_t * context)


int pthdb_pthread_setcontext (pthdb_session_t session,
pthdb_pthread_t pthread,
pthdb_context_t * context)

Description

The pthread debug library provides access to the pthread context via the struct context64 structure, whether the process is 32-bit or 64-bit. The debugger should be able to convert from 32-bit to 64-bit and from 64-bit for 32-bit processes. The extent to which this structure is filled in depends on the presence of the PTHDB_FLAG_GPRS, PTHDB_FLAG_SPRSl and PTHDB_FLAG_FPRS session flags. It is necessary to use the pthread debug library to access the context of a pthread without a kernel thread. The pthread debug library can also be used to access the context of a pthread with a kernel thread, but this results in a call back to the debugger, meaning that the debugger is capable of obtaining this information by itself. The debugger determines if the kernel thread is running in user mode or kernel mode and then fills in the struct context64 appropriately. The pthread debug library does not use this information itself and is thus not sensitive to the correct implementation of the read_regs and write_regs call back functions.

pthdb_pthread_context reports the context of the pthread based on the settings of the session flags. Uses the read_regs call back if the pthread has a kernel thread. If read_regs is not defined, then it returns PTHDB_NOTSUP.

pthdb_pthread_setcontext sets the context of the pthread based on the settings of the session flags. Uses the write_data call back if the pthread does not have a kernel thread. Use the write_regs call back if the pthread has a kernel thread.

If the debugger does not define the read_regs and write_regs call backs and if the pthread does not have a kernel thread, then the pthdb_pthread_context and pthdb_pthread_setcontext functions succeed. But if a pthread does not have a kernel thread, then these functions fail and return PTHDB_CONTEXT.

Parameters


session Session handle.
pthread pthread handle.
context Context buffer pointer.

Return Values

If successful, these functions return PTHDB_SUCCESS. Otherwise, an error code is returned.

Error Codes


PTHDB_BAD_SESSION Invalid session handle.
PTHDB_BAD_PTHREAD Invalid pthread handle.
PTHDB_BAD_POINTER Invalid buffer pointer.
PTHDB_CALLBACK Callback function failed.
PTHDB_CONTEXT Could not determine pthread context.
PTHDB_MEMORY Not enough memory
PTHDB_NOTSUP pthdb_pthread_(set)context returns PTHDB_NOTSUP if the read_regs, write_data or write_regs call backs are set to NULL.
PTHDB_INTERNAL Error in library.

Implementation Specifics

These subroutines are part of Base Operating System (BOS) Runtime.

Related Information

The pthdebug.h file.

The pthread.h file.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]