Linux Perf
dso.h File Reference
#include <linux/refcount.h>
#include <linux/types.h>
#include <linux/rbtree.h>
#include <sys/types.h>
#include <stdbool.h>
#include "rwsem.h"
#include <linux/bitops.h>
#include "map.h"
#include "namespaces.h"
#include "build-id.h"
Include dependency graph for dso.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  dso_cache
 
struct  dsos
 
struct  dso
 
struct  kmod_path
 

Macros

#define DSO__SWAP(dso, type, val)
 
#define DSO__DATA_CACHE_SIZE   4096
 
#define DSO__DATA_CACHE_MASK   ~(DSO__DATA_CACHE_SIZE - 1)
 
#define dso__for_each_symbol(dso, pos, n)   symbols__for_each_entry(&(dso)->symbols, pos, n)
 
#define dso__zput(dso)   __dso__zput(&dso)
 
#define KMOD_DECOMP_NAME   "/tmp/perf-kmod-XXXXXX"
 
#define KMOD_DECOMP_LEN   sizeof(KMOD_DECOMP_NAME)
 
#define kmod_path__parse(__m, __p)   __kmod_path__parse(__m, __p, false, false)
 
#define kmod_path__parse_name(__m, __p)   __kmod_path__parse(__m, __p, true , false)
 
#define kmod_path__parse_ext(__m, __p)   __kmod_path__parse(__m, __p, false, true)
 

Enumerations

enum  dso_binary_type {
  DSO_BINARY_TYPE__KALLSYMS = 0, DSO_BINARY_TYPE__GUEST_KALLSYMS, DSO_BINARY_TYPE__VMLINUX, DSO_BINARY_TYPE__GUEST_VMLINUX,
  DSO_BINARY_TYPE__JAVA_JIT, DSO_BINARY_TYPE__DEBUGLINK, DSO_BINARY_TYPE__BUILD_ID_CACHE, DSO_BINARY_TYPE__BUILD_ID_CACHE_DEBUGINFO,
  DSO_BINARY_TYPE__FEDORA_DEBUGINFO, DSO_BINARY_TYPE__UBUNTU_DEBUGINFO, DSO_BINARY_TYPE__BUILDID_DEBUGINFO, DSO_BINARY_TYPE__SYSTEM_PATH_DSO,
  DSO_BINARY_TYPE__GUEST_KMODULE, DSO_BINARY_TYPE__GUEST_KMODULE_COMP, DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE, DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP,
  DSO_BINARY_TYPE__KCORE, DSO_BINARY_TYPE__GUEST_KCORE, DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO, DSO_BINARY_TYPE__NOT_FOUND
}
 
enum  dso_kernel_type { DSO_TYPE_USER = 0, DSO_TYPE_KERNEL, DSO_TYPE_GUEST_KERNEL }
 
enum  dso_swap_type { DSO_SWAP__UNSET, DSO_SWAP__NO, DSO_SWAP__YES }
 
enum  dso_data_status { DSO_DATA_STATUS_ERROR = -1, DSO_DATA_STATUS_UNKNOWN = 0, DSO_DATA_STATUS_OK = 1 }
 
enum  dso_data_status_seen { DSO_DATA_STATUS_SEEN_ITRACE }
 
enum  dso_type { DSO__TYPE_UNKNOWN, DSO__TYPE_64BIT, DSO__TYPE_32BIT, DSO__TYPE_X32BIT }
 
enum  dso_load_errno {
  DSO_LOAD_ERRNO__SUCCESS = 0, __DSO_LOAD_ERRNO__START = -10000, DSO_LOAD_ERRNO__INTERNAL_ERROR = __DSO_LOAD_ERRNO__START, DSO_LOAD_ERRNO__INVALID_ELF,
  DSO_LOAD_ERRNO__CANNOT_READ_BUILDID, DSO_LOAD_ERRNO__MISMATCHING_BUILDID, DSO_LOAD_ERRNO__DECOMPRESSION_FAILURE, __DSO_LOAD_ERRNO__END
}
 

Functions

static void dso__set_loaded (struct dso *dso)
 
