|
|
@@ -1576,6 +1576,24 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr,
|
|
|
return al->map;
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * For branch stacks or branch samples, the sample cpumode might not be correct
|
|
|
+ * because it applies only to the sample 'ip' and not necessary to 'addr' or
|
|
|
+ * branch stack addresses. If possible, use a fallback to deal with those cases.
|
|
|
+ */
|
|
|
+struct map *thread__find_map_fb(struct thread *thread, u8 cpumode, u64 addr,
|
|
|
+ struct addr_location *al)
|
|
|
+{
|
|
|
+ struct map *map = thread__find_map(thread, cpumode, addr, al);
|
|
|
+ struct machine *machine = thread->mg->machine;
|
|
|
+ u8 addr_cpumode = machine__addr_cpumode(machine, cpumode, addr);
|
|
|
+
|
|
|
+ if (map || addr_cpumode == cpumode)
|
|
|
+ return map;
|
|
|
+
|
|
|
+ return thread__find_map(thread, addr_cpumode, addr, al);
|
|
|
+}
|
|
|
+
|
|
|
struct symbol *thread__find_symbol(struct thread *thread, u8 cpumode,
|
|
|
u64 addr, struct addr_location *al)
|
|
|
{
|
|
|
@@ -1585,6 +1603,15 @@ struct symbol *thread__find_symbol(struct thread *thread, u8 cpumode,
|
|
|
return al->sym;
|
|
|
}
|
|
|
|
|
|
+struct symbol *thread__find_symbol_fb(struct thread *thread, u8 cpumode,
|
|
|
+ u64 addr, struct addr_location *al)
|
|
|
+{
|
|
|
+ al->sym = NULL;
|
|
|
+ if (thread__find_map_fb(thread, cpumode, addr, al))
|
|
|
+ al->sym = map__find_symbol(al->map, al->addr);
|
|
|
+ return al->sym;
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
* Callers need to drop the reference to al->thread, obtained in
|
|
|
* machine__findnew_thread()
|