Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 234a5375 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf annotate browser: Use -> to navigate on assembly lines



And add better explanations when the line isn't actionable, like non
assembly lines and on other instructions.

Suggested-by: default avatarIngo Molnar <mingo@elte.hu>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-375n844b5wra7lgq08ou153j@git.kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent e39622ce
Loading
Loading
Loading
Loading
+21 −6
Original line number Original line Diff line number Diff line
@@ -184,8 +184,8 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
	int key;
	int key;


	if (ui_browser__show(&self->b, sym->name,
	if (ui_browser__show(&self->b, sym->name,
			     "<-, -> or ESC: exit, TAB/shift+TAB: "
			     "<- or ESC: exit, TAB/shift+TAB: "
			     "cycle hottest lines, H: Hottest") < 0)
			     "cycle hottest lines, H: Hottest, -> Line action") < 0)
		return -1;
		return -1;


	ui_browser__add_exit_keys(&self->b, exit_keys);
	ui_browser__add_exit_keys(&self->b, exit_keys);
@@ -245,24 +245,39 @@ static int annotate_browser__run(struct annotate_browser *self, int evidx,
			nd = self->curr_hot;
			nd = self->curr_hot;
			break;
			break;
		case NEWT_KEY_ENTER:
		case NEWT_KEY_ENTER:
			if (self->selection != NULL) {
		case NEWT_KEY_RIGHT:
			if (self->selection == NULL) {
				ui_helpline__puts("Huh? No selection. Report to linux-kernel@vger.kernel.org");
				continue;
			}

			if (self->selection->offset == -1) {
				ui_helpline__puts("Actions are only available for assembly lines.");
				continue;
			} else {
				char *s = strstr(self->selection->line, "callq ");
				char *s = strstr(self->selection->line, "callq ");
				struct annotation *notes;
				struct annotation *notes;
				struct symbol *target;
				struct symbol *target;
				u64 ip;
				u64 ip;


				if (s == NULL)
				if (s == NULL) {
					ui_helpline__puts("Actions are only available for the 'callq' instruction.");
					continue;
					continue;
				}


				s = strchr(s, ' ');
				s = strchr(s, ' ');
				if (s++ == NULL)
				if (s++ == NULL) {
					ui_helpline__puts("Invallid callq instruction.");
					continue;
					continue;
				}


				ip = strtoull(s, NULL, 16);
				ip = strtoull(s, NULL, 16);
				ip = ms->map->map_ip(ms->map, ip);
				ip = ms->map->map_ip(ms->map, ip);
				target = map__find_symbol(ms->map, ip, NULL);
				target = map__find_symbol(ms->map, ip, NULL);
				if (target == NULL)
				if (target == NULL) {
					ui_helpline__puts("The called function was not found.");
					continue;
					continue;
				}


				notes = symbol__annotation(target);
				notes = symbol__annotation(target);
				pthread_mutex_lock(&notes->lock);
				pthread_mutex_lock(&notes->lock);