satyr  0.26
Data Structures | Functions
core/thread.h File Reference

Single thread of execution of a core stack trace. More...

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

Go to the source code of this file.

Data Structures

struct  sr_core_thread
 A thread of execution on call stack of a core dump. More...
 

Functions

struct sr_core_threadsr_core_thread_new (void)
 
void sr_core_thread_init (struct sr_core_thread *thread)
 
void sr_core_thread_free (struct sr_core_thread *thread)
 
struct sr_core_threadsr_core_thread_dup (struct sr_core_thread *thread, bool siblings)
 
int sr_core_thread_cmp (struct sr_core_thread *thread1, struct sr_core_thread *thread2)
 
struct sr_core_threadsr_core_thread_append (struct sr_core_thread *dest, struct sr_core_thread *item)
 
bool sr_core_thread_is_exit_frame (struct sr_core_frame *frame)
 
struct sr_core_framesr_core_thread_find_exit_frame (struct sr_core_thread *thread)
 
struct sr_core_threadsr_core_thread_from_json (struct sr_json_value *root, char **error_message)
 
char * sr_core_thread_to_json (struct sr_core_thread *thread, bool is_crash_thread)
 

Detailed Description

Single thread of execution of a core stack trace.

Definition in file core/thread.h.

Function Documentation

◆ sr_core_thread_append()

struct sr_core_thread* sr_core_thread_append ( struct sr_core_thread dest,
struct sr_core_thread item 
)

Appends 'item' at the end of the list 'dest'.

Returns
This function returns the 'dest' thread. If 'dest' is NULL, it returns the 'item' frame.

◆ sr_core_thread_cmp()

int sr_core_thread_cmp ( struct sr_core_thread thread1,
struct sr_core_thread thread2 
)

Compares two threads. When comparing the threads, it compares also their frames, including the frame numbers.

Returns
Returns 0 if the threads are same. Returns negative number if t1 is found to be 'less' than t2. Returns positive number if t1 is found to be 'greater' than t2.

◆ sr_core_thread_dup()

struct sr_core_thread* sr_core_thread_dup ( struct sr_core_thread thread,
bool  siblings 
)

Creates a duplicate of the thread.

Parameters
threadIt must be non-NULL pointer. The thread is not modified by calling this function.
siblingsWhether to duplicate also siblings referenced by thread->next. If false, thread->next is not duplicated for the new frame, but it is set to NULL.

◆ sr_core_thread_free()

void sr_core_thread_free ( struct sr_core_thread thread)

Releases the memory held by the thread. The thread siblings are not released. Thread frames are released.

Parameters
threadIf thread is NULL, no operation is performed.

◆ sr_core_thread_from_json()

struct sr_core_thread* sr_core_thread_from_json ( struct sr_json_value root,
char **  error_message 
)

Deserializes thread from JSON representation.

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

◆ sr_core_thread_init()

void sr_core_thread_init ( struct sr_core_thread thread)

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

◆ sr_core_thread_new()

struct sr_core_thread* sr_core_thread_new ( void  )

Creates and initializes a new frame structure.

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