aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/util/ui/browsers/annotate.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index 7ac7dd04d5c6..5cf9b78682aa 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -20,6 +20,7 @@ struct annotate_browser {
20 int nr_asm_entries; 20 int nr_asm_entries;
21 int nr_entries; 21 int nr_entries;
22 bool hide_src_code; 22 bool hide_src_code;
23 bool use_offset;
23}; 24};
24 25
25struct objdump_line_rb_node { 26struct objdump_line_rb_node {
@@ -82,10 +83,13 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int ro
82 slsmg_write_nstring(ol->line, width - 18); 83 slsmg_write_nstring(ol->line, width - 18);
83 else { 84 else {
84 char bf[64]; 85 char bf[64];
85 u64 addr = ab->start + ol->offset; 86 u64 addr = ol->offset;
86 int printed = scnprintf(bf, sizeof(bf), " %" PRIx64 ":", addr); 87 int printed, color = -1;
87 int color = -1;
88 88
89 if (!ab->use_offset)
90 addr += ab->start;
91
92 printed = scnprintf(bf, sizeof(bf), " %" PRIx64 ":", addr);
89 if (change_color) 93 if (change_color)
90 color = ui_browser__set_color(self, HE_COLORSET_ADDR); 94 color = ui_browser__set_color(self, HE_COLORSET_ADDR);
91 slsmg_write_nstring(bf, printed); 95 slsmg_write_nstring(bf, printed);
@@ -250,6 +254,7 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
250 struct symbol *sym = ms->sym; 254 struct symbol *sym = ms->sym;
251 const char *help = "<-/ESC: Exit, TAB/shift+TAB: Cycle hot lines, " 255 const char *help = "<-/ESC: Exit, TAB/shift+TAB: Cycle hot lines, "
252 "H: Go to hottest line, ->/ENTER: Line action, " 256 "H: Go to hottest line, ->/ENTER: Line action, "
257 "O: Toggle offset view, "
253 "S: Toggle source code view"; 258 "S: Toggle source code view";
254 int key; 259 int key;
255 260
@@ -310,6 +315,10 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
310 if (annotate_browser__toggle_source(self)) 315 if (annotate_browser__toggle_source(self))
311 ui_helpline__puts(help); 316 ui_helpline__puts(help);
312 continue; 317 continue;
318 case 'O':
319 case 'o':
320 self->use_offset = !self->use_offset;
321 continue;
313 case K_ENTER: 322 case K_ENTER:
314 case K_RIGHT: 323 case K_RIGHT:
315 if (self->selection == NULL) { 324 if (self->selection == NULL) {