struct dsodso__new (const char *name)
 
void dso__delete (struct dso *dso)
 
void dso__set_short_name (struct dso *dso, const char *name, bool name_allocated)
 
void dso__set_long_name (struct dso *dso, const char *name, bool name_allocated)
 
int dso__name_len (const struct dso *dso)
 
struct dsodso__get (struct dso *dso)
 
void dso__put (struct dso *dso)
 
static void __dso__zput (struct dso **dso)
 
bool dso__loaded (const struct dso *dso)
 
static bool dso__has_symbols (const struct dso *dso)
 
bool dso__sorted_by_name (const struct dso *dso)
 
void dso__set_sorted_by_name (struct dso *dso)
 
void dso__sort_by_name (struct dso *dso)
 
void dso__set_build_id (struct dso *dso, void *build_id)
 
bool dso__build_id_equal (const struct dso *dso, u8 *build_id)
 
void dso__read_running_kernel_build_id (struct dso *dso, struct machine *machine)
 
int dso__kernel_module_get_build_id (struct dso *dso, const char *root_dir)
 
char dso__symtab_origin (const struct dso *dso)
 
int dso__read_binary_type_filename (const struct dso *dso, enum dso_binary_type type, char *root_dir, char *filename, size_t size)
 
bool is_supported_compression (const char *ext)
 
bool is_kernel_module (const char *pathname, int cpumode)
 
bool decompress_to_file (const char *ext, const char *filename, int output_fd)
 
bool dso__needs_decompress (struct dso *dso)
 
int dso__decompress_kmodule_fd (struct dso *dso, const char *name)
 
int dso__decompress_kmodule_path (struct dso *dso, const char *name, char *pathname, size_t len)
 
int __kmod_path__parse (struct kmod_path *m, const char *path, bool alloc_name, bool alloc_ext)
 
void dso__set_module_info (struct dso *dso, struct kmod_path *m, struct machine *machine)
 
int dso__data_get_fd (struct dso *dso, struct machine *machine)
 
void dso__data_put_fd (struct dso *dso)
 
void dso__data_close (struct dso *dso)
 
off_t dso__data_size (struct dso *dso, struct machine *machine)
 
ssize_t dso__data_read_offset (struct dso *dso, struct machine *machine, u64 offset, u8 *data, ssize_t size)
 
ssize_t dso__data_read_addr (struct dso *dso, struct map *map, struct machine *machine, u64 addr, u8 *data, ssize_t size)
 
bool dso__data_status_seen (struct dso *dso, enum dso_data_status_seen by)
 
struct mapdso__new_map (const char *name)
 
struct dsomachine__findnew_kernel (struct machine *machine, const char *name, const char *short_name, int dso_type)
 
void __dsos__add (struct dsos *dsos, struct dso *dso)
 
void dsos__add (struct dsos *dsos, struct dso *dso)
 
struct dso__dsos__addnew (struct dsos *dsos, const char *name)
 
struct dso__dsos__find (struct dsos *dsos, const char *name, bool cmp_short)
 
struct dsodsos__find (struct dsos *dsos, const char *name, bool cmp_short)
 
struct dso__dsos__findnew (struct dsos *dsos, const char *name)
 
struct dsodsos__findnew (struct dsos *dsos, const char *name)
 
bool __dsos__read_build_ids (struct list_head *head, bool with_hits)
 
void dso__reset_find_symbol_cache (struct dso *dso)
 
size_t __dsos__fprintf_buildid (struct list_head *head, FILE *fp, bool(skip)(struct dso *dso, int parm), int parm)
 
size_t __dsos__fprintf (struct list_head *head, FILE *fp)
 
size_t dso__fprintf_buildid (struct dso *dso, FILE *fp)
 
size_t dso__fprintf_symbols_by_name (struct dso *dso, FILE *fp)
 
size_t dso__fprintf (struct dso *dso, FILE *fp)
 
static bool dso__is_vmlinux (struct dso *dso)
 
static bool dso__is_kcore (struct dso *dso)
 
static bool dso__is_kallsyms (struct dso *dso)
 
