perf annotate: Add arch into struct annotate_args
Add arch into struct annotate_args to reduce the number of arguments that need to travel all the way to line allocation. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20171011150158.11895-8-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
ea07c5aaed
commit
24fe7b8893
@@ -880,12 +880,12 @@ out_free_name:
|
|||||||
|
|
||||||
struct annotate_args {
|
struct annotate_args {
|
||||||
size_t privsize;
|
size_t privsize;
|
||||||
|
struct arch *arch;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct disasm_line *disasm_line__new(struct annotate_args *args,
|
static struct disasm_line *disasm_line__new(struct annotate_args *args,
|
||||||
s64 offset, char *line,
|
s64 offset, char *line,
|
||||||
int line_nr,
|
int line_nr,
|
||||||
struct arch *arch,
|
|
||||||
struct map *map)
|
struct map *map)
|
||||||
{
|
{
|
||||||
struct disasm_line *dl = zalloc(sizeof(*dl) + args->privsize);
|
struct disasm_line *dl = zalloc(sizeof(*dl) + args->privsize);
|
||||||
@@ -902,7 +902,7 @@ static struct disasm_line *disasm_line__new(struct annotate_args *args,
|
|||||||
if (disasm_line__parse(dl->al.line, &dl->ins.name, &dl->ops.raw) < 0)
|
if (disasm_line__parse(dl->al.line, &dl->ins.name, &dl->ops.raw) < 0)
|
||||||
goto out_free_line;
|
goto out_free_line;
|
||||||
|
|
||||||
disasm_line__init_ins(dl, arch, map);
|
disasm_line__init_ins(dl, args->arch, map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1222,7 +1222,7 @@ static int disasm_line__print(struct disasm_line *dl, struct symbol *sym, u64 st
|
|||||||
* The ops.raw part will be parsed further according to type of the instruction.
|
* The ops.raw part will be parsed further according to type of the instruction.
|
||||||
*/
|
*/
|
||||||
static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
|
static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
|
||||||
struct arch *arch, FILE *file,
|
FILE *file,
|
||||||
struct annotate_args *args,
|
struct annotate_args *args,
|
||||||
int *line_nr)
|
int *line_nr)
|
||||||
{
|
{
|
||||||
@@ -1269,7 +1269,7 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
|
|||||||
parsed_line = tmp2 + 1;
|
parsed_line = tmp2 + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dl = disasm_line__new(args, offset, parsed_line, *line_nr, arch, map);
|
dl = disasm_line__new(args, offset, parsed_line, *line_nr, map);
|
||||||
free(line);
|
free(line);
|
||||||
(*line_nr)++;
|
(*line_nr)++;
|
||||||
|
|
||||||
@@ -1431,8 +1431,7 @@ static const char *annotate__norm_arch(const char *arch_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int symbol__disassemble(struct symbol *sym, struct map *map,
|
static int symbol__disassemble(struct symbol *sym, struct map *map,
|
||||||
struct annotate_args *args,
|
struct annotate_args *args)
|
||||||
struct arch *arch)
|
|
||||||
{
|
{
|
||||||
struct dso *dso = map->dso;
|
struct dso *dso = map->dso;
|
||||||
char command[PATH_MAX * 2];
|
char command[PATH_MAX * 2];
|
||||||
@@ -1532,7 +1531,7 @@ static int symbol__disassemble(struct symbol *sym, struct map *map,
|
|||||||
* can associate it with the instructions till the next one.
|
* can associate it with the instructions till the next one.
|
||||||
* See disasm_line__new() and struct disasm_line::line_nr.
|
* See disasm_line__new() and struct disasm_line::line_nr.
|
||||||
*/
|
*/
|
||||||
if (symbol__parse_objdump_line(sym, map, arch, file, args,
|
if (symbol__parse_objdump_line(sym, map, file, args,
|
||||||
&lineno) < 0)
|
&lineno) < 0)
|
||||||
break;
|
break;
|
||||||
nline++;
|
nline++;
|
||||||
@@ -1580,7 +1579,7 @@ int symbol__annotate(struct symbol *sym, struct map *map,
|
|||||||
if (!arch_name)
|
if (!arch_name)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
arch = arch__find(arch_name);
|
args.arch = arch = arch__find(arch_name);
|
||||||
if (arch == NULL)
|
if (arch == NULL)
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
|
|
||||||
@@ -1595,7 +1594,7 @@ int symbol__annotate(struct symbol *sym, struct map *map,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return symbol__disassemble(sym, map, &args, arch);
|
return symbol__disassemble(sym, map, &args);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void insert_source_line(struct rb_root *root, struct source_line *src_line)
|
static void insert_source_line(struct rb_root *root, struct source_line *src_line)
|
||||||
|
|||||||
Reference in New Issue
Block a user