annotate.c (bba73071b6f71be0a101658d7c13866e30b264a6) | annotate.c (9c04409d7f5c325233961673356ea8aced6a4ef3) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2#include "../../util/util.h" 3#include "../browser.h" 4#include "../helpline.h" 5#include "../ui.h" 6#include "../util.h" 7#include "../../util/annotate.h" 8#include "../../util/hist.h" --- 305 unchanged lines hidden (view full) --- 314 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); 315 struct disasm_line *cursor = disasm_line(ab->selection); 316 struct annotation_line *target; 317 struct browser_line *btarget, *bcursor; 318 unsigned int from, to; 319 struct map_symbol *ms = ab->b.priv; 320 struct symbol *sym = ms->sym; 321 u8 pcnt_width = annotate_browser__pcnt_width(ab); | 1// SPDX-License-Identifier: GPL-2.0 2#include "../../util/util.h" 3#include "../browser.h" 4#include "../helpline.h" 5#include "../ui.h" 6#include "../util.h" 7#include "../../util/annotate.h" 8#include "../../util/hist.h" --- 305 unchanged lines hidden (view full) --- 314 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); 315 struct disasm_line *cursor = disasm_line(ab->selection); 316 struct annotation_line *target; 317 struct browser_line *btarget, *bcursor; 318 unsigned int from, to; 319 struct map_symbol *ms = ab->b.priv; 320 struct symbol *sym = ms->sym; 321 u8 pcnt_width = annotate_browser__pcnt_width(ab); |
322 int width = 0; |
|
322 323 /* PLT symbols contain external offsets */ 324 if (strstr(sym->name, "@plt")) 325 return; 326 327 if (!disasm_line__is_valid_jump(cursor, sym)) 328 return; 329 | 323 324 /* PLT symbols contain external offsets */ 325 if (strstr(sym->name, "@plt")) 326 return; 327 328 if (!disasm_line__is_valid_jump(cursor, sym)) 329 return; 330 |
331 /* 332 * This first was seen with a gcc function, _cpp_lex_token, that 333 * has the usual jumps: 334 * 335 * │1159e6c: ↓ jne 115aa32 <_cpp_lex_token@@Base+0xf92> 336 * 337 * I.e. jumps to a label inside that function (_cpp_lex_token), and 338 * those works, but also this kind: 339 * 340 * │1159e8b: ↓ jne c469be <cpp_named_operator2name@@Base+0xa72> 341 * 342 * I.e. jumps to another function, outside _cpp_lex_token, which 343 * are not being correctly handled generating as a side effect references 344 * to ab->offset[] entries that are set to NULL, so to make this code 345 * more robust, check that here. 346 * 347 * A proper fix for will be put in place, looking at the function 348 * name right after the '<' token and probably treating this like a 349 * 'call' instruction. 350 */ |
|
330 target = ab->offsets[cursor->ops.target.offset]; | 351 target = ab->offsets[cursor->ops.target.offset]; |
352 if (target == NULL) { 353 ui_helpline__printf("WARN: jump target inconsistency, press 'o', ab->offsets[%#x] = NULL\n", 354 cursor->ops.target.offset); 355 return; 356 } |
|
331 332 bcursor = browser_line(&cursor->al); 333 btarget = browser_line(target); 334 335 if (annotate_browser__opts.hide_src_code) { 336 from = bcursor->idx_asm; 337 to = btarget->idx_asm; 338 } else { 339 from = (u64)bcursor->idx; 340 to = (u64)btarget->idx; 341 } 342 | 357 358 bcursor = browser_line(&cursor->al); 359 btarget = browser_line(target); 360 361 if (annotate_browser__opts.hide_src_code) { 362 from = bcursor->idx_asm; 363 to = btarget->idx_asm; 364 } else { 365 from = (u64)bcursor->idx; 366 to = (u64)btarget->idx; 367 } 368 |
369 if (ab->have_cycles) 370 width = IPC_WIDTH + CYCLES_WIDTH; 371 |
|
343 ui_browser__set_color(browser, HE_COLORSET_JUMP_ARROWS); | 372 ui_browser__set_color(browser, HE_COLORSET_JUMP_ARROWS); |
344 __ui_browser__line_arrow(browser, pcnt_width + 2 + ab->addr_width, | 373 __ui_browser__line_arrow(browser, 374 pcnt_width + 2 + ab->addr_width + width, |
345 from, to); 346 347 if (is_fused(ab, cursor)) { 348 ui_browser__mark_fused(browser, | 375 from, to); 376 377 if (is_fused(ab, cursor)) { 378 ui_browser__mark_fused(browser, |
349 pcnt_width + 3 + ab->addr_width, | 379 pcnt_width + 3 + ab->addr_width + width, |
350 from - 1, 351 to > from ? true : false); 352 } 353} 354 355static unsigned int annotate_browser__refresh(struct ui_browser *browser) 356{ 357 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); --- 876 unchanged lines hidden --- | 380 from - 1, 381 to > from ? true : false); 382 } 383} 384 385static unsigned int annotate_browser__refresh(struct ui_browser *browser) 386{ 387 struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); --- 876 unchanged lines hidden --- |