Skip to contentSkip to conversation

perf annotate: Support a 'o' key showing addresses on the new source code view

PATCH In review Taeung Song 1 participant 1 message Jun 28, 2017 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 4/4 perf annotate: Support a 'o' key showing addresses on the new source code view

Cc Namhyung Kim <[email protected]>
Cc Jiri Olsa <[email protected]>
---
 tools/perf/ui/browsers/annotate.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
tools/perf/ui/browsers/annotate.c +16 -1
index 200ee0c..bb5a933 100644
@@ -402,7 +402,17 @@ static int annotate_code_browser__show_matched_dl(struct ui_browser *browser,
 		} else
 			ui_browser__set_color(browser, HE_COLORSET_NORMAL);
 
-		ui_browser__printf(browser, " %*s - ", ab->addr_width + 4, " ");
+		if (!annotate_browser__opts.use_offset) {
+			u64 addr = dl->offset + ab->start;
+
+			ui_browser__printf(browser, " - ");
+
+			if (!current_entry)
+				ui_browser__set_color(browser, HE_COLORSET_ADDR);
+			ui_browser__printf(browser, "%" PRIx64 ": ", addr);
+		} else
+			ui_browser__printf(browser, " %*s - ",
+					   ab->addr_width + 4, " ");
 
 		disasm_line__scnprintf(dl, line, sizeof(line),
 				       !annotate_browser__opts.use_offset);
@@ -938,6 +948,7 @@ static int annotate_code_browser__run(struct annotate_browser *browser,
 		"PGDN/SPACE    Navigate\n"
 		"q/ESC/CTRL+C  Return to dissembly view\n\n"
 		"ENTER         Toggle showing partial disassembly lines\n"
+		"o             Toggle showing addresses for disassembly lines\n"
 		"t             Toggle total period view\n");
 			continue;
 		case K_ENTER:
@@ -953,6 +964,10 @@ static int annotate_code_browser__run(struct annotate_browser *browser,
 				annotate_code_browser__update_nr_entries(browser);
 			}
 			continue;
+		case 'o':
+			annotate_browser__opts.use_offset =
+				!annotate_browser__opts.use_offset;
+			continue;
 		case 't':
 			annotate_browser__opts.show_total_period =
 				!annotate_browser__opts.show_total_period;
Signature · 1 line
2.7.4