8#ifndef PXR_ARCH_STACK_TRACE_H
9#define PXR_ARCH_STACK_TRACE_H
14#include "pxr/arch/pxr.h"
15#include "pxr/arch/api.h"
26ARCH_NAMESPACE_OPEN_SCOPE
49 const char* message =
nullptr,
50 const char* extraLogMsg =
nullptr);
70 const char* message =
nullptr,
71 const char* extraLogMsg =
nullptr);
96 const char *
const argv[],
97 const char*
const fatalArgv[]);
135 const char*
const argv[],
136 const char*
const crashArgv[]);
148 const std::string& programName,
149 const std::string& reason);
161 const std::string& programName,
162 const std::string& reason);
235 std::vector<std::string>
const *lines);
249 const std::string& reason,
251 const std::string& sessionLog =
"");
266 const std::string& sessionLog =
"");
296 std::vector<uintptr_t> *frames);
309 const std::vector<uintptr_t> &frames,
310 bool skipUnknownFrames =
false);
334#if defined(ARCH_OS_DARWIN)
339#define ETIME ECANCELED
343ARCH_NAMESPACE_CLOSE_SCOPE
void ArchSetExtraLogInfoForErrors(const std::string &key, std::vector< std::string > const *lines)
Stores (or removes if lines is nullptr) a pointer to additional log data that will be output in the s...
int ArchCrashHandlerSystemv(const char *pathname, char *const argv[], int timeout, ArchCrashHandlerSystemCB callback, void *userData)
Replacement for 'system' safe for a crash handler.
bool ArchIsAppCrashing()
Returns true if the fatal signal handler ArchLogFatalProcessState has been invoked.
void ArchPrintStackTrace(FILE *fout, const std::string &programName, const std::string &reason)
Print a stack trace to the given FILE pointer.
void ArchGetStackTraceCallback(ArchStackTraceCallback *cb)
Returns the callback to get a symbolic representation of an address.
void ArchLogFatalProcessState(const char *reason, const char *message=nullptr, const char *extraLogMsg=nullptr)
Dumps call-stack info to a file, prints a message to the terminal, and invokes crash handling script.
void ArchSetStackTraceCallback(const ArchStackTraceCallback &cb)
Sets a callback to get a symbolic representation of an address.
void ArchLogSessionInfo(const char *crashStackTrace=NULL)
Log session info.
void(* ArchCrashHandlerSystemCB)(void *userData)
Callback for handling crashes.
Definition stackTrace.h:314
void ArchLogCurrentProcessState(const char *reason, const char *message=nullptr, const char *extraLogMsg=nullptr)
Dumps call-stack info to a file, and prints an informative message.
std::function< std::string(uintptr_t address)> ArchStackTraceCallback
A callback to get a symbolic representation of an address.
Definition stackTrace.h:171
void ArchSetFatalStackLogging(bool flag)
Enables or disables the automatic logging of crash information.
time_t ArchGetAppLaunchTime()
Returns the set value for the application's launch time.
const char * ArchGetProgramNameForErrors()
Returns the currently set program name for reporting errors.
std::string ArchGetProgramInfoForErrors(const std::string &key)
Returns currently set program info.
void ArchGetStackFrames(size_t maxDepth, std::vector< uintptr_t > *frames)
Save frames of current stack.
void ArchPrintStackFrames(std::ostream &out, const std::vector< uintptr_t > &frames, bool skipUnknownFrames=false)
Print stack frames to the given ostream.
void ArchSetProgramInfoForErrors(const std::string &key, const std::string &value)
Sets additional program info to be reported to the terminal in case of a fatal error.
void ArchLogStackTrace(const std::string &progName, const std::string &reason, bool fatal=false, const std::string &sessionLog="")
Logs a stack trace to a file in /var/tmp.
void ArchEnableSessionLogging()
Register the callback to invoke logging at end of a successful session.
bool ArchGetFatalStackLogging()
Returns whether automatic logging of fatal crashes is enabled This is set to false by default.
void ArchSetLogSession(const char *command, const char *const argv[], const char *const crashArgv[])
Sets the command line to log sessions.
std::vector< std::string > ArchGetStackTrace(size_t maxDepth)
Return stack trace.
void ArchSetProgramNameForErrors(const char *progName)
Sets the program name to be used in diagnostic output.
void ArchSetProcessStateLogCommand(const char *command, const char *const argv[], const char *const fatalArgv[])
Sets command line that gets call-stack info and triggers crash handling script.