Classes | Typedefs | Functions

nsStackWalk.h File Reference

#include "nscore.h"
Include dependency graph for nsStackWalk.h:

Classes

struct  nsCodeAddressDetails

Typedefs

typedef void(* NS_WalkStackCallback )(void *aPC, void *aClosure)

Functions

nsresult NS_StackWalk (NS_WalkStackCallback aCallback, PRUint32 aSkipFrames, void *aClosure)
 Call aCallback for the C/C++ stack frames on the current thread, from the caller of NS_StackWalk to main (or above).
nsresult NS_DescribeCodeAddress (void *aPC, nsCodeAddressDetails *aDetails)
 For a given pointer to code, fill in the pieces of information used when printing a stack trace.
nsresult NS_FormatCodeAddressDetails (void *aPC, const nsCodeAddressDetails *aDetails, char *aBuffer, PRUint32 aBufferSize)
 Format the information about a code address in a format suitable for stack traces on the current platform.

Typedef Documentation

typedef void(* NS_WalkStackCallback)(void *aPC, void *aClosure)

Function Documentation

nsresult NS_DescribeCodeAddress ( void *  aPC,
nsCodeAddressDetails aDetails 
)

For a given pointer to code, fill in the pieces of information used when printing a stack trace.

Parameters:
aPC The code address.
aDetails A structure to be filled in with the result.
nsresult NS_FormatCodeAddressDetails ( void *  aPC,
const nsCodeAddressDetails aDetails,
char *  aBuffer,
PRUint32  aBufferSize 
)

Format the information about a code address in a format suitable for stack traces on the current platform.

When available, this string should contain the function name, source file, and line number. When these are not available, library and offset should be reported, if possible.

Parameters:
aPC The code address.
aDetails The value filled in by NS_DescribeCodeAddress(aPC).
aBuffer A string to be filled in with the description. The string will always be null-terminated.
aBufferSize The size, in bytes, of aBuffer, including room for the terminating null. If the information to be printed would be larger than aBuffer, it will be truncated so that aBuffer[aBufferSize-1] is the terminating null.
nsresult NS_StackWalk ( NS_WalkStackCallback  aCallback,
PRUint32  aSkipFrames,
void *  aClosure 
)

Call aCallback for the C/C++ stack frames on the current thread, from the caller of NS_StackWalk to main (or above).

Parameters:
aCallback Callback function, called once per frame.
aSkipFrames Number of initial frames to skip. 0 means that the first callback will be for the caller of NS_StackWalk.
aClosure Caller-supplied data passed through to aCallback.

Returns NS_ERROR_NOT_IMPLEMENTED on platforms where it is unimplemented. Returns NS_ERROR_UNEXPECTED when the stack indicates that the thread is in a very dangerous situation (e.g., holding sem_pool_lock in Mac OS X pthreads code). Callers should then bail out immediately.

May skip some stack frames due to compiler optimizations or code generation.