satyr  0.28
Data Structures | Functions
python/stacktrace.h File Reference

Python stack trace structure and related algorithms. More...

#include "../report_type.h"
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  sr_python_stacktrace
 

Functions

struct sr_python_stacktracesr_python_stacktrace_new (void)
 
void sr_python_stacktrace_init (struct sr_python_stacktrace *stacktrace)
 
void sr_python_stacktrace_free (struct sr_python_stacktrace *stacktrace)
 
struct sr_python_stacktracesr_python_stacktrace_dup (struct sr_python_stacktrace *stacktrace)
 
struct sr_python_stacktracesr_python_stacktrace_parse (const char **input, struct sr_location *location)
 
char * sr_python_stacktrace_get_reason (struct sr_python_stacktrace *stacktrace)
 
char * sr_python_stacktrace_to_json (struct sr_python_stacktrace *stacktrace)
 
struct sr_python_stacktracesr_python_stacktrace_from_json (struct sr_json_value *root, char **error_message)
 

Detailed Description

Python stack trace structure and related algorithms.

Definition in file python/stacktrace.h.

Function Documentation

◆ sr_python_stacktrace_dup()

struct sr_python_stacktrace* sr_python_stacktrace_dup ( struct sr_python_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_python_stacktrace_free().

◆ sr_python_stacktrace_free()

void sr_python_stacktrace_free ( struct sr_python_stacktrace stacktrace)

Releases the memory held by the stacktrace and its frames.

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

◆ sr_python_stacktrace_from_json()

struct sr_python_stacktrace* sr_python_stacktrace_from_json ( struct sr_json_value root,
char **  error_message 
)

Deserializes stacktrace from JSON representation.

Parameters
rootJSON value to be deserialized.
error_messageOn error, *error_message will contain the description of the error.
Returns
Resulting stacktrace, or NULL on error.

◆ sr_python_stacktrace_get_reason()

char* sr_python_stacktrace_get_reason ( struct sr_python_stacktrace stacktrace)

Returns brief, human-readable explanation of the stacktrace.

◆ sr_python_stacktrace_init()

void sr_python_stacktrace_init ( struct sr_python_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_python_stacktrace_new()

struct sr_python_stacktrace* sr_python_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_python_stacktrace_free().

◆ sr_python_stacktrace_parse()

struct sr_python_stacktrace* sr_python_stacktrace_parse ( const char **  input,
struct sr_location location 
)

Parses a textual Python stacktrace and puts it into a structure. If parsing fails, the input parameter is not changed and NULL is returned.

Parameters
inputPointer to the string with the Python stack trace. If this function returns a non-NULL value, the input pointer is modified to point after the stacktrace that was just parsed.

◆ sr_python_stacktrace_to_json()

char* sr_python_stacktrace_to_json ( struct sr_python_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.