diff options
Diffstat (limited to 'tools/perf/ui/browsers/annotate.c')
| -rw-r--r-- | tools/perf/ui/browsers/annotate.c | 42 | 
1 files changed, 30 insertions, 12 deletions
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index e2f666391ac4..618edf96353c 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c @@ -328,7 +328,32 @@ static void annotate_browser__draw_current_jump(struct ui_browser *browser)  	if (!disasm_line__is_valid_jump(cursor, sym))  		return; +	/* +	 * This first was seen with a gcc function, _cpp_lex_token, that +	 * has the usual jumps: +	 * +	 *  │1159e6c: ↓ jne    115aa32 <_cpp_lex_token@@Base+0xf92> +	 * +	 * I.e. jumps to a label inside that function (_cpp_lex_token), and +	 * those works, but also this kind: +	 * +	 *  │1159e8b: ↓ jne    c469be <cpp_named_operator2name@@Base+0xa72> +	 * +	 *  I.e. jumps to another function, outside _cpp_lex_token, which +	 *  are not being correctly handled generating as a side effect references +	 *  to ab->offset[] entries that are set to NULL, so to make this code +	 *  more robust, check that here. +	 * +	 *  A proper fix for will be put in place, looking at the function +	 *  name right after the '<' token and probably treating this like a +	 *  'call' instruction. +	 */  	target = ab->offsets[cursor->ops.target.offset]; +	if (target == NULL) { +		ui_helpline__printf("WARN: jump target inconsistency, press 'o', ab->offsets[%#x] = NULL\n", +				    cursor->ops.target.offset); +		return; +	}  	bcursor = browser_line(&cursor->al);  	btarget = browser_line(target); @@ -543,35 +568,28 @@ static bool annotate_browser__callq(struct annotate_browser *browser,  	struct map_symbol *ms = browser->b.priv;  	struct disasm_line *dl = disasm_line(browser->selection);  	struct annotation *notes; -	struct addr_map_symbol target = { -		.map = ms->map, -		.addr = map__objdump_2mem(ms->map, dl->ops.target.addr), -	};  	char title[SYM_TITLE_MAX_SIZE];  	if (!ins__is_call(&dl->ins))  		return false; -	if (map_groups__find_ams(&target) || -	    map__rip_2objdump(target.map, target.map->map_ip(target.map, -							     target.addr)) != -	    dl->ops.target.addr) { +	if (!dl->ops.target.sym) {  		ui_helpline__puts("The called function was not found.");  		return true;  	} -	notes = symbol__annotation(target.sym); +	notes = symbol__annotation(dl->ops.target.sym);  	pthread_mutex_lock(¬es->lock); -	if (notes->src == NULL && symbol__alloc_hist(target.sym) < 0) { +	if (notes->src == NULL && symbol__alloc_hist(dl->ops.target.sym) < 0) {  		pthread_mutex_unlock(¬es->lock);  		ui__warning("Not enough memory for annotating '%s' symbol!\n", -			    target.sym->name); +			    dl->ops.target.sym->name);  		return true;  	}  	pthread_mutex_unlock(¬es->lock); -	symbol__tui_annotate(target.sym, target.map, evsel, hbt); +	symbol__tui_annotate(dl->ops.target.sym, ms->map, evsel, hbt);  	sym_title(ms->sym, ms->map, title, sizeof(title));  	ui_browser__show_title(&browser->b, title);  	return true;  |