void dso__free_a2l (struct dso *dso)
 
enum dso_type dso__type (struct dso *dso, struct machine *machine)
 
int dso__strerror_load (struct dso *dso, char *buf, size_t buflen)
 
void reset_fd_limit (void)
 

Macro Definition Documentation

◆ DSO__DATA_CACHE_MASK

#define DSO__DATA_CACHE_MASK   ~(DSO__DATA_CACHE_SIZE - 1)

Definition at line 117 of file dso.h.

◆ DSO__DATA_CACHE_SIZE

#define DSO__DATA_CACHE_SIZE   4096

Definition at line 116 of file dso.h.

◆ dso__for_each_symbol

#define dso__for_each_symbol (   dso,
  pos,
 
)    symbols__for_each_entry(&(dso)->symbols, pos, n)

Definition at line 206 of file dso.h.

◆ DSO__SWAP

#define DSO__SWAP (   dso,
  type,
  val 
)
Value:
({ \
type ____r = val; \
switch (sizeof(____r)) { \
case 2: \
____r = bswap_16(val); \
break; \
case 4: \
____r = bswap_32(val); \
break; \
case 8: \
____r = bswap_64(val); \
break; \
default: \
BUG_ON(1); \
} \
} \
____r; \
})
enum dso_swap_type needs_swap
Definition: dso.h:155
Definition: dso.h:138

Definition at line 94 of file dso.h.

◆ dso__zput

#define dso__zput (   dso)    __dso__zput(&dso)

Definition at line 231 of file dso.h.

◆ KMOD_DECOMP_LEN

#define KMOD_DECOMP_LEN   sizeof(KMOD_DECOMP_NAME)

Definition at line 262 of file dso.h.

◆ KMOD_DECOMP_NAME

#define KMOD_DECOMP_NAME   "/tmp/perf-kmod-XXXXXX"

Definition at line 261 of file dso.h.

◆ kmod_path__parse

#define kmod_path__parse (   __m,
  __p 
)    __kmod_path__parse(__m, __p, false, false)

Definition at line 274 of file dso.h.

◆ kmod_path__parse_ext

#define kmod_path__parse_ext (   __m,
  __p 
)    __kmod_path__parse(__m, __p, false, true)

Definition at line 276 of file dso.h.

◆ kmod_path__parse_name

#define kmod_path__parse_name (   __m,
  __p 
)    __kmod_path__parse(__m, __p, true , false)

Definition at line 275 of file dso.h.

Enumeration Type Documentation

◆ dso_binary_type

Enumerator
DSO_BINARY_TYPE__KALLSYMS 
DSO_BINARY_TYPE__GUEST_KALLSYMS 
DSO_BINARY_TYPE__VMLINUX 
DSO_BINARY_TYPE__GUEST_VMLINUX 
DSO_BINARY_TYPE__JAVA_JIT 
DSO_BINARY_TYPE__DEBUGLINK 
DSO_BINARY_TYPE__BUILD_ID_CACHE 
DSO_BINARY_TYPE__BUILD_ID_CACHE_DEBUGINFO 
DSO_BINARY_TYPE__FEDORA_DEBUGINFO 
DSO_BINARY_TYPE__UBUNTU_DEBUGINFO 
DSO_BINARY_TYPE__BUILDID_DEBUGINFO 
DSO_BINARY_TYPE__SYSTEM_PATH_DSO 
DSO_BINARY_TYPE__GUEST_KMODULE 
DSO_BINARY_TYPE__GUEST_KMODULE_COMP 
DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE 
DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP 
DSO_BINARY_TYPE__KCORE 
DSO_BINARY_TYPE__GUEST_KCORE 
DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO 
DSO_BINARY_TYPE__NOT_FOUND 

Definition at line 17 of file dso.h.

◆ dso_data_status

Enumerator
DSO_DATA_STATUS_ERROR 
DSO_DATA_STATUS_UNKNOWN 
DSO_DATA_STATUS_OK 

Definition at line 52 of file dso.h.

◆ dso_data_status_seen

Enumerator
DSO_DATA_STATUS_SEEN_ITRACE 

Definition at line 58 of file dso.h.

◆ dso_kernel_type

Enumerator
DSO_TYPE_USER 
DSO_TYPE_KERNEL 
DSO_TYPE_GUEST_KERNEL 

Definition at line 40 of file dso.h.

◆ dso_load_errno

Enumerator
DSO_LOAD_ERRNO__SUCCESS 
__DSO_LOAD_ERRNO__START 
DSO_LOAD_ERRNO__INTERNAL_ERROR 
DSO_LOAD_ERRNO__INVALID_ELF 
DSO_LOAD_ERRNO__CANNOT_READ_BUILDID 
DSO_LOAD_ERRNO__MISMATCHING_BUILDID 
DSO_LOAD_ERRNO__DECOMPRESSION_FAILURE 
__DSO_LOAD_ERRNO__END 

Definition at line 69 of file dso.h.

◆ dso_swap_type

Enumerator
DSO_SWAP__UNSET 
DSO_SWAP__NO 
DSO_SWAP__YES 

Definition at line 46 of file dso.h.

◆ dso_type

enum dso_type
Enumerator
DSO__TYPE_UNKNOWN 
DSO__TYPE_64BIT 
DSO__TYPE_32BIT 
DSO__TYPE_X32BIT 

Definition at line 62 of file dso.h.

Function Documentation

◆ __dso__zput()

static void __dso__zput ( struct dso **  dso)
inlinestatic

Definition at line 225 of file dso.h.

Here is the call graph for this function:

◆ __dsos__add()

void __dsos__add ( struct dsos dsos,
struct dso dso 
)

Definition at line 1345 of file dso.c.

Here is the call graph for this function:

◆ __dsos__addnew()

struct dso* __dsos__addnew ( struct dsos dsos,
const char *  name 
)

Definition at line 1401 of file dso.c.

Here is the call graph for this function:

◆ __dsos__find()

struct dso* __dsos__find ( struct dsos dsos,
const char *  name,
bool  cmp_short 
)

Definition at line 1379 of file dso.c.

Here is the call graph for this function:

◆ __dsos__findnew()

struct dso* __dsos__findnew ( struct dsos dsos,
const char *  name 
)

Definition at line 1414 of file dso.c.

Here is the call graph for this function:

◆ __dsos__fprintf()

size_t __dsos__fprintf ( struct list_head *  head,
FILE *  fp 
)

Definition at line 1445 of file dso.c.

Here is the call graph for this function:

◆ __dsos__fprintf_buildid()

size_t __dsos__fprintf_buildid ( struct list_head *  head,
FILE *  fp,
bool(skip)(struct dso *dso, int parm)  ,
int  parm 
)

Definition at line 1430 of file dso.c.

Here is the call graph for this function:

◆ __dsos__read_build_ids()

bool __dsos__read_build_ids ( struct list_head *  head,
bool  with_hits 
)

Definition at line 1320 of file dso.c.

Here is the call graph for this function:

◆ __kmod_path__parse()

int __kmod_path__parse ( struct kmod_path m,
const char *  path,
bool  alloc_name,
bool  alloc_ext 
)

Definition at line 334 of file dso.c.

Here is the call graph for this function:

◆ decompress_to_file()

bool decompress_to_file ( const char *  ext,
const char *  filename,
int  output_fd 
)

Definition at line 242 of file dso.c.

◆ dso__build_id_equal()

bool dso__build_id_equal ( const struct dso dso,
u8 *  build_id 
)

Definition at line 1282 of file dso.c.

◆ dso__data_close()

void dso__data_close ( struct dso dso)

dso__data_close - Close DSO data file : dso object

External interface to close 's data file descriptor.

Definition at line 630 of file dso.c.

Here is the call graph for this function:

◆ dso__data_get_fd()

int dso__data_get_fd ( struct dso dso,
struct machine machine 
)

dso__data_get_fd - Get dso's data file descriptor : dso object : machine object

External interface to find dso's file, open it and returns file descriptor. It should be paired with dso__data_put_fd() if it returns non-negative value.

