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

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

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

Go to the source code of this file.

Data Structures

struct  sr_java_stacktrace

Functions

struct sr_java_stacktracesr_java_stacktrace_new (void)
void sr_java_stacktrace_init (struct sr_java_stacktrace *stacktrace)
void sr_java_stacktrace_free (struct sr_java_stacktrace *stacktrace)
struct sr_java_stacktracesr_java_stacktrace_dup (struct sr_java_stacktrace *stacktrace)
int sr_java_stacktrace_cmp (struct sr_java_stacktrace *stacktrace1, struct sr_java_stacktrace *stacktrace2)
struct sr_java_stacktracesr_java_stacktrace_parse (const char **input, struct sr_location *location)
char * sr_java_stacktrace_get_reason (struct sr_java_stacktrace *stacktrace)
char * sr_java_stacktrace_to_json (struct sr_java_stacktrace *stacktrace)
struct sr_java_stacktracesr_java_stacktrace_from_json (json_object *root, char **error_message)
struct sr_java_threadsr_java_find_crash_thread (struct sr_java_stacktrace *stacktrace)

Detailed Description

java stack trace structure and related algorithms.

Definition in file java/stacktrace.h.

Function Documentation

◆ sr_java_stacktrace_cmp()

int sr_java_stacktrace_cmp ( struct sr_java_stacktrace * stacktrace1,
struct sr_java_stacktrace * stacktrace2 )

Compares two stacktraces.

Returns
Returns 0 if the stacktraces 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_java_stacktrace_dup()

struct sr_java_stacktrace * sr_java_stacktrace_dup ( struct sr_java_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_java_stacktrace_free().

◆ sr_java_stacktrace_free()

void sr_java_stacktrace_free ( struct sr_java_stacktrace * stacktrace)

Releases the memory held by the stacktrace and its frames.

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

◆ sr_java_stacktrace_from_json()

struct sr_java_stacktrace * sr_java_stacktrace_from_json ( json_object * 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_java_stacktrace_get_reason()

char * sr_java_stacktrace_get_reason ( struct sr_java_stacktrace * stacktrace)

Returns brief, human-readable explanation of the stacktrace.

◆ sr_java_stacktrace_init()

void sr_java_stacktrace_init ( struct sr_java_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_java_stacktrace_new()

struct sr_java_stacktrace * sr_java_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_java_stacktrace_free().

◆ sr_java_stacktrace_parse()

struct sr_java_stacktrace * sr_java_stacktrace_parse ( const char ** input,
struct sr_location * location )

Parses a textual stack trace 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 stacktrace. If this function returns a non-NULL value, this pointer is modified to point after the stacktrace that was just parsed.
locationThe caller must provide a pointer to an instance of sr_location here. The line and column members of the location are gradually increased as the parser handles the input, so the location should be initialized by sr_location_init() before calling this function to get reasonable values. When this function returns false (an error occurred), the structure will contain the error line, column, and message.
Returns
A newly allocated stacktrace structure or NULL. A stacktrace struct is returned when at least one thread was parsed from the input and no error occurred. The returned structure should be released by sr_java_stacktrace_free().

◆ sr_java_stacktrace_to_json()

char * sr_java_stacktrace_to_json ( struct sr_java_stacktrace * stacktrace)

Serializes stacktrace to string. @returnes Newly allocated memory containing the textual representation of the provided stacktrace. Caller should free the memory when it's no longer needed.