HPCToolkit
dylib.c File Reference
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <link.h>
#include <dlfcn.h>
#include "dylib.h"
#include "fnbounds_interface.h"
#include <messages/messages.h>
Include dependency graph for dylib.c:

Go to the source code of this file.

Classes

struct  dylib_seg_bounds_s
 
struct  dylib_fmca_s
 

Macros

#define SEG_START_ADDR(info, seg)   ((char *) (info)->dlpi_addr + (info)->dlpi_phdr[seg].p_vaddr)
 
#define SEG_SIZE(info, seg)   ((info)->dlpi_phdr[seg].p_memsz)
 
#define SEG_IS_EXECUTABLE_CODE(info, seg)
 

Functions

static int dylib_map_open_dsos_callback (struct dl_phdr_info *info, size_t size, void *)
 
static int dylib_find_module_containing_addr_callback (struct dl_phdr_info *info, size_t size, void *fargs_v)
 
void dylib_map_open_dsos ()
 
void dylib_map_executable ()
 
int dylib_addr_is_mapped (void *addr)
 
int dylib_find_module_containing_addr (void *addr, char *module_name, void **start, void **end)
 
int dylib_find_proc (void *pc, void **proc_beg, void **mod_beg)
 
bool dylib_isin_start_func (void *pc)
 
const char * dylib_find_proc_name (const void *pc)
 
void dylib_get_segment_bounds (struct dl_phdr_info *info, struct dylib_seg_bounds_s *bounds)
 

Macro Definition Documentation

◆ SEG_IS_EXECUTABLE_CODE

#define SEG_IS_EXECUTABLE_CODE (   info,
  seg 
)
Value:
(((info) != NULL) && \
((info)->dlpi_phdr != NULL) && \
((info)->dlpi_phdr[seg].p_type == PT_LOAD) && \
((info)->dlpi_phdr[seg].p_flags & PF_X))
#define NULL
Definition: ElfHelper.cpp:85

Definition at line 96 of file dylib.c.

◆ SEG_SIZE

#define SEG_SIZE (   info,
  seg 
)    ((info)->dlpi_phdr[seg].p_memsz)

Definition at line 94 of file dylib.c.

◆ SEG_START_ADDR

#define SEG_START_ADDR (   info,
  seg 
)    ((char *) (info)->dlpi_addr + (info)->dlpi_phdr[seg].p_vaddr)

Definition at line 91 of file dylib.c.

Function Documentation

◆ dylib_addr_is_mapped()

int dylib_addr_is_mapped ( void *  addr)

Definition at line 144 of file dylib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dylib_find_module_containing_addr()

int dylib_find_module_containing_addr ( void *  addr,
char *  module_name,
void **  start,
void **  end 
)

Definition at line 155 of file dylib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dylib_find_module_containing_addr_callback()

static int dylib_find_module_containing_addr_callback ( struct dl_phdr_info *  info,
size_t  size,
void *  fargs_v 
)
static

Definition at line 292 of file dylib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dylib_find_proc()

int dylib_find_proc ( void *  pc,
void **  proc_beg,
void **  mod_beg 
)

Definition at line 182 of file dylib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dylib_find_proc_name()

const char* dylib_find_proc_name ( const void *  pc)

Definition at line 230 of file dylib.c.

◆ dylib_get_segment_bounds()

void dylib_get_segment_bounds ( struct dl_phdr_info *  info,
struct dylib_seg_bounds_s bounds 
)

Definition at line 249 of file dylib.c.

Here is the caller graph for this function:

◆ dylib_isin_start_func()

bool dylib_isin_start_func ( void *  pc)

Definition at line 216 of file dylib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dylib_map_executable()

void dylib_map_executable ( )

Definition at line 136 of file dylib.c.

Here is the call graph for this function:

◆ dylib_map_open_dsos()

void dylib_map_open_dsos ( )

Definition at line 125 of file dylib.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dylib_map_open_dsos_callback()

static int dylib_map_open_dsos_callback ( struct dl_phdr_info *  info,
size_t  size,
void *  unused 
)
static

Definition at line 278 of file dylib.c.

Here is the call graph for this function:
Here is the caller graph for this function: