Linux Perf
build-id.c File Reference
#include "util.h"
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "build-id.h"
#include "event.h"
#include "symbol.h"
#include "thread.h"
#include <linux/kernel.h>
#include "debug.h"
#include "session.h"
#include "tool.h"
#include "header.h"
#include "vdso.h"
#include "path.h"
#include "probe-file.h"
#include "strlist.h"
#include "sane_ctype.h"
Include dependency graph for build-id.c:

Go to the source code of this file.

Macros

#define dsos__for_each_with_build_id(pos, head)
 
#define build_id_cache__add_sdt_cache(sbuild_id, realname, nsi)   (0)
 

Functions

int build_id__mark_dso_hit (struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct perf_evsel *evsel __maybe_unused, struct machine *machine)
 
static int perf_event__exit_del_thread (struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine)
 
int build_id__sprintf (const u8 *build_id, int len, char *bf)
 
int sysfs__sprintf_build_id (const char *root_dir, char *sbuild_id)
 
int filename__sprintf_build_id (const char *pathname, char *sbuild_id)
 
static int asnprintf (char **strp, size_t size, const char *fmt,...)
 
char * build_id_cache__kallsyms_path (const char *sbuild_id, char *bf, size_t size)
 
char * build_id_cache__linkname (const char *sbuild_id, char *bf, size_t size)
 
char * build_id_cache__origname (const char *sbuild_id)
 
static bool build_id_cache__valid_id (char *sbuild_id)
 
static const char * build_id_cache__basename (bool is_kallsyms, bool is_vdso, bool is_debug)
 
char * dso__build_id_filename (const struct dso *dso, char *bf, size_t size, bool is_debug)
 
static int write_buildid (const char *name, size_t name_len, u8 *build_id, pid_t pid, u16 misc, struct feat_fd *fd)
 
static int machine__write_buildid_table (struct machine *machine, struct feat_fd *fd)
 
int perf_session__write_buildid_table (struct perf_session *session, struct feat_fd *fd)
 
static int __dsos__hit_all (struct list_head *head)
 
static int machine__hit_all_dsos (struct machine *machine)
 
int dsos__hit_all (struct perf_session *session)
 
void disable_buildid_cache (void)
 
static bool lsdir_bid_head_filter (const char *name __maybe_unused, struct dirent *d)
 
static bool lsdir_bid_tail_filter (const char *name __maybe_unused, struct dirent *d)
 
struct strlistbuild_id_cache__list_all (bool validonly)
 
static bool str_is_build_id (const char *maybe_sbuild_id, size_t len)
 
char * build_id_cache__complement (const char *incomplete_sbuild_id)
 
char * build_id_cache__cachedir (const char *sbuild_id, const char *name, struct nsinfo *nsi, bool is_kallsyms, bool is_vdso)
 
int build_id_cache__list_build_ids (const char *pathname, struct nsinfo *nsi, struct strlist **result)
 
static char * build_id_cache__find_debug (const char *sbuild_id, struct nsinfo *nsi)
 
int build_id_cache__add_s (const char *sbuild_id, const char *name, struct nsinfo *nsi, bool is_kallsyms, bool is_vdso)
 
static int build_id_cache__add_b (const u8 *build_id, size_t build_id_size, const char *name, struct nsinfo *nsi, bool is_kallsyms, bool is_vdso)
 
bool build_id_cache__cached (const char *sbuild_id)
 
int build_id_cache__remove_s (const char *sbuild_id)
 
static int dso__cache_build_id (struct dso *dso, struct machine *machine)
 
static int __dsos__cache_build_ids (struct list_head *head, struct machine *machine)
 
static int machine__cache_build_ids (struct machine *machine)
 
int perf_session__cache_build_ids (struct perf_session *session)
 
static bool machine__read_build_ids (struct machine *machine, bool with_hits)
 
bool perf_session__read_build_ids (struct perf_session *session, bool with_hits)
 

Variables

static bool no_buildid_cache
 
struct perf_tool build_id__mark_dso_hit_ops
 

Macro Definition Documentation

◆ build_id_cache__add_sdt_cache

#define build_id_cache__add_sdt_cache (   sbuild_id,
  realname,
  nsi 
)    (0)

Definition at line 606 of file build-id.c.

◆ dsos__for_each_with_build_id

#define dsos__for_each_with_build_id (   pos,
  head 
)
Value:
list_for_each_entry(pos, head, node) \
if (!pos->has_build_id) \
continue; \
else
Definition: mem2node.c:7

Definition at line 284 of file build-id.c.

Function Documentation

◆ __dsos__cache_build_ids()

static int __dsos__cache_build_ids ( struct list_head *  head,
struct machine machine 
)
static

Definition at line 821 of file build-id.c.

Here is the call graph for this function:

◆ __dsos__hit_all()

static int __dsos__hit_all ( struct list_head *  head)
static

Definition at line 375 of file build-id.c.

◆ asnprintf()

static int asnprintf ( char **  strp,
size_t  size,
const char *  fmt,
  ... 
)
static

Definition at line 137 of file build-id.c.

◆ build_id__mark_dso_hit()

int build_id__mark_dso_hit ( struct perf_tool *tool  __maybe_unused,
union perf_event event,
struct perf_sample sample,
struct perf_evsel *evsel  __maybe_unused,
struct machine machine 
)

Definition at line 34 of file build-id.c.

Here is the call graph for this function:

◆ build_id__sprintf()

int build_id__sprintf ( const u8 *  build_id,
int  len,
char *  bf 
)

Definition at line 89 of file build-id.c.

Here is the call graph for this function:

◆ build_id_cache__add_b()

static int build_id_cache__add_b ( const u8 *  build_id,
size_t  build_id_size,
const char *  name,
struct nsinfo nsi,
bool  is_kallsyms,
bool  is_vdso 
)
static

Definition at line 745 of file build-id.c.

Here is the call graph for this function:

◆ build_id_cache__add_s()

int build_id_cache__add_s ( const char *  sbuild_id,
const char *  name,
struct nsinfo nsi,
bool  is_kallsyms,
bool  is_vdso 
)

Definition at line 636 of file build-id.c.

Here is the call graph for this function:

◆ build_id_cache__basename()

static const char* build_id_cache__basename ( bool  is_kallsyms,
bool  is_vdso,
bool  is_debug 
)
static

Definition at line 245 of file build-id.c.

◆ build_id_cache__cached()

bool build_id_cache__cached ( const char *  sbuild_id)

Definition at line 757 of file build-id.c.

Here is the call graph for this function:

◆ build_id_cache__cachedir()

char* build_id_cache__cachedir ( const char *  sbuild_id,
const char *  name,
struct nsinfo nsi,
bool  is_kallsyms,
bool  is_vdso 
)

Definition at line 539 of file build-id.c.

Here is the call graph for this function:

◆ build_id_cache__complement()

char* build_id_cache__complement ( const char *  incomplete_sbuild_id)

Definition at line 508 of file build-id.c.

Here is the call graph for this function:

◆ build_id_cache__find_debug()

static char* build_id_cache__find_debug ( const char *  sbuild_id,
struct nsinfo nsi 
)
static

Definition at line 609 of file build-id.c.

Here is the call graph for this function:

◆ build_id_cache__kallsyms_path()

char* build_id_cache__kallsyms_path ( const char *  sbuild_id,
char *  bf,
size_t  size 
)

Definition at line 155 of file build-id.c.

◆ build_id_cache__linkname()

char* build_id_cache__linkname ( const char *  sbuild_id,
char *  bf,
size_t  size 
)

Definition at line 176 of file build-id.c.

Here is the call graph for this function:

◆ build_id_cache__list_all()

struct strlist* build_id_cache__list_all ( bool  validonly)

Definition at line 431 of file build-id.c.

Here is the call graph for this function:

◆ build_id_cache__list_build_ids()

int build_id_cache__list_build_ids ( const char *  pathname,
struct nsinfo nsi,
struct strlist **  result 
)

Definition at line 563 of file build-id.c.

Here is the call graph for this function:

◆ build_id_cache__origname()

char* build_id_cache__origname ( const char *  sbuild_id)

Definition at line 186 of file build-id.c.

Here is the call graph for this function:

◆ build_id_cache__remove_s()

int build_id_cache__remove_s ( const char *  sbuild_id)

Definition at line 769 of file build-id.c.

Here is the call graph for this function:

◆ build_id_cache__valid_id()

static bool build_id_cache__valid_id ( char *  sbuild_id)
static

Definition at line 221 of file build-id.c.

Here is the call graph for this function:

◆ disable_buildid_cache()

void disable_buildid_cache ( void  )

Definition at line 410 of file build-id.c.

◆ dso__build_id_filename()

char* dso__build_id_filename ( const struct dso dso,
char *  bf,
size_t  size,
bool  is_debug 
)

Definition at line 252 of file build-id.c.

Here is the call graph for this function:

◆ dso__cache_build_id()

static int dso__cache_build_id ( struct dso dso,
struct machine machine 
)
static

Definition at line 807 of file build-id.c.

Here is the call graph for this function:

◆ dsos__hit_all()

int dsos__hit_all ( struct perf_session session)

Definition at line 390 of file build-id.c.

Here is the call graph for this function:

◆ filename__sprintf_build_id()

int filename__sprintf_build_id ( const char *  pathname,
char *  sbuild_id 
)

Definition at line 122 of file build-id.c.

Here is the call graph for this function:

◆ lsdir_bid_head_filter()

static bool lsdir_bid_head_filter ( const char *name  __maybe_unused,
struct dirent *  d 
)
static

Definition at line 415 of file build-id.c.

◆ lsdir_bid_tail_filter()

static bool lsdir_bid_tail_filter ( const char *name  __maybe_unused,
struct dirent *  d 
)
static

Definition at line 422 of file build-id.c.

◆ machine__cache_build_ids()

static int machine__cache_build_ids ( struct machine machine)
static

Definition at line 834 of file build-id.c.

Here is the call graph for this function:

◆ machine__hit_all_dsos()

static int machine__hit_all_dsos ( struct machine machine)
static

Definition at line 385 of file build-id.c.

Here is the call graph for this function:

◆ machine__read_build_ids()

static bool machine__read_build_ids ( struct machine machine,
bool  with_hits 
)
static

Definition at line 859 of file build-id.c.

Here is the call graph for this function:

◆ machine__write_buildid_table()

static int machine__write_buildid_table ( struct machine machine,
struct feat_fd fd 
)
static

Definition at line 313 of file build-id.c.

Here is the call graph for this function:

◆ perf_event__exit_del_thread()

static int perf_event__exit_del_thread ( struct perf_tool *tool  __maybe_unused,
union perf_event event,
struct perf_sample *sample  __maybe_unused,
struct machine machine 
)
static

Definition at line 57 of file build-id.c.

Here is the call graph for this function:

◆ perf_session__cache_build_ids()

int perf_session__cache_build_ids ( struct perf_session session)

Definition at line 839 of file build-id.c.

Here is the call graph for this function:

◆ perf_session__read_build_ids()

bool perf_session__read_build_ids ( struct perf_session session,
bool  with_hits 
)

Definition at line 864 of file build-id.c.

Here is the call graph for this function:

◆ perf_session__write_buildid_table()

int perf_session__write_buildid_table ( struct perf_session session,
struct feat_fd fd 
)

Definition at line 357 of file build-id.c.

Here is the call graph for this function:

◆ str_is_build_id()

static bool str_is_build_id ( const char *  maybe_sbuild_id,
size_t  len 
)
static

Definition at line 496 of file build-id.c.

◆ sysfs__sprintf_build_id()

int sysfs__sprintf_build_id ( const char *  root_dir,
char *  sbuild_id 
)

Definition at line 104 of file build-id.c.

Here is the call graph for this function:

◆ write_buildid()

static int write_buildid ( const char *  name,
size_t  name_len,
u8 *  build_id,
pid_t  pid,
u16  misc,
struct feat_fd fd 
)
static

Definition at line 290 of file build-id.c.

Here is the call graph for this function:

Variable Documentation

◆ build_id__mark_dso_hit_ops

struct perf_tool build_id__mark_dso_hit_ops
Initial value:
= {
.ordered_events = true,
}
int perf_event__process_attr(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_evlist **pevlist)
Definition: header.c:3721
int perf_event__process_mmap(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine)
Definition: event.c:1385
int perf_event__process_fork(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine)
Definition: event.c:1408
int perf_event__process_build_id(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_session *session)
Definition: header.c:3922
static int perf_event__exit_del_thread(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused, struct machine *machine)
Definition: build-id.c:57
int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct perf_evsel *evsel __maybe_unused, struct machine *machine)
Definition: build-id.c:34
int perf_event__process_mmap2(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, struct machine *machine)
Definition: event.c:1393

Definition at line 78 of file build-id.c.

◆ no_buildid_cache

bool no_buildid_cache
static

Definition at line 32 of file build-id.c.