perf annotate: Show full source location with 'l' hotkey
Right now, when Line numbers are displayed, one can't easily find a source file that the line corresponds to. When a source line is selected and 'l' is pressed, full source file location is displayed in perf UI footer line. The hotkey works only for source code lines. Signed-off-by: Martin Liška <mliska@suse.cz> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Link: http://lore.kernel.org/lkml/25a6384f-d862-5dda-4fec-8f0555599c75@suse.cz Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
a78e724f4e
commit
2777b81b37
@@ -381,6 +381,25 @@ static bool annotate_browser__toggle_source(struct annotate_browser *browser)
|
||||
return true;
|
||||
}
|
||||
|
||||
#define SYM_TITLE_MAX_SIZE (PATH_MAX + 64)
|
||||
|
||||
static void annotate_browser__show_full_location(struct ui_browser *browser)
|
||||
{
|
||||
struct annotate_browser *ab = container_of(browser, struct annotate_browser, b);
|
||||
struct disasm_line *cursor = disasm_line(ab->selection);
|
||||
struct annotation_line *al = &cursor->al;
|
||||
|
||||
if (al->offset != -1)
|
||||
ui_helpline__puts("Only available for source code lines.");
|
||||
else if (al->fileloc == NULL)
|
||||
ui_helpline__puts("No source file location.");
|
||||
else {
|
||||
char help_line[SYM_TITLE_MAX_SIZE];
|
||||
sprintf (help_line, "Source file location: %s", al->fileloc);
|
||||
ui_helpline__puts(help_line);
|
||||
}
|
||||
}
|
||||
|
||||
static void ui_browser__init_asm_mode(struct ui_browser *browser)
|
||||
{
|
||||
struct annotation *notes = browser__annotation(browser);
|
||||
@@ -388,8 +407,6 @@ static void ui_browser__init_asm_mode(struct ui_browser *browser)
|
||||
browser->nr_entries = notes->nr_asm_entries;
|
||||
}
|
||||
|
||||
#define SYM_TITLE_MAX_SIZE (PATH_MAX + 64)
|
||||
|
||||
static int sym_title(struct symbol *sym, struct map *map, char *title,
|
||||
size_t sz, int percent_type)
|
||||
{
|
||||
@@ -747,6 +764,7 @@ static int annotate_browser__run(struct annotate_browser *browser,
|
||||
"c Show min/max cycle\n"
|
||||
"/ Search string\n"
|
||||
"k Toggle line numbers\n"
|
||||
"l Show full source file location\n"
|
||||
"P Print to [symbol_name].annotation file.\n"
|
||||
"r Run available scripts\n"
|
||||
"p Toggle percent type [local/global]\n"
|
||||
@@ -760,6 +778,9 @@ static int annotate_browser__run(struct annotate_browser *browser,
|
||||
case 'k':
|
||||
notes->options->show_linenr = !notes->options->show_linenr;
|
||||
continue;
|
||||
case 'l':
|
||||
annotate_browser__show_full_location (&browser->b);
|
||||
continue;
|
||||
case 'H':
|
||||
nd = browser->curr_hot;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user