Definition at line 678 of file dso.c.

Here is the call graph for this function:

◆ dso__data_put_fd()

void dso__data_put_fd ( struct dso dso)

◆ dso__data_read_addr()

ssize_t dso__data_read_addr ( struct dso dso,
struct map map,
struct machine machine,
u64  addr,
u8 *  data,
ssize_t  size 
)

dso__data_read_addr - Read data from dso address : dso object : machine object : virtual memory address : buffer to store data : size of the buffer

External interface to read data from dso address.

Definition at line 1005 of file dso.c.

Here is the call graph for this function:

◆ dso__data_read_offset()

ssize_t dso__data_read_offset ( struct dso dso,
struct machine machine,
u64  offset,
u8 *  data,
ssize_t  size 
)

dso__data_read_offset - Read data from dso file offset : dso object : machine object : file offset : buffer to store data : size of the buffer

External interface to read data from dso file offset. Open dso data file and use cached_read to get the data.

Definition at line 986 of file dso.c.

Here is the call graph for this function:

◆ dso__data_size()

off_t dso__data_size ( struct dso dso,
struct machine machine 
)

dso__data_size - Return dso data size : dso object : machine object

Return: dso data size

Definition at line 950 of file dso.c.

Here is the call graph for this function:

◆ dso__data_status_seen()

bool dso__data_status_seen ( struct dso dso,
enum dso_data_status_seen  by 
)

Definition at line 699 of file dso.c.

◆ dso__decompress_kmodule_fd()

int dso__decompress_kmodule_fd ( struct dso dso,
const char *  name 
)

Definition at line 291 of file dso.c.

Here is the call graph for this function:

◆ dso__decompress_kmodule_path()

int dso__decompress_kmodule_path ( struct dso dso,
const char *  name,
char *  pathname,
size_t  len 
)

Definition at line 301 of file dso.c.

Here is the call graph for this function:

◆ dso__delete()

void dso__delete ( struct dso dso)

Definition at line 1232 of file dso.c.

Here is the call graph for this function:

◆ dso__fprintf()

size_t dso__fprintf ( struct dso dso,
FILE *  fp 
)

Definition at line 1465 of file dso.c.

Here is the call graph for this function:

◆ dso__fprintf_buildid()

size_t dso__fprintf_buildid ( struct dso dso,
FILE *  fp 
)

Definition at line 1457 of file dso.c.

Here is the call graph for this function:

◆ dso__fprintf_symbols_by_name()

size_t dso__fprintf_symbols_by_name ( struct dso dso,
FILE *  fp 
)

Definition at line 60 of file symbol_fprintf.c.

◆ dso__free_a2l()

void dso__free_a2l ( struct dso dso)

◆ dso__get()

struct dso* dso__get ( struct dso dso)

Definition at line 1263 of file dso.c.

◆ dso__has_symbols()

static bool dso__has_symbols ( const struct dso dso)
inlinestatic

Definition at line 235 of file dso.h.

Here is the call graph for this function:

◆ dso__is_kallsyms()

static bool dso__is_kallsyms ( struct dso dso)
inlinestatic

Definition at line 371 of file dso.h.

Here is the call graph for this function:

◆ dso__is_kcore()

static bool dso__is_kcore ( struct dso dso)
inlinestatic

Definition at line 365 of file dso.h.

◆ dso__is_vmlinux()

static bool dso__is_vmlinux ( struct dso dso)
inlinestatic

Definition at line 359 of file dso.h.

◆ dso__kernel_module_get_build_id()

int dso__kernel_module_get_build_id ( struct dso dso,
const char *  root_dir 
)

Definition at line 1299 of file dso.c.

Here is the call graph for this function:

◆ dso__loaded()

bool dso__loaded ( const struct dso dso)

Definition at line 1181 of file dso.c.

◆ dso__name_len()

int dso__name_len ( const struct dso dso)

Definition at line 1171 of file dso.c.

◆ dso__needs_decompress()

bool dso__needs_decompress ( struct dso dso)

Definition at line 254 of file dso.c.

◆ dso__new()

