aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/ui/browsers/annotate.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index bc540b1576c3..0bc3e652b541 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -260,22 +260,16 @@ static bool annotate_browser__callq(struct annotate_browser *browser,
260 void *arg, int delay_secs) 260 void *arg, int delay_secs)
261{ 261{
262 struct map_symbol *ms = browser->b.priv; 262 struct map_symbol *ms = browser->b.priv;
263 struct disasm_line *dl = browser->selection;
263 struct symbol *sym = ms->sym; 264 struct symbol *sym = ms->sym;
264 struct annotation *notes; 265 struct annotation *notes;
265 struct symbol *target; 266 struct symbol *target;
266 char *s = strstr(browser->selection->line, "callq ");
267 u64 ip; 267 u64 ip;
268 268
269 if (s == NULL) 269 if (strcmp(dl->name, "callq"))
270 return false; 270 return false;
271 271
272 s = strchr(s, ' '); 272 ip = strtoull(dl->operands, NULL, 16);
273 if (s++ == NULL) {
274 ui_helpline__puts("Invallid callq instruction.");
275 return true;
276 }
277
278 ip = strtoull(s, NULL, 16);
279 ip = ms->map->map_ip(ms->map, ip); 273 ip = ms->map->map_ip(ms->map, ip);
280 target = map__find_symbol(ms->map, ip, NULL); 274 target = map__find_symbol(ms->map, ip, NULL);
281 if (target == NULL) { 275 if (target == NULL) {
@@ -321,22 +315,19 @@ struct disasm_line *annotate_browser__find_offset(struct annotate_browser *brows
321 315
322static bool annotate_browser__jump(struct annotate_browser *browser) 316static bool annotate_browser__jump(struct annotate_browser *browser)
323{ 317{
324 const char *jumps[] = { "je ", "jne ", "ja ", "jmpq ", "js ", "jmp ", NULL }; 318 const char *jumps[] = { "je", "jne", "ja", "jmpq", "js", "jmp", NULL };
325 struct disasm_line *dl; 319 struct disasm_line *dl = browser->selection;
326 s64 idx, offset; 320 s64 idx, offset;
327 char *s = NULL; 321 char *s;
328 int i = 0; 322 int i = 0;
329 323
330 while (jumps[i]) { 324 while (jumps[i] && strcmp(dl->name, jumps[i]))
331 s = strstr(browser->selection->line, jumps[i++]); 325 ++i;
332 if (s)
333 break;
334 }
335 326
336 if (s == NULL) 327 if (jumps[i] == NULL)
337 return false; 328 return false;
338 329
339 s = strchr(s, '+'); 330 s = strchr(dl->operands, '+');
340 if (s++ == NULL) { 331 if (s++ == NULL) {
341 ui_helpline__puts("Invallid jump instruction."); 332 ui_helpline__puts("Invallid jump instruction.");
342 return true; 333 return true;