satyr  0.26
Data Structures | Enumerations | Functions
sharedlib.h File Reference

Shared library information as produced by GDB. More...

#include <stdbool.h>
#include <inttypes.h>

Go to the source code of this file.

Data Structures

struct  sr_gdb_sharedlib
 A shared library memory location as reported by GDB. More...
 

Enumerations

enum  { SYMS_OK, SYMS_WRONG, SYMS_NOT_FOUND }
 

Functions

struct sr_gdb_sharedlibsr_gdb_sharedlib_new (void)
 
void sr_gdb_sharedlib_init (struct sr_gdb_sharedlib *sharedlib)
 
void sr_gdb_sharedlib_free (struct sr_gdb_sharedlib *sharedlib)
 
struct sr_gdb_sharedlibsr_gdb_sharedlib_append (struct sr_gdb_sharedlib *dest, struct sr_gdb_sharedlib *item)
 
struct sr_gdb_sharedlibsr_gdb_sharedlib_dup (struct sr_gdb_sharedlib *sharedlib, bool siblings)
 
int sr_gdb_sharedlib_count (struct sr_gdb_sharedlib *sharedlib)
 
struct sr_gdb_sharedlibsr_gdb_sharedlib_find_address (struct sr_gdb_sharedlib *first, uint64_t address)
 
struct sr_gdb_sharedlibsr_gdb_sharedlib_parse (const char *input)
 

Detailed Description

Shared library information as produced by GDB.

Definition in file sharedlib.h.

Function Documentation

◆ sr_gdb_sharedlib_append()

struct sr_gdb_sharedlib* sr_gdb_sharedlib_append ( struct sr_gdb_sharedlib dest,
struct sr_gdb_sharedlib item 
)

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

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

◆ sr_gdb_sharedlib_count()

int sr_gdb_sharedlib_count ( struct sr_gdb_sharedlib sharedlib)

Returns the number of sharedlibs in the list.

◆ sr_gdb_sharedlib_dup()

struct sr_gdb_sharedlib* sr_gdb_sharedlib_dup ( struct sr_gdb_sharedlib sharedlib,
bool  siblings 
)

Creates a duplicate of the sharedlib structure.

Parameters
sharedlibStructure to be duplicated.
siblingsWhether to duplicate a single structure or whole list.
Returns
Never returns NULL. Returns the duplicated structure or the first structure in the duplicated list.

◆ sr_gdb_sharedlib_find_address()

struct sr_gdb_sharedlib* sr_gdb_sharedlib_find_address ( struct sr_gdb_sharedlib first,
uint64_t  address 
)

Finds whether the address belongs to some sharedlib from the list starting by 'first'.

Returns
Pointer to an existing structure or NULL if not found.

◆ sr_gdb_sharedlib_free()

void sr_gdb_sharedlib_free ( struct sr_gdb_sharedlib sharedlib)

Releases the memory held by the sharedlib. Sharedlibs referenced by .next are not released.

Parameters
sharedlibIf sharedlib is NULL, no operation is performed.

◆ sr_gdb_sharedlib_init()

void sr_gdb_sharedlib_init ( struct sr_gdb_sharedlib sharedlib)

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

◆ sr_gdb_sharedlib_new()

struct sr_gdb_sharedlib* sr_gdb_sharedlib_new ( void  )

Creates and initializes a new sharedlib structure.

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

◆ sr_gdb_sharedlib_parse()

struct sr_gdb_sharedlib* sr_gdb_sharedlib_parse ( const char *  input)

Parses the output of GDB's 'info sharedlib' command.

Parameters
inputString representing the stacktrace.
Returns
First element of the list of loaded libraries.