aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/util/ui
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/ui')
-rw-r--r--tools/perf/util/ui/browser.c6
-rw-r--r--tools/perf/util/ui/browser.h1
-rw-r--r--tools/perf/util/ui/browsers/annotate.c26
3 files changed, 28 insertions, 5 deletions
diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c
index 076a5ffc8f5..a1b140cf75a 100644
--- a/tools/perf/util/ui/browser.c
+++ b/tools/perf/util/ui/browser.c
@@ -506,6 +506,12 @@ static struct ui_browser__colorset {
.bg = "default",
},
{
+ .colorset = HE_COLORSET_ADDR,
+ .name = "addr",
+ .fg = "magenta",
+ .bg = "default",
+ },
+ {
.name = NULL,
}
};
diff --git a/tools/perf/util/ui/browser.h b/tools/perf/util/ui/browser.h
index 65b25921529..2550277db9f 100644
--- a/tools/perf/util/ui/browser.h
+++ b/tools/perf/util/ui/browser.h
@@ -10,6 +10,7 @@
#define HE_COLORSET_NORMAL 52
#define HE_COLORSET_SELECTED 53
#define HE_COLORSET_CODE 54
+#define HE_COLORSET_ADDR 55
struct ui_browser {
u64 index, top_idx;
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index 57a4c6ef3fd..7ac7dd04d5c 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -16,6 +16,7 @@ struct annotate_browser {
struct rb_root entries;
struct rb_node *curr_hot;
struct objdump_line *selection;
+ u64 start;
int nr_asm_entries;
int nr_entries;
bool hide_src_code;
@@ -51,6 +52,9 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
struct annotate_browser *ab = container_of(self, struct annotate_browser, b);
struct objdump_line *ol = list_entry(entry, struct objdump_line, node);
bool current_entry = ui_browser__is_current_entry(self, row);
+ bool change_color = (!ab->hide_src_code &&
+ (!current_entry || (self->use_navkeypressed &&
+ !self->navkeypressed)));
int width = self->width;
if (ol->offset != -1) {
@@ -69,15 +73,26 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
if (!self->navkeypressed)
width += 1;
- if (!ab->hide_src_code && ol->offset != -1)
- if (!current_entry || (self->use_navkeypressed &&
- !self->navkeypressed))
- ui_browser__set_color(self, HE_COLORSET_CODE);
+ if (ol->offset != -1 && change_color)
+ ui_browser__set_color(self, HE_COLORSET_CODE);
if (!*ol->line)
slsmg_write_nstring(" ", width - 18);
- else
+ else if (ol->offset == -1)
slsmg_write_nstring(ol->line, width - 18);
+ else {
+ char bf[64];
+ u64 addr = ab->start + ol->offset;
+ int printed = scnprintf(bf, sizeof(bf), " %" PRIx64 ":", addr);
+ int color = -1;
+
+ if (change_color)
+ color = ui_browser__set_color(self, HE_COLORSET_ADDR);
+ slsmg_write_nstring(bf, printed);
+ if (change_color)
+ ui_browser__set_color(self, color);
+ slsmg_write_nstring(ol->line, width - 18 - printed);
+ }
if (current_entry)
ab->selection = ol;
@@ -406,6 +421,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
ui_helpline__push("Press <- or ESC to exit");
notes = symbol__annotation(sym);
+ browser.start = map__rip_2objdump(map, sym->start);
list_for_each_entry(pos, &notes->src->source, node) {
struct objdump_line_rb_node *rbpos;