satyr  0.24.15.g3735.dirty
Data Structures | Functions
koops/stacktrace.h File Reference

Kernel oops stack trace structure and related algorithms. More...

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

Go to the source code of this file.

Data Structures

struct  sr_koops_stacktrace
 

Functions

struct sr_koops_stacktracesr_koops_stacktrace_new (void)
 
void sr_koops_stacktrace_init (struct sr_koops_stacktrace *stacktrace)
 
void sr_koops_stacktrace_free (struct sr_koops_stacktrace *stacktrace)
 
struct sr_koops_stacktracesr_koops_stacktrace_dup (struct sr_koops_stacktrace *stacktrace)
 
bool sr_koops_stacktrace_remove_frame (struct sr_koops_stacktrace *stacktrace, struct sr_koops_frame *frame)
 
struct sr_koops_stacktracesr_koops_stacktrace_parse (const char **input, struct sr_location *location)
 
char ** sr_koops_stacktrace_parse_modules (const char **input)
 
char * sr_koops_stacktrace_get_reason (struct sr_koops_stacktrace *stacktrace)
 
char * sr_koops_stacktrace_to_json (struct sr_koops_stacktrace *stacktrace)
 
struct sr_koops_stacktracesr_koops_stacktrace_from_json (struct sr_json_value *root, char **error_message)
 
void sr_normalize_koops_stacktrace (struct sr_koops_stacktrace *stacktrace)
 

Detailed Description

Kernel oops stack trace structure and related algorithms.

Definition in file koops/stacktrace.h.

Function Documentation

◆ sr_koops_stacktrace_dup()

struct sr_koops_stacktrace* sr_koops_stacktrace_dup ( struct sr_koops_stacktrace stacktrace)

Creates a duplicate of a 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_koops_stacktrace_free().

◆ sr_koops_stacktrace_free()

void sr_koops_stacktrace_free ( struct sr_koops_stacktrace stacktrace)

Releases the memory held by the stacktrace.

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

◆ sr_koops_stacktrace_from_json()

struct sr_koops_stacktrace* sr_koops_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_koops_stacktrace_get_reason()

char* sr_koops_stacktrace_get_reason ( struct sr_koops_stacktrace stacktrace)

Returns brief, human-readable explanation of the stacktrace.

◆ sr_koops_stacktrace_init()

void sr_koops_stacktrace_init ( struct sr_koops_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_koops_stacktrace_new()

struct sr_koops_stacktrace* sr_koops_stacktrace_new ( void  )

Creates and initializes a new stack trace structure.

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

◆ sr_koops_stacktrace_parse()

struct sr_koops_stacktrace* sr_koops_stacktrace_parse ( const char **  input,
struct sr_location location 
)

Parses a textual kernel oops 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 kernel oops. If this function returns a non-NULL value, the input pointer is modified to point after the stacktrace that was just parsed.

◆ sr_koops_stacktrace_remove_frame()

bool sr_koops_stacktrace_remove_frame ( struct sr_koops_stacktrace stacktrace,
struct sr_koops_frame frame 
)

Removes the frame from the stack trace and then deletes it.

Returns
True if the frame was found in the thread and removed and deleted. False if the frame was not found in the thread.

◆ sr_koops_stacktrace_to_json()

char* sr_koops_stacktrace_to_json ( struct sr_koops_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.