satyr 0.43
Loading...
Searching...
No Matches
Data Structures | Functions
stacktrace.h File Reference

A stack trace of a core dump. More...

#include "../report_type.h"
#include <inttypes.h>
#include <json.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  sr_core_stacktrace
 A stack trace of a core dump. More...
 

Functions

struct sr_core_stacktracesr_core_stacktrace_new (void)
 
void sr_core_stacktrace_init (struct sr_core_stacktrace *stacktrace)
 
void sr_core_stacktrace_free (struct sr_core_stacktrace *stacktrace)
 
struct sr_core_stacktracesr_core_stacktrace_dup (struct sr_core_stacktrace *stacktrace)
 
int sr_core_stacktrace_get_thread_count (struct sr_core_stacktrace *stacktrace)
 
struct sr_core_threadsr_core_stacktrace_find_crash_thread (struct sr_core_stacktrace *stacktrace)
 
struct sr_core_stacktracesr_core_stacktrace_from_json (json_object *root, char **error_message)
 
struct sr_core_stacktracesr_core_stacktrace_from_json_text (const char *text, char **error_message)
 
char * sr_core_stacktrace_get_reason (struct sr_core_stacktrace *stacktrace)
 
char * sr_core_stacktrace_to_json (struct sr_core_stacktrace *stacktrace)
 
struct sr_core_stacktracesr_core_stacktrace_create (const char *gdb_stacktrace_text, const char *unstrip_text, const char *executable_path)
 

Detailed Description

A stack trace of a core dump.

Definition in file core/stacktrace.h.

Function Documentation

◆ sr_core_stacktrace_dup()

struct sr_core_stacktrace * sr_core_stacktrace_dup ( struct sr_core_stacktrace * stacktrace)

Creates a duplicate of the stacktrace.

Parameters
stacktraceThe stacktrace to be copied. It's not modified by this function.
Returns
This function never returns NULL. The returned duplicate must be released by calling the function sr_core_stacktrace_free().

◆ sr_core_stacktrace_free()

void sr_core_stacktrace_free ( struct sr_core_stacktrace * stacktrace)

Releases the memory held by the stacktrace, its threads and frames.

Parameters
stacktraceIf the stacktrace is NULL, no operation is performed.

◆ sr_core_stacktrace_from_json()

struct sr_core_stacktrace * sr_core_stacktrace_from_json ( json_object * root,
char ** error_message )
Note
Stacktrace can be serialized to JSON string via sr_core_stacktrace_to_json().

◆ sr_core_stacktrace_get_reason()

char * sr_core_stacktrace_get_reason ( struct sr_core_stacktrace * stacktrace)

Returns brief, human-readable explanation of the stacktrace.

◆ sr_core_stacktrace_get_thread_count()

int sr_core_stacktrace_get_thread_count ( struct sr_core_stacktrace * stacktrace)

Returns a number of threads in the stacktrace.

Parameters
stacktraceIt's not modified by calling this function.

◆ sr_core_stacktrace_init()

void sr_core_stacktrace_init ( struct sr_core_stacktrace * stacktrace)

Initializes all members of the stacktrace structure to their default values. No memory is released, members are simply overwritten. This is useful for initializing a stacktrace structure placed on the stack.

◆ sr_core_stacktrace_new()

struct sr_core_stacktrace * sr_core_stacktrace_new ( void )

Creates and initializes a new stacktrace structure.

Returns
It never returns NULL. The returned pointer must be released by calling the function sr_core_stacktrace_free().

◆ sr_core_stacktrace_to_json()

char * sr_core_stacktrace_to_json ( struct sr_core_stacktrace * stacktrace)

Serializes stacktrace to string.

Returns
Newly allocated memory containing the textual representation of the provided stacktrace. Caller should free the memory when it's no longer needed.