Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP

hp.com home


unw_getcontext

» 

HP Labs

» Research
» News and events
» Technical reports
» About HP Labs
» Careers @ HP Labs
» People
» Worldwide sites
» Downloads
Content starts here


Table of Contents

Synopsis

#include <libunwind.h>

int unw_getcontext(unw_context_t *ucp);

Description

The unw_getcontext() routine initializes the context structure pointed to by ucp with the machine-state of the call-site. The exact set of registers stored by unw_getcontext() is platform-specific, but, in general, at least all preserved (``callee-saved'') and all frame-related registers, such as the stack-pointer, will be stored.

This routine is normally implemented as a macro and applications should not attempt to take its address.

Platform-specific Notes

On IA-64, unw_context_t has a layout that is compatible with that of ucontext_t and such structures can be initialized with getcontext() instead of unw_getcontext(). However, the reverse is not true and it is not safe to use structures initialized by unw_getcontext() in places where a structure initialized by getcontext() is expected. The reason for this asymmetry is that unw_getcontext() is optimized for maximum performance and does not, for example, save the signal mask.

Return Value

On successful completion, unw_getcontext() returns 0. Otherwise, a value of -1 is returned.

Thread and Signal Safety

unw_getcontext() is thread-safe as well as safe to use from a signal handler.

See Also

libunwind(3), unw_init_local(3)

Author

David Mosberger-Tang
Hewlett-Packard Labs
Palo-Alto, CA 94304
Email: davidm@hpl.hp.com
WWW: http://www.hpl.hp.com/research/linux/libunwind/.

Printable version
Privacy statement Using this site means you accept its terms Feedback to HP Labs
© 2009 Hewlett-Packard Development Company, L.P.