satyr 0.43
Loading...
Searching...
No Matches
frame.h File Reference

Single frame of core stack trace thread. More...

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

Go to the source code of this file.

Data Structures

struct  sr_core_frame
 A function call on call stack of a core dump. More...

Functions

struct sr_core_framesr_core_frame_new (void)
void sr_core_frame_init (struct sr_core_frame *frame)
void sr_core_frame_free (struct sr_core_frame *frame)
struct sr_core_framesr_core_frame_dup (struct sr_core_frame *frame, bool siblings)
bool sr_core_frame_calls_func (struct sr_core_frame *frame, const char *function_name,...)
int sr_core_frame_cmp (struct sr_core_frame *frame1, struct sr_core_frame *frame2)
int sr_core_frame_cmp_distance (struct sr_core_frame *frame1, struct sr_core_frame *frame2)
struct sr_core_framesr_core_frame_append (struct sr_core_frame *dest, struct sr_core_frame *item)
char * sr_core_frame_to_json (struct sr_core_frame *frame)
struct sr_core_framesr_core_frame_from_json (json_object *root, char **error_message)
void sr_core_frame_append_to_str (struct sr_core_frame *frame, GString *dest)

Detailed Description

Single frame of core stack trace thread.

Definition in file core/frame.h.

Function Documentation

◆ sr_core_frame_append()

struct sr_core_frame * sr_core_frame_append ( struct sr_core_frame * dest,
struct sr_core_frame * item )

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

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

References sr_core_frame_append().

Referenced by sr_core_frame_append().

◆ sr_core_frame_append_to_str()

void sr_core_frame_append_to_str ( struct sr_core_frame * frame,
GString * dest )

Appends textual representation of the frame to the string buffer dest.

References sr_core_frame_append_to_str().

Referenced by sr_core_frame_append_to_str().

◆ sr_core_frame_calls_func()

bool sr_core_frame_calls_func ( struct sr_core_frame * frame,
const char * function_name,
... )

Checks whether the frame represents a call of function with certain function name.

Parameters
frameA stack trace frame.
...Names of executables or shared libaries that should contain the function name. The list needs to be terminated by NULL. Just NULL will cause ANY file name to match and succeed. The name of file is searched as a substring.
Returns
True if the frame corresponds to a function with function_name, residing in a specified executable or shared binary.

References sr_core_frame_calls_func().

Referenced by sr_core_frame_calls_func().

◆ sr_core_frame_cmp()

int sr_core_frame_cmp ( struct sr_core_frame * frame1,
struct sr_core_frame * frame2 )

Compares two frames.

Parameters
frame1It must be non-NULL pointer. It's not modified by calling this function.
frame2It must be non-NULL pointer. It's not modified by calling this function.
Returns
Returns 0 if the frames are same. Returns negative number if frame1 is found to be 'less' than frame2. Returns positive number if frame1 is found to be 'greater' than frame2.

References sr_core_frame_cmp().

Referenced by sr_core_frame_cmp().

◆ sr_core_frame_cmp_distance()

int sr_core_frame_cmp_distance ( struct sr_core_frame * frame1,
struct sr_core_frame * frame2 )

Compares two frames for thread distance calculations.

Parameters
frame1It must be non-NULL pointer. It's not modified by calling this function.
frame2It must be non-NULL pointer. It's not modified by calling this function.
Returns
Returns 0 if the frames are same. Returns negative number if frame1 is found to be 'less' than frame2. Returns positive number if frame1 is found to be 'greater' than frame2.

References sr_core_frame_cmp_distance().

Referenced by sr_core_frame_cmp_distance().

◆ sr_core_frame_dup()

struct sr_core_frame * sr_core_frame_dup ( struct sr_core_frame * frame,
bool siblings )

Creates a duplicate of the frame.

Parameters
frameIt must be non-NULL pointer. The frame is not modified by calling this function.
siblingsWhether to duplicate also siblings referenced by frame->next. If false, frame->next is not duplicated for the new frame, but it is set to NULL.
Returns
This function never returns NULL. If the returned duplicate is not shallow, it must be released by calling the function sr_gdb_frame_free().

References sr_core_frame_dup().

Referenced by sr_core_frame_dup().

◆ sr_core_frame_free()

void sr_core_frame_free ( struct sr_core_frame * frame)

Releases the memory held by the frame. The frame siblings are not released.

Parameters
frameIf the frame is NULL, no operation is performed.

References sr_core_frame_free().

Referenced by sr_core_frame_free().

◆ sr_core_frame_from_json()

struct sr_core_frame * sr_core_frame_from_json ( json_object * root,
char ** error_message )

Deserializes frame structure from JSON representation.

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

References sr_core_frame_from_json().

Referenced by sr_core_frame_from_json().

◆ sr_core_frame_init()

void sr_core_frame_init ( struct sr_core_frame * frame)

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

References sr_core_frame_init().

Referenced by sr_core_frame_init().

◆ sr_core_frame_new()

struct sr_core_frame * sr_core_frame_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_frame_free().

References sr_core_frame_new().

Referenced by sr_core_frame_new().

◆ sr_core_frame_to_json()

char * sr_core_frame_to_json ( struct sr_core_frame * frame)

Returns a textual representation of the frame.

Parameters
frameIt must be a non-NULL pointer. It's not modified by calling this function.

References sr_core_frame_to_json().

Referenced by sr_core_frame_to_json().