struct dso* dso__new ( const char *  name)

Definition at line 1196 of file dso.c.

Here is the call graph for this function:

◆ dso__new_map()

struct map* dso__new_map ( const char *  name)

Definition at line 1013 of file dso.c.

Here is the call graph for this function:

◆ dso__put()

void dso__put ( struct dso dso)

Definition at line 1270 of file dso.c.

Here is the call graph for this function:

◆ dso__read_binary_type_filename()

int dso__read_binary_type_filename ( const struct dso dso,
enum dso_binary_type  type,
char *  root_dir,
char *  filename,
size_t  size 
)

Definition at line 57 of file dso.c.

Here is the call graph for this function:

◆ dso__read_running_kernel_build_id()

void dso__read_running_kernel_build_id ( struct dso dso,
struct machine machine 
)

Definition at line 1287 of file dso.c.

Here is the call graph for this function:

◆ dso__reset_find_symbol_cache()

void dso__reset_find_symbol_cache ( struct dso dso)

Definition at line 478 of file symbol.c.

◆ dso__set_build_id()

void dso__set_build_id ( struct dso dso,
void *  build_id 
)

Definition at line 1276 of file dso.c.

Here is the call graph for this function:

◆ dso__set_loaded()

static void dso__set_loaded ( struct dso dso)
inlinestatic

Definition at line 209 of file dso.h.

Here is the call graph for this function:

◆ dso__set_long_name()

void dso__set_long_name ( struct dso dso,
const char *  name,
bool  name_allocated 
)

Definition at line 1104 of file dso.c.

Here is the call graph for this function:

◆ dso__set_module_info()

void dso__set_module_info ( struct dso dso,
struct kmod_path m,
struct machine machine 
)

Definition at line 407 of file dso.c.

Here is the call graph for this function:

◆ dso__set_short_name()

void dso__set_short_name ( struct dso dso,
const char *  name,
bool  name_allocated 
)

Definition at line 1132 of file dso.c.

Here is the call graph for this function:

◆ dso__set_sorted_by_name()

void dso__set_sorted_by_name ( struct dso dso)

Definition at line 1191 of file dso.c.

◆ dso__sort_by_name()

void dso__sort_by_name ( struct dso dso)

Definition at line 542 of file symbol.c.

Here is the call graph for this function:

◆ dso__sorted_by_name()

bool dso__sorted_by_name ( const struct dso dso)

Definition at line 1186 of file dso.c.

◆ dso__strerror_load()

int dso__strerror_load ( struct dso dso,
char *  buf,
size_t  buflen 
)

Definition at line 1497 of file dso.c.

◆ dso__symtab_origin()

char dso__symtab_origin ( const struct dso dso)

Definition at line 30 of file dso.c.

◆ dso__type()

enum dso_type dso__type ( struct dso dso,
struct machine machine 
)

Definition at line 1483 of file dso.c.

Here is the call graph for this function:

◆ dsos__add()

void dsos__add ( struct dsos dsos,
struct dso dso 
)

Definition at line 1372 of file dso.c.

Here is the call graph for this function:

◆ dsos__find()

struct dso* dsos__find ( struct dsos dsos,
const char *  name,
bool  cmp_short 
)

Definition at line 1392 of file dso.c.

Here is the call graph for this function:

◆ dsos__findnew()

struct dso* dsos__findnew ( struct dsos dsos,
const char *  name 
)

Definition at line 1421 of file dso.c.

Here is the call graph for this function:

◆ is_kernel_module()

bool is_kernel_module ( const char *  pathname,
int  cpumode 
)

Definition at line 216 of file dso.c.

◆ is_supported_compression()

bool is_supported_compression ( const char *  ext)

Definition at line 205 of file dso.c.

◆ machine__findnew_kernel()

struct dso* machine__findnew_kernel ( struct machine machine,
const char *  name,
const char *  short_name,
int  dso_type 
)

Definition at line 1024 of file dso.c.

Here is the call graph for this function:

◆ reset_fd_limit()

void reset_fd_limit ( void  )

Definition at line 595 of file dso.c.