Linux Perf
map.h File Reference
#include <linux/refcount.h>
#include <linux/compiler.h>
#include <linux/list.h>
#include <linux/rbtree.h>
#include <pthread.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <linux/types.h>
#include "rwsem.h"
Include dependency graph for map.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  map
 
struct  kmap
 
struct  maps
 
struct  map_groups
 

Macros

#define KMAP_NAME_LEN   256
 
#define map__for_each_symbol(map, pos, n)   dso__for_each_symbol(map->dso, pos, n)
 
#define __map__for_each_symbol_by_name(map, sym_name, pos)
 
#define map__for_each_symbol_by_name(map, sym_name, pos)   __map__for_each_symbol_by_name(map, sym_name, (pos))
 
#define map__zput(map)   __map__zput(&map)
 
#define ENTRY_TRAMPOLINE_NAME   "__entry_SYSCALL_64_trampoline"
 

Functions

struct map_groupsmap_groups__new (struct machine *machine)
 
void map_groups__delete (struct map_groups *mg)
 
bool map_groups__empty (struct map_groups *mg)
 
static struct map_groupsmap_groups__get (struct map_groups *mg)
 
void map_groups__put (struct map_groups *mg)
 
struct kmap__map__kmap (struct map *map)
 
struct kmapmap__kmap (struct map *map)
 
struct map_groupsmap__kmaps (struct map *map)
 
static u64 map__map_ip (struct map *map, u64 ip)
 
static u64 map__unmap_ip (struct map *map, u64 ip)
 
static u64 identity__map_ip (struct map *map __maybe_unused, u64 ip)
 
static size_t map__size (const struct map *map)
 
u64 map__rip_2objdump (struct map *map, u64 rip)
 
u64 map__objdump_2mem (struct map *map, u64 ip)
 
void map__init (struct map *map, u64 start, u64 end, u64 pgoff, struct dso *dso)
 
struct mapmap__new (struct machine *machine, u64 start, u64 len, u64 pgoff, u32 d_maj, u32 d_min, u64 ino, u64 ino_gen, u32 prot, u32 flags, char *filename, struct thread *thread)
 
struct mapmap__new2 (u64 start, struct dso *dso)
 
void map__delete (struct map *map)
 
struct mapmap__clone (struct map *map)
 
static struct mapmap__get (struct map *map)
 
void map__put (struct map *map)
 
static void __map__zput (struct map **map)
 
int map__overlap (struct map *l, struct map *r)
 
size_t map__fprintf (struct map *map, FILE *fp)
 
size_t map__fprintf_dsoname (struct map *map, FILE *fp)
 
char * map__srcline (struct map *map, u64 addr, struct symbol *sym)
 
int map__fprintf_srcline (struct map *map, u64 addr, const char *prefix, FILE *fp)
 
int map__load (struct map *map)
 
struct symbolmap__find_symbol (struct map *map, u64 addr)
 
struct symbolmap__find_symbol_by_name (struct map *map, const char *name)
 
void map__fixup_start (struct map *map)
 
void map__fixup_end (struct map *map)
 
void map__reloc_vmlinux (struct map *map)
 
void maps__insert (struct maps *maps, struct map *map)
 
void maps__remove (struct maps *maps, struct map *map)
 
struct mapmaps__find (struct maps *maps, u64 addr)
 
struct mapmaps__first (struct maps *maps)
 
struct mapmap__next (struct map *map)
 
struct symbolmaps__find_symbol_by_name (struct maps *maps, const char *name, struct map **mapp)
 
void map_groups__init (struct map_groups *mg, struct machine *machine)
 
void map_groups__exit (struct map_groups *mg)
 
int map_groups__clone (struct thread *thread, struct map_groups *parent)
 
size_t map_groups__fprintf (struct map_groups *mg, FILE *fp)
 
int map__set_kallsyms_ref_reloc_sym (struct map *map, const char *symbol_name, u64 addr)
 
static void map_groups__insert (struct map_groups *mg, struct map *map)
 
static void map_groups__remove (struct map_groups *mg, struct map *map)
 
static struct mapmap_groups__find (struct map_groups *mg, u64 addr)
 
struct mapmap_groups__first (struct map_groups *mg)
 
static struct mapmap_groups__next (struct map *map)
 
struct symbolmap_groups__find_symbol (struct map_groups *mg, u64 addr, struct map **mapp)
 
struct symbolmap_groups__find_symbol_by_name (struct map_groups *mg, const char *name, struct map **mapp)
 
int map_groups__find_ams (struct addr_map_symbol *ams)
 
int map_groups__fixup_overlappings (struct map_groups *mg, struct map *map, FILE *fp)
 
struct mapmap_groups__find_by_name (struct map_groups *mg, const char *name)
 
bool __map__is_kernel (const struct map *map)
 
bool __map__is_extra_kernel_map (const struct map *map)
 
static bool __map__is_kmodule (const struct map *map)
 
bool map__has_symbols (const struct map *map)
 
static bool is_entry_trampoline (const char *name)
 

Macro Definition Documentation

◆ __map__for_each_symbol_by_name

#define __map__for_each_symbol_by_name (   map,
  sym_name,
  pos 
)
Value:
for (pos = map__find_symbol_by_name(map, sym_name); \
pos && \
!symbol__match_symbol_name(pos->name, sym_name, \
struct symbol * map__find_symbol_by_name(struct map *map, const char *name)
Definition: map.c:359
struct symbol * symbol__next_by_name(struct symbol *sym)
Definition: symbol.c:521
Definition: jevents.c:228
int symbol__match_symbol_name(const char *name, const char *str, enum symbol_tag_include includes)
Definition: symbol.c:417

Definition at line 132 of file map.h.

◆ ENTRY_TRAMPOLINE_NAME

#define ENTRY_TRAMPOLINE_NAME   "__entry_SYSCALL_64_trampoline"

Definition at line 249 of file map.h.

◆ KMAP_NAME_LEN

#define KMAP_NAME_LEN   256

Definition at line 50 of file map.h.

◆ map__for_each_symbol

#define map__for_each_symbol (   map,
  pos,
 
)    dso__for_each_symbol(map->dso, pos, n)

Definition at line 122 of file map.h.

◆ map__for_each_symbol_by_name

#define map__for_each_symbol_by_name (   map,
  sym_name,
  pos 
)    __map__for_each_symbol_by_name(map, sym_name, (pos))

Definition at line 139 of file map.h.

◆ map__zput

#define map__zput (   map)    __map__zput(&map)

Definition at line 167 of file map.h.

Function Documentation

◆ __map__is_extra_kernel_map()

bool __map__is_extra_kernel_map ( const struct map map)

Definition at line 255 of file map.c.

Here is the call graph for this function:

◆ __map__is_kernel()

bool __map__is_kernel ( const struct map map)

Definition at line 250 of file map.c.

Here is the call graph for this function:

◆ __map__is_kmodule()

static bool __map__is_kmodule ( const struct map map)
inlinestatic

Definition at line 242 of file map.h.

Here is the call graph for this function:

◆ __map__kmap()

struct kmap* __map__kmap ( struct map map)

Definition at line 874 of file map.c.

◆ __map__zput()

static void __map__zput ( struct map **  map)
inlinestatic

Definition at line 161 of file map.h.

Here is the call graph for this function:

◆ identity__map_ip()

static u64 identity__map_ip ( struct map *map  __maybe_unused,
u64  ip 
)
inlinestatic

Definition at line 96 of file map.h.

◆ is_entry_trampoline()

static bool is_entry_trampoline ( const char *  name)
inlinestatic

Definition at line 251 of file map.h.

◆ map__clone()

struct map* map__clone ( struct map map)

Definition at line 370 of file map.c.

Here is the call graph for this function:

◆ map__delete()

void map__delete ( struct map map)

Definition at line 273 of file map.c.

Here is the call graph for this function:

◆ map__find_symbol()

struct symbol* map__find_symbol ( struct map map,
u64  addr 
)

Definition at line 351 of file map.c.

Here is the call graph for this function:

◆ map__find_symbol_by_name()

struct symbol* map__find_symbol_by_name ( struct map map,
const char *  name 
)

Definition at line 359 of file map.c.

Here is the call graph for this function:

◆ map__fixup_end()

void map__fixup_end ( struct map map)

Definition at line 295 of file map.c.

Here is the call graph for this function:

◆ map__fixup_start()

void map__fixup_start ( struct map map)

Definition at line 285 of file map.c.

Here is the call graph for this function:

◆ map__fprintf()

size_t map__fprintf ( struct map map,
FILE *  fp 
)

Definition at line 398 of file map.c.

◆ map__fprintf_dsoname()

size_t map__fprintf_dsoname ( struct map map,
FILE *  fp 
)

Definition at line 404 of file map.c.

◆ map__fprintf_srcline()

int map__fprintf_srcline ( struct map map,
u64  addr,
const char *  prefix,
FILE *  fp 
)

Definition at line 425 of file map.c.

Here is the call graph for this function:

◆ map__get()

static struct map* map__get ( struct map map)
static

Definition at line 152 of file map.h.

Here is the call graph for this function:

◆ map__has_symbols()

bool map__has_symbols ( const struct map map)

Definition at line 262 of file map.c.

Here is the call graph for this function:

◆ map__init()

void map__init ( struct map map,
u64  start,
u64  end,
u64  pgoff,
struct dso dso 
)

Definition at line 127 of file map.c.

Here is the call graph for this function:

◆ map__kmap()

struct kmap* map__kmap ( struct map map)

Definition at line 881 of file map.c.

Here is the call graph for this function:

◆ map__kmaps()

struct map_groups* map__kmaps ( struct map map)

Definition at line 890 of file map.c.

Here is the call graph for this function:

◆ map__load()

int map__load ( struct map map)

Definition at line 307 of file map.c.

Here is the call graph for this function:

◆ map__map_ip()

static u64 map__map_ip ( struct map map,
u64  ip 
)
inlinestatic

Definition at line 86 of file map.h.

◆ map__new()

struct map* map__new ( struct machine machine,
u64  start,
u64  len,
u64  pgoff,
u32  d_maj,
u32  d_min,
u64  ino,
u64  ino_gen,
u32  prot,
u32  flags,
char *  filename,
struct thread thread 
)

Definition at line 142 of file map.c.

Here is the call graph for this function:

◆ map__new2()

struct map* map__new2 ( u64  start,
struct dso dso 
)

Definition at line 227 of file map.c.

Here is the call graph for this function:

◆ map__next()

struct map* map__next ( struct map map)

Definition at line 865 of file map.c.

◆ map__objdump_2mem()

u64 map__objdump_2mem ( struct map map,
u64  ip 
)

map__objdump_2mem - convert objdump address to a memory address. : memory map : objdump address

Closely related to map__rip_2objdump(), this function takes an address from objdump and converts it to a memory address. Note this assumes that contains the address. To be sure the result is valid, check it forwards e.g. map__rip_2objdump(map->map_ip(map, map__objdump_2mem(map, ip))) == ip

Return: Memory address.

Definition at line 494 of file map.c.

◆ map__overlap()

int map__overlap ( struct map l,
struct map r 
)

Definition at line 384 of file map.c.

◆ map__put()

void map__put ( struct map map)

Definition at line 279 of file map.c.

Here is the call graph for this function:

◆ map__reloc_vmlinux()

void map__reloc_vmlinux ( struct map map)

◆ map__rip_2objdump()

u64 map__rip_2objdump ( struct map map,
u64  rip 
)

map__rip_2objdump - convert symbol start address to objdump address. : memory map : symbol start address

objdump wants/reports absolute IPs for ET_EXEC, and RIPs for ET_DYN. map->dso->adjust_symbols==1 for ET_EXEC-like cases except ET_REL which is relative to section start.

Return: Address suitable for passing to "objdump --start-address="

Definition at line 450 of file map.c.

Here is the call graph for this function:

◆ map__set_kallsyms_ref_reloc_sym()

int map__set_kallsyms_ref_reloc_sym ( struct map map,
const char *  symbol_name,
u64  addr 
)

Definition at line 1976 of file session.c.

Here is the call graph for this function:

◆ map__size()

static size_t map__size ( const struct map map)
inlinestatic

Definition at line 101 of file map.h.

Here is the call graph for this function:

◆ map__srcline()

char* map__srcline ( struct map map,
u64  addr,
struct symbol sym 
)

Definition at line 418 of file map.c.

Here is the call graph for this function:

◆ map__unmap_ip()

static u64 map__unmap_ip ( struct map map,
u64  ip 
)
inlinestatic

Definition at line 91 of file map.h.

◆ map_groups__clone()

int map_groups__clone ( struct thread thread,
struct map_groups parent 
)

Definition at line 762 of file map.c.

Here is the call graph for this function:

◆ map_groups__delete()

void map_groups__delete ( struct map_groups mg)

Definition at line 566 of file map.c.

Here is the call graph for this function:

◆ map_groups__empty()

bool map_groups__empty ( struct map_groups mg)

Definition at line 551 of file map.c.

Here is the call graph for this function:

◆ map_groups__exit()

void map_groups__exit ( struct map_groups mg)

Definition at line 546 of file map.c.

Here is the call graph for this function:

◆ map_groups__find()

static struct map* map_groups__find ( struct map_groups mg,
u64  addr 
)
static

Definition at line 211 of file map.h.

Here is the call graph for this function:

◆ map_groups__find_ams()

int map_groups__find_ams ( struct addr_map_symbol ams)

Definition at line 626 of file map.c.

Here is the call graph for this function:

◆ map_groups__find_by_name()

struct map* map_groups__find_by_name ( struct map_groups mg,
const char *  name 
)

Definition at line 1679 of file symbol.c.

Here is the call graph for this function:

◆ map_groups__find_symbol()

struct symbol* map_groups__find_symbol ( struct map_groups mg,
u64  addr,
struct map **  mapp 
)

Definition at line 578 of file map.c.

Here is the call graph for this function:

◆ map_groups__find_symbol_by_name()

struct symbol* map_groups__find_symbol_by_name ( struct map_groups mg,
const char *  name,
struct map **  mapp 
)

Definition at line 619 of file map.c.

Here is the call graph for this function:

◆ map_groups__first()

struct map* map_groups__first ( struct map_groups mg)

Definition at line 1027 of file symbol.c.

Here is the call graph for this function:

◆ map_groups__fixup_overlappings()

int map_groups__fixup_overlappings ( struct map_groups mg,
struct map map,
FILE *  fp 
)

Definition at line 753 of file map.c.

Here is the call graph for this function:

◆ map_groups__fprintf()

size_t map_groups__fprintf ( struct map_groups mg,
FILE *  fp 
)

Definition at line 664 of file map.c.

Here is the call graph for this function:

◆ map_groups__get()

static struct map_groups* map_groups__get ( struct map_groups mg)
static

Definition at line 73 of file map.h.

Here is the call graph for this function:

◆ map_groups__init()

void map_groups__init ( struct map_groups mg,
struct machine machine 
)

Definition at line 518 of file map.c.

Here is the call graph for this function:

◆ map_groups__insert()

static void map_groups__insert ( struct map_groups mg,
struct map map 
)
inlinestatic

Definition at line 200 of file map.h.

Here is the call graph for this function:

◆ map_groups__new()

struct map_groups* map_groups__new ( struct machine machine)

Definition at line 556 of file map.c.

Here is the call graph for this function:

◆ map_groups__next()

static struct map* map_groups__next ( struct map map)
static

Definition at line 218 of file map.h.

Here is the call graph for this function:

◆ map_groups__put()

void map_groups__put ( struct map_groups mg)

Definition at line 572 of file map.c.

Here is the call graph for this function:

◆ map_groups__remove()

static void map_groups__remove ( struct map_groups mg,
struct map map 
)
inlinestatic

Definition at line 206 of file map.h.

Here is the call graph for this function:

◆ maps__find()

struct map* maps__find ( struct maps maps,
u64  addr 
)

Definition at line 831 of file map.c.

Here is the call graph for this function:

◆ maps__find_symbol_by_name()

struct symbol* maps__find_symbol_by_name ( struct maps maps,
const char *  name,
struct map **  mapp 
)

Definition at line 593 of file map.c.

Here is the call graph for this function:

◆ maps__first()

struct map* maps__first ( struct maps maps)

Definition at line 856 of file map.c.

◆ maps__insert()

void maps__insert ( struct maps maps,
struct map map 
)

Definition at line 811 of file map.c.

Here is the call graph for this function:

◆ maps__remove()

void maps__remove ( struct maps maps,
struct map map 
)

Definition at line 824 of file map.c.

Here is the call graph for this function: