for (i = 0; i < ntevs; i++) {
tev = &pev->tevs[i];
map__for_each_symbol(map, sym, tmp) {
- if (map->unmap_ip(map, sym->start) == tev->point.address) {
+ if (map__unmap_ip(map, sym->start) == tev->point.address) {
arch__fix_tev_from_maps(pev, tev, map, sym);
break;
}
target.addr = map__objdump_2mem(map, ops->target.addr);
if (maps__find_ams(ms->maps, &target) == 0 &&
- map__rip_2objdump(target.ms.map, map->map_ip(target.ms.map, target.addr)) == ops->target.addr)
+ map__rip_2objdump(target.ms.map, map__map_ip(target.ms.map, target.addr)) == ops->target.addr)
ops->target.sym = target.ms.sym;
return 0;
dso = map__dso(map);
printf("%s: %s %s %#" PRIx64 "-%#" PRIx64 " (%#" PRIx64 "-%#" PRIx64")\n",
symbol->name, dso->short_name, dso->long_name,
- map->unmap_ip(map, symbol->start), map->unmap_ip(map, symbol->end),
+ map__unmap_ip(map, symbol->start), map__unmap_ip(map, symbol->end),
symbol->start, symbol->end);
}
if (sym != NULL)
snprintf(buf, sizeof(buf), "%s+%" PRIx64 "", sym->name,
- addr - map->unmap_ip(map, sym->start));
+ addr - map__unmap_ip(map, sym->start));
else
snprintf(buf, sizeof(buf), "%#" PRIx64 "", addr);
printf(" %-34s |", buf);
return 0;
}
- offset = map->map_ip(map, ip) - sym->start;
+ offset = map__map_ip(map, ip) - sym->start;
if (offset)
return scnprintf(buf, size, "%s+%#lx", sym->name, offset);
return -ENOMEM;
}
- addrs[filters.nr_addrs++] = kmap->unmap_ip(kmap, sym->start);
+ addrs[filters.nr_addrs++] = map__unmap_ip(kmap, sym->start);
filters.addrs = addrs;
}
}
/* Load maps to ensure dso->is_64_bit has been updated */
map__load(al.map);
- offset = al.map->map_ip(al.map, start);
+ offset = map__map_ip(al.map, start);
len = dso__data_read_offset(dso, machine, offset, (u8 *)buffer,
end - start + MAXINSN);
#include "debug.h"
#include "machine.h"
-#define UM(x) kallsyms_map->unmap_ip(kallsyms_map, (x))
+#define UM(x) map__unmap_ip(kallsyms_map, (x))
static bool is_ignored_symbol(const char *name, char type)
{
if (sym->start == sym->end)
continue;
- mem_start = vmlinux_map->unmap_ip(vmlinux_map, sym->start);
- mem_end = vmlinux_map->unmap_ip(vmlinux_map, sym->end);
+ mem_start = map__unmap_ip(vmlinux_map, sym->start);
+ mem_end = map__unmap_ip(vmlinux_map, sym->end);
first_pair = machine__find_kernel_symbol(&kallsyms, mem_start, NULL);
pair = first_pair;
maps__for_each_entry(maps, rb_node) {
struct map *pair, *map = rb_node->map;
- mem_start = vmlinux_map->unmap_ip(vmlinux_map, map__start(map));
- mem_end = vmlinux_map->unmap_ip(vmlinux_map, map__end(map));
+ mem_start = map__unmap_ip(vmlinux_map, map__start(map));
+ mem_end = map__unmap_ip(vmlinux_map, map__end(map));
pair = maps__find(kallsyms.kmaps, mem_start);
if (pair == NULL || pair->priv)
target.addr = map__objdump_2mem(map, ops->target.addr);
if (maps__find_ams(ms->maps, &target) == 0 &&
- map__rip_2objdump(target.ms.map, map->map_ip(target.ms.map, target.addr)) == ops->target.addr)
+ map__rip_2objdump(target.ms.map, map__map_ip(target.ms.map, target.addr)) == ops->target.addr)
ops->target.sym = target.ms.sym;
return 0;
}
target.addr = map__objdump_2mem(map, ops->target.addr);
- start = map->unmap_ip(map, sym->start),
- end = map->unmap_ip(map, sym->end);
+ start = map__unmap_ip(map, sym->start);
+ end = map__unmap_ip(map, sym->end);
ops->target.outside = target.addr < start || target.addr > end;
* the symbol searching and disassembly should be done.
*/
if (maps__find_ams(ms->maps, &target) == 0 &&
- map__rip_2objdump(target.ms.map, map->map_ip(target.ms.map, target.addr)) == ops->target.addr)
+ map__rip_2objdump(target.ms.map, map__map_ip(target.ms.map, target.addr)) == ops->target.addr)
ops->target.sym = target.ms.sym;
if (!ops->target.outside) {
unsigned offset;
struct sym_hist *h;
- pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, ms->map->unmap_ip(ms->map, addr));
+ pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map__unmap_ip(ms->map, addr));
if ((addr < sym->start || addr >= sym->end) &&
(addr != sym->end || sym->start != sym->end)) {
return err;
pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__,
- symfs_filename, sym->name, map->unmap_ip(map, sym->start),
- map->unmap_ip(map, sym->end));
+ symfs_filename, sym->name, map__unmap_ip(map, sym->start),
+ map__unmap_ip(map, sym->end));
pr_debug("annotating [%p] %30s : [%p] %30s\n",
dso, dso->long_name, sym, sym->name);
continue;
}
- addrs[con->filters->nr_addrs++] = kmap->unmap_ip(kmap, sym->start);
+ addrs[con->filters->nr_addrs++] = map__unmap_ip(kmap, sym->start);
con->filters->addrs = addrs;
}
naddrs = con->filters->nr_addrs;
if (sym) {
unsigned long offset;
- offset = kmap->map_ip(kmap, addr) - sym->start;
+ offset = map__map_ip(kmap, addr) - sym->start;
if (offset == 0)
return sym->name;
dso__data_status_seen(dso, DSO_DATA_STATUS_SEEN_ITRACE))
return 0;
- offset = al.map->map_ip(al.map, address);
+ offset = map__map_ip(al.map, address);
map__load(al.map);
map = a.map;
have_map:
- offset = map->map_ip(map, ip);
+ offset = map__map_ip(map, ip);
if (ip + len >= map__end(map))
len = map__end(map) - ip;
return dso__data_read_offset(map__dso(map), d->machine, offset, buf, len);
struct machine *machine, u64 addr,
u8 *data, ssize_t size)
{
- u64 offset = map->map_ip(map, addr);
+ u64 offset = map__map_ip(map, addr);
+
return dso__data_read_offset(dso, machine, offset, data, size);
}
struct machine *machine, u64 addr,
const u8 *data, ssize_t size)
{
- u64 offset = map->map_ip(map, addr);
+ u64 offset = map__map_ip(map, addr);
+
return dso__data_write_cache_offs(dso, machine, offset, data, size);
}
al.map = maps__find(machine__kernel_maps(machine), tp->addr);
if (al.map && map__load(al.map) >= 0) {
- al.addr = al.map->map_ip(al.map, tp->addr);
+ al.addr = map__map_ip(al.map, tp->addr);
al.sym = map__find_symbol(al.map, al.addr);
if (al.sym)
ret += symbol__fprintf_symname_offs(al.sym, &al, fp);
*/
if (load_map)
map__load(al->map);
- al->addr = al->map->map_ip(al->map, al->addr);
+ al->addr = map__map_ip(al->map, al->addr);
}
return al->map;
}
if (!ret && al->sym) {
snprintf(al_addr_str, sz, "0x%"PRIx64,
- al->map->unmap_ip(al->map, al->sym->start));
+ map__unmap_ip(al->map, al->sym->start));
ret = strlist__has_entry(symbol_conf.sym_list,
al_addr_str);
}
if (!ret && symbol_conf.addr_list && al->map) {
- unsigned long addr = al->map->unmap_ip(al->map, al->addr);
+ unsigned long addr = map__unmap_ip(al->map, al->addr);
ret = intlist__has_entry(symbol_conf.addr_list, addr);
if (!ret && symbol_conf.addr_range) {
printed += fprintf(fp, " <-");
if (map)
- addr = map->map_ip(map, node->ip);
+ addr = map__map_ip(map, node->ip);
if (print_ip) {
/* Show binary offset for userspace addr */
dso__data_status_seen(dso, DSO_DATA_STATUS_SEEN_ITRACE))
return -ENOENT;
- offset = al.map->map_ip(al.map, *ip);
+ offset = map__map_ip(al.map, *ip);
if (!to_ip && one_map) {
struct intel_pt_cache_entry *e;
if (!thread__find_map(thread, cpumode, ip, &al) || !map__dso(al.map))
return -EINVAL;
- offset = al.map->map_ip(al.map, ip);
+ offset = map__map_ip(al.map, ip);
return intel_pt_match_pgd_ip(ptq->pt, ip, offset, map__dso(al.map)->long_name);
}
for (sym = start; sym; sym = dso__next_symbol(sym)) {
if (sym->binding == STB_GLOBAL &&
!strcmp(sym->name, "__switch_to")) {
- ip = map->unmap_ip(map, sym->start);
+ ip = map__unmap_ip(map, sym->start);
if (ip >= map__start(map) && ip < map__end(map)) {
switch_ip = ip;
break;
for (sym = start; sym; sym = dso__next_symbol(sym)) {
if (!strcmp(sym->name, ptss)) {
- ip = map->unmap_ip(map, sym->start);
+ ip = map__unmap_ip(map, sym->start);
if (ip >= map__start(map) && ip < map__end(map)) {
*ptss_ip = ip;
break;
if (!dso || !dso->auxtrace_cache)
continue;
- offset = al.map->map_ip(al.map, addr);
+ offset = map__map_ip(al.map, addr);
e = intel_pt_cache_lookup(dso, machine, offset);
if (!e)
dso = map__dso(map);
}
- sym = symbol__new(map->map_ip(map, map__start(map)),
+ sym = symbol__new(map__map_ip(map, map__start(map)),
event->ksymbol.len,
0, 0, event->ksymbol.name);
if (!sym)
else {
struct dso *dso = map__dso(map);
- sym = dso__find_symbol(dso, map->map_ip(map, map__start(map)));
+ sym = dso__find_symbol(dso, map__map_ip(map, map__start(map)));
if (sym)
dso__delete_symbol(dso, sym);
}
dest_map = maps__find(kmaps, map->pgoff);
if (dest_map != map)
- map->pgoff = dest_map->map_ip(dest_map, map->pgoff);
+ map->pgoff = map__map_ip(dest_map, map->pgoff);
found = true;
}
if (found || machine->trampolines_mapped)
return NULL;
*modp = __map__is_kmodule(map) ? (char *)map__dso(map)->short_name : NULL;
- *addrp = map->unmap_ip(map, sym->start);
+ *addrp = map__unmap_ip(map, sym->start);
return sym->name;
}
return false;
}
- machine->sched.text_start = kmap->unmap_ip(kmap, sym->start);
+ machine->sched.text_start = map__unmap_ip(kmap, sym->start);
/* should not fail from here */
sym = machine__find_kernel_symbol_by_name(machine, "__sched_text_end", &kmap);
- machine->sched.text_end = kmap->unmap_ip(kmap, sym->start);
+ machine->sched.text_end = map__unmap_ip(kmap, sym->start);
sym = machine__find_kernel_symbol_by_name(machine, "__lock_text_start", &kmap);
- machine->lock.text_start = kmap->unmap_ip(kmap, sym->start);
+ machine->lock.text_start = map__unmap_ip(kmap, sym->start);
sym = machine__find_kernel_symbol_by_name(machine, "__lock_text_end", &kmap);
- machine->lock.text_end = kmap->unmap_ip(kmap, sym->start);
+ machine->lock.text_end = map__unmap_ip(kmap, sym->start);
}
/* failed to get kernel symbols */
if (dso->kernel == DSO_SPACE__USER)
return rip + dso->text_offset;
- return map->unmap_ip(map, rip) - map->reloc;
+ return map__unmap_ip(map, rip) - map->reloc;
}
/**
* Closely related to map__rip_2objdump(), this function takes an address from
* objdump and converts it to a memory address. Note this assumes that @map
* 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
+ * e.g. map__rip_2objdump(map__map_ip(map, map__objdump_2mem(map, ip))) == ip
*
* Return: Memory address.
*/
const struct dso *dso = map__dso(map);
if (!dso->adjust_symbols)
- return map->unmap_ip(map, ip);
+ return map__unmap_ip(map, ip);
if (dso->rel)
- return map->unmap_ip(map, ip + map->pgoff);
+ return map__unmap_ip(map, ip + map->pgoff);
/*
* kernel modules also have DSO_TYPE_USER in dso->kernel,
* but all kernel modules are ET_REL, so won't get here.
*/
if (dso->kernel == DSO_SPACE__USER)
- return map->unmap_ip(map, ip - dso->text_offset);
+ return map__unmap_ip(map, ip - dso->text_offset);
return ip + map->reloc;
}
bool map__contains_symbol(const struct map *map, const struct symbol *sym)
{
- u64 ip = map->unmap_ip(map, sym->start);
+ u64 ip = map__unmap_ip(map, sym->start);
return ip >= map__start(map) && ip < map__end(map);
}
return map->dso;
}
+static inline u64 map__map_ip(const struct map *map, u64 ip)
+{
+ return map->map_ip(map, ip);
+}
+
+static inline u64 map__unmap_ip(const struct map *map, u64 ip)
+{
+ return map->unmap_ip(map, ip);
+}
+
static inline u64 map__start(const struct map *map)
{
return map->start;
if (map != NULL && map__load(map) >= 0) {
if (mapp != NULL)
*mapp = map;
- return map__find_symbol(map, map->map_ip(map, addr));
+ return map__find_symbol(map, map__map_ip(map, addr));
}
return NULL;
return -1;
}
- ams->al_addr = ams->ms.map->map_ip(ams->ms.map, ams->addr);
+ ams->al_addr = map__map_ip(ams->ms.map, ams->addr);
ams->ms.sym = map__find_symbol(ams->ms.map, ams->al_addr);
return ams->ms.sym ? 0 : -1;
after->start = map__end(map);
after->pgoff += map__end(map) - map__start(pos->map);
- assert(pos->map->map_ip(pos->map, map__end(map)) ==
- after->map_ip(after, map__end(map)));
+ assert(map__map_ip(pos->map, map__end(map)) ==
+ map__map_ip(after, map__end(map)));
err = __maps__insert(maps, after);
if (err)
goto put_map;
sym = machine__find_kernel_symbol_by_name(host_machine, name, &map);
if (!sym)
return -ENOENT;
- *addr = map->unmap_ip(map, sym->start) -
+ *addr = map__unmap_ip(map, sym->start) -
((reloc) ? 0 : map->reloc) -
((reladdr) ? map__start(map) : 0);
}
"Consider identifying the final function used at run time and set the probe directly on that.\n",
pp->function);
} else
- address = map->unmap_ip(map, sym->start) - map->reloc;
+ address = map__unmap_ip(map, sym->start) - map->reloc;
break;
}
if (!address) {
goto out;
pp->retprobe = tp->retprobe;
- pp->offset = addr - map->unmap_ip(map, sym->start);
+ pp->offset = addr - map__unmap_ip(map, sym->start);
pp->function = strdup(sym->name);
ret = pp->function ? 0 : -ENOMEM;
goto err_out;
}
/* Add one probe point */
- tp->address = map->unmap_ip(map, sym->start) + pp->offset;
+ tp->address = map__unmap_ip(map, sym->start) + pp->offset;
/* Check the kprobe (not in module) is within .text */
if (!pev->uprobes && !pev->target &&
struct addr_location node_al;
unsigned long offset;
- node_al.addr = map->map_ip(map, node->ip);
+ node_al.addr = map__map_ip(map, node->ip);
node_al.map = map;
offset = get_offset(node->ms.sym, &node_al);
u64 rip = ip;
if (dso && dso->kernel && dso->adjust_symbols)
- rip = map->unmap_ip(map, ip);
+ rip = map__unmap_ip(map, ip);
ret += repsep_snprintf(bf, size, "%-#*llx %c ",
BITS_PER_LONG / 4 + 2, rip, o);
if (sym->type == STT_OBJECT) {
ret += repsep_snprintf(bf + ret, size - ret, "%s", sym->name);
ret += repsep_snprintf(bf + ret, size - ret, "+0x%llx",
- ip - map->unmap_ip(map, sym->start));
+ ip - map__unmap_ip(map, sym->start));
} else {
ret += repsep_snprintf(bf + ret, size - ret, "%.*s",
width - ret,
if (sym->type == STT_OBJECT) {
ret += repsep_snprintf(bf + ret, size - ret, "%s", sym->name);
ret += repsep_snprintf(bf + ret, size - ret, "+0x%llx",
- ip - map->unmap_ip(map, sym->start));
+ ip - map__unmap_ip(map, sym->start));
} else {
ret += repsep_snprintf(bf + ret, size - ret, "%.*s",
width - ret,
struct map *right_map = right->ms.map;
if (left_map)
- left_ip = left_map->unmap_ip(left_map, left_ip);
+ left_ip = map__unmap_ip(left_map, left_ip);
if (right_map)
- right_ip = right_map->unmap_ip(right_map, right_ip);
+ right_ip = map__unmap_ip(right_map, right_ip);
return _sort__addr_cmp(left_ip, right_ip);
}
struct map *map = he->ms.map;
if (map)
- ip = map->unmap_ip(map, ip);
+ ip = map__unmap_ip(map, ip);
return repsep_snprintf(bf, size, "%-#*llx", width, ip);
}
* So that we look just like we get from .ko files,
* i.e. not prelinked, relative to initial_map->start.
*/
- pos->start = curr_map->map_ip(curr_map, pos->start);
- pos->end = curr_map->map_ip(curr_map, pos->end);
+ pos->start = map__map_ip(curr_map, pos->start);
+ pos->end = map__map_ip(curr_map, pos->end);
} else if (x86_64 && is_entry_trampoline(pos->name)) {
/*
* These symbols are not needed anymore since the
if( !dso || dso->data.status == DSO_DATA_STATUS_ERROR || map__load(al.map) < 0)
return -1;
- offset = al.map->map_ip(al.map, ip);
+ offset = map__map_ip(al.map, ip);
if (is64bit)
*is64bit = dso->is_64_bit;
pr_debug("unwind: %s:ip = 0x%" PRIx64 " (0x%" PRIx64 ")\n",
al.sym ? al.sym->name : "''",
ip,
- al.map ? al.map->map_ip(al.map, ip) : (u64) 0);
+ al.map ? map__map_ip(al.map, ip) : (u64) 0);
return 0;
}
pr_debug("unwind: %s:ip = 0x%" PRIx64 " (0x%" PRIx64 ")\n",
al.sym ? al.sym->name : "''",
ip,
- al.map ? al.map->map_ip(al.map, ip) : (u64) 0);
+ al.map ? map__map_ip(al.map, ip) : (u64) 0);
return cb(&e, arg);
}