tryWaitForDebugger#

Fully qualified name: carb::extras::tryWaitForDebugger

Defined in carb/extras/Debugging.h

inline bool carb::extras::tryWaitForDebugger(
int argc,
char **argv,
bool quiet = false,
bool stop = true,
const char *option = "--wait-debugger",
)#

Parses a command line and waits for a debugger if a specific option is found.

This is a low-level function intended to be called as early as possible during process startup. If the given option is found, this function blocks forever until a debugger is attached.

Parameters:
  • argc – The number of command-line arguments passed to the application.

  • argv – The array of command-line options.

  • quiet – If false (the default) and option is found in the array of command-line options, prints the text "***** waiting for a debugger to attach to process <pid> *****\n" to stderr; otherwise prints nothing but still waits.

  • stop – If true, a debug-break will occur immediately after the debugger attaches. Otherwise, execution continues without a debug-break.

  • option – The command-line argument to look for. Default: --wait-debugger. If nullptr or an empty string, no waiting will be performed.

Returns:

true if option was found in argv and a debugger was attached; false otherwise.