Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 349965
b: refs/heads/master
c: 865c66c
h: refs/heads/master
i:
  349963: 7cb0b2c
v: v3
  • Loading branch information
Frederik Deweerdt authored and Arnaldo Carvalho de Melo committed Jan 24, 2013
1 parent 2440b2e commit 4c2ce69
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2c803e5248d038988ec7c52e8fd7c83130dd3c13
refs/heads/master: 865c66c4183aab1d12522ca3ad3a3339d2437e5c
25 changes: 13 additions & 12 deletions trunk/tools/perf/ui/browsers/annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,16 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int
ab->selection = dl;
}

static bool disasm_line__is_valid_jump(struct disasm_line *dl, struct symbol *sym)
{
if (!dl || !dl->ins || !ins__is_jump(dl->ins)
|| !disasm_line__has_offset(dl)
|| dl->ops.target.offset >= symbol__size(sym))
return false;

return true;
}

static void annotate_browser__draw_current_jump(struct ui_browser *browser)
{
struct annotate_browser *ab = container_of(browser, struct annotate_browser, b);
Expand All @@ -195,8 +205,7 @@ static void annotate_browser__draw_current_jump(struct ui_browser *browser)
if (strstr(sym->name, "@plt"))
return;

if (!cursor || !cursor->ins || !ins__is_jump(cursor->ins) ||
!disasm_line__has_offset(cursor))
if (!disasm_line__is_valid_jump(cursor, sym))
return;

target = ab->offsets[cursor->ops.target.offset];
Expand Down Expand Up @@ -788,17 +797,9 @@ static void annotate_browser__mark_jump_targets(struct annotate_browser *browser
struct disasm_line *dl = browser->offsets[offset], *dlt;
struct browser_disasm_line *bdlt;

if (!dl || !dl->ins || !ins__is_jump(dl->ins) ||
!disasm_line__has_offset(dl))
if (!disasm_line__is_valid_jump(dl, sym))
continue;

if (dl->ops.target.offset >= size) {
ui__error("jump to after symbol!\n"
"size: %zx, jump target: %" PRIx64,
size, dl->ops.target.offset);
continue;
}

dlt = browser->offsets[dl->ops.target.offset];
/*
* FIXME: Oops, no jump target? Buggy disassembler? Or do we
Expand Down Expand Up @@ -921,7 +922,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,

#define ANNOTATE_CFG(n) \
{ .name = #n, .value = &annotate_browser__opts.n, }

/*
* Keep the entries sorted, they are bsearch'ed
*/
Expand Down

0 comments on commit 4c2ce69

Please sign in to comment.