struct annotate_args {
size_t privsize;
+ struct arch *arch;
};
static struct disasm_line *disasm_line__new(struct annotate_args *args,
s64 offset, char *line,
int line_nr,
- struct arch *arch,
struct map *map)
{
struct disasm_line *dl = zalloc(sizeof(*dl) + args->privsize);
if (disasm_line__parse(dl->al.line, &dl->ins.name, &dl->ops.raw) < 0)
goto out_free_line;
- disasm_line__init_ins(dl, arch, map);
+ disasm_line__init_ins(dl, args->arch, map);
}
}
* 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,
- struct arch *arch, FILE *file,
+ FILE *file,
struct annotate_args *args,
int *line_nr)
{
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);
(*line_nr)++;
}
static int symbol__disassemble(struct symbol *sym, struct map *map,
- struct annotate_args *args,
- struct arch *arch)
+ struct annotate_args *args)
{
struct dso *dso = map->dso;
char command[PATH_MAX * 2];
* can associate it with the instructions till the next one.
* 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)
break;
nline++;
if (!arch_name)
return -1;
- arch = arch__find(arch_name);
+ args.arch = arch = arch__find(arch_name);
if (arch == NULL)
return -ENOTSUP;
}
}
- 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)