perf annotate: Group operands members
Commit-ID: c7e6ead7347813b5833efb9b32908c08ff131259 Gitweb: http://git.kernel.org/tip/c7e6ead7347813b5833efb9b32908c08ff131259 Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Fri, 20 Apr 2012 14:38:46 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Fri, 20 Apr 2012 14:38:46 -0300
perf annotate: Group operands members
So that the ins_ops can handle them in a single place, instead of adding more and more functions or ins_ops parameters.
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/ui/browsers/annotate.c | 17 +++++------ tools/perf/util/annotate.c | 56 ++++++++++++++++++------------------ tools/perf/util/annotate.h | 22 ++++++++------ 3 files changed, 49 insertions(+), 46 deletions(-)
tools/perf/ui/browsers/annotate.c +8 -9
@@ -113,13 +113,12 @@ static void annotate_browser__write(struct ui_browser *self, void *entry, int roif (change_color)ui_browser__set_color (self, color);if (dl->ins && dl->ins->ops->scnprintf) { - dl->ins->ops->scnprintf (dl->ins, bf,sizeof (bf), - !ab->use_offset ? dl->operands :NULL , - dl->target); + dl->ins->ops->scnprintf (dl->ins, bf,sizeof (bf), &dl->ops, + !ab->use_offset);slsmg_write_nstring (" " ,2 ); printed +=2 ; }else -scnprintf (bf,sizeof (bf)," %-6.6s %s" , dl->name, dl->operands); +scnprintf (bf,sizeof (bf)," %-6.6s %s" , dl->name, dl->ops.raw);slsmg_write_nstring (bf, width -10 - printed); }
@@ -294,7 +293,7 @@ static bool annotate_browser__callq(struct annotate_browser *browser,if (!ins__is_call (dl->ins))return false; - ip = ms->map->map_ip (ms->map, dl->target); + ip = ms->map->map_ip (ms->map, dl->ops.target); target =map__find_symbol (ms->map, ip,NULL );if (target ==NULL ) {ui_helpline__puts ("The called function was not found." );
@@ -345,7 +344,7 @@ static bool annotate_browser__jump(struct annotate_browser *browser)if (!ins__is_jump (dl->ins))return false; - dl =annotate_browser__find_offset (browser, dl->target, &idx); + dl =annotate_browser__find_offset (browser, dl->ops.target, &idx);if (dl ==NULL ) {ui_helpline__puts ("Invallid jump offset" );return true;
@@ -621,14 +620,14 @@ static void annotate_browser__mark_jump_targets(struct annotate_browser *browserif (!dl || !dl->ins || !ins__is_jump (dl->ins))continue ; -if (dl->target >= size) { +if (dl->ops.target >= size) {ui__error ("jump to after symbol!\n" "size: %zx, jump target: %" PRIx64, - size, dl->target); + size, dl->ops.target);continue ; } - dlt = browser->offsets[dl->target]; + dlt = browser->offsets[dl->ops.target]; bdlt =disasm_line__browser (dlt); bdlt->jump_target = true; }
tools/perf/util/annotate.c +28 -28
113 lines not on this page · raw message
tools/perf/util/annotate.h +13 -9
@@ -9,10 +9,15 @@struct ins ; +struct ins_operands { +char *raw; +u64 target; +}; +struct ins_ops { -int (*parse_target)(const char *operands,u64 *target); +int (*parse)(struct ins_operands *ops);int (*scnprintf)(struct ins *ins,char *bf,size_t size, -const char *operands,u64 target); +struct ins_operands *ops,bool addrs); };struct ins {
@@ -24,13 +29,12 @@ bool ins__is_jump(const struct ins *ins);bool ins__is_call (const struct ins *ins);struct disasm_line { -struct list_head node; -s64 offset; -u64 target; -char *line; -char *name; -struct ins *ins; -char *operands; +struct list_head node; +s64 offset; +char *line; +char *name; +struct ins *ins; +struct ins_operands ops; };void disasm_line__free (struct disasm_line *dl);