Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
Sonde::Detail::StackCapture Class Reference

Taking samples of one thread's stack from another thread. More...

#include <stackcapture_p.h>

Static Public Member Functions

static QString prepare ()
 Makes the calling thread the target.
static void release ()
 Stops targeting the thread; call it once no capture() can be running.
static QString capture (RawStack &out, std::chrono::milliseconds timeout)
 Takes a sample of the target's stack into out, waiting at most timeout (Linux: for the signal handler to run).
static int signalNumber ()
 The signal used on Linux, or 0.

Detailed Description

Taking samples of one thread's stack from another thread.

One thread in the process at a time can be the target.

The rules that keep it safe (design 0016): between suspending the target and resuming it, or in the signal handler, the code allocates nothing, takes no lock and is not instrumented by a sanitizer; it reads only the target's own stack, within its bounds.

Member Function Documentation

◆ capture()

QString Sonde::Detail::StackCapture::capture ( RawStack & out,
std::chrono::milliseconds timeout )
static

Takes a sample of the target's stack into out, waiting at most timeout (Linux: for the signal handler to run).

Returns why there is no sample, or an empty string. Never call it on the target thread.

◆ prepare()

QString Sonde::Detail::StackCapture::prepare ( )
static

Makes the calling thread the target.

Call it on that thread. Returns why it can't, or an empty string: another thread is already the target, or (Linux) the application has a handler on the signal Sonde would use.


The documentation for this class was generated from the following files: