Linux Perf
map.c File Reference
#include "symbol.h"
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <uapi/linux/mman.h>
#include "map.h"
#include "thread.h"
#include "vdso.h"
#include "build-id.h"
#include "util.h"
#include "debug.h"
#include "machine.h"
#include <linux/string.h>
#include "srcline.h"
#include "namespaces.h"
#include "unwind.h"
Include dependency graph for map.c:

Go to the source code of this file.

Macros

#define DSO__DELETED   "(deleted)"
 

Functions

static void __maps__insert (struct maps *maps, struct map *map)
 
static int is_anon_memory (const char *filename, u32 flags)
 
static int is_no_dso_memory (const char *filename)
 
static int is_android_lib (const char *filename)
 
static bool replace_android_lib (const char *filename, char *newfilename)
 
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)
 
bool __map__is_kernel (const struct map *map)
 
bool __map__is_extra_kernel_map (const struct map *map)
 
bool map__has_symbols (const struct map *map)
 
static void map__exit (struct map *map)
 
void map__delete (struct map *map)
 
void map__put (struct map *map)
 
void map__fixup_start (struct map *map)
 
void map__fixup_end (struct map *map)
 
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)
 
struct mapmap__clone (struct map *from)
 
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)
 
u64 map__rip_2objdump (struct map *map, u64 rip)
 
u64 map__objdump_2mem (struct map *map, u64 ip)
 
static void maps__init (struct maps *maps)
 
void map_groups__init (struct map_groups *mg, struct machine *machine)
 
static void __maps__purge (struct maps *maps)
 
static void maps__exit (struct maps *maps)
 
void map_groups__exit (struct map_groups *mg)
 
bool map_groups__empty (struct map_groups *mg)
 
struct map_groupsmap_groups__new (struct machine *machine)
 
void map_groups__delete (struct map_groups *mg)
 
void map_groups__put (struct map_groups *mg)
 
struct symbolmap_groups__find_symbol (struct map_groups *mg, u64 addr, struct map **mapp)
 
struct symbolmaps__find_symbol_by_name (struct maps *maps, const char *name, 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)
 
static size_t maps__fprintf (struct maps *maps, FILE *fp)
 
size_t map_groups__fprintf (struct map_groups *mg, FILE *fp)
 
static void __map_groups__insert (struct map_groups *mg, struct map *map)
 
static int maps__fixup_overlappings (struct maps *maps, struct map *map, FILE *fp)
 
int map_groups__fixup_overlappings (struct map_groups *mg, struct map *map, FILE *fp)
 
int map_groups__clone (struct thread *thread, struct map_groups *parent)
 
void maps__insert (struct maps *maps, struct map *map)
 
static void __maps__remove (struct maps *maps, struct map *map)
 
void maps__remove (struct maps *maps, struct map *map)
 
struct mapmaps__find (struct maps *maps, u64 ip)
 
struct mapmaps__first (struct maps *maps)
 
struct mapmap__next (struct map *map)
 
struct kmap__map__kmap (struct map *map)
 
struct kmapmap__kmap (struct map *map)
 
struct map_groupsmap__kmaps (struct map *map)
 

Macro Definition Documentation

◆ DSO__DELETED

#define DSO__DELETED   "(deleted)"

Definition at line 305 of file map.c.

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__kmap()

struct kmap* __map__kmap ( struct map map)

Definition at line 874 of file map.c.

◆ __map_groups__insert()

static void __map_groups__insert ( struct map_groups mg,
struct map map 
)
static

Definition at line 669 of file map.c.

Here is the call graph for this function:

◆ __maps__insert()

static void __maps__insert ( struct maps maps,
struct map map 
)
static

Definition at line 790 of file map.c.

Here is the call graph for this function:

◆ __maps__purge()

static void __maps__purge ( struct maps maps)
static

Definition at line 525 of file map.c.

Here is the call graph for this function:

◆ __maps__remove()

static void __maps__remove ( struct maps maps,
struct map map 
)
static

Definition at line 818 of file map.c.

Here is the call graph for this function:

◆ is_android_lib()

static int is_android_lib ( const char *  filename)
inlinestatic

Definition at line 40 of file map.c.

◆ is_anon_memory()

static int is_anon_memory ( const char *  filename,
u32  flags 
)
inlinestatic

Definition at line 25 of file map.c.

◆ is_no_dso_memory()

static int is_no_dso_memory ( const char *  filename)
inlinestatic

Definition at line 33 of file map.c.

◆ map__clone()

struct map* map__clone ( struct map from)

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__exit()

static void map__exit ( struct map map)
static

Definition at line 267 of file map.c.

◆ 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__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__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__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__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_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_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_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__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__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__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__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:

◆ maps__exit()

static void maps__exit ( struct maps maps)
static

Definition at line 539 of file map.c.

Here is the call graph for this function:

◆ maps__find()

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

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__fixup_overlappings()

static int maps__fixup_overlappings ( struct maps maps,
struct map map,
FILE *  fp 
)
static

Definition at line 675 of file map.c.

Here is the call graph for this function:

◆ maps__fprintf()

static size_t maps__fprintf ( struct maps maps,
FILE *  fp 
)
static

Definition at line 642 of file map.c.

Here is the call graph for this function:

◆ maps__init()

static void maps__init ( struct maps maps)
static

Definition at line 512 of file map.c.

Here is the call graph for this function:

◆ 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:

◆ replace_android_lib()

static bool replace_android_lib ( const char *  filename,
char *  newfilename 
)
inlinestatic

Definition at line 46 of file map.c.