Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4748834f authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo
Browse files

perf annotate: Add offset/line/line_nr into struct annotate_args



Add offset/line/line_nr into struct annotate_args to reduce the number
of arguments that need to travel all the way to line allocation.

Signed-off-by: default avatarJiri 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-10-jolsa@kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 1a04db70
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -882,23 +882,24 @@ struct annotate_args {
	size_t			 privsize;
	struct arch		*arch;
	struct map		*map;
	s64			 offset;
	char			*line;
	int			 line_nr;
};

static struct disasm_line *disasm_line__new(struct annotate_args *args,
					    s64 offset, char *line,
					    int line_nr)
static struct disasm_line *disasm_line__new(struct annotate_args *args)
{
	struct disasm_line *dl = zalloc(sizeof(*dl) + args->privsize);

	if (dl != NULL) {
		dl->al.offset  = offset;
		dl->al.line    = strdup(line);
		dl->al.line_nr = line_nr;
		dl->al.offset  = args->offset;
		dl->al.line    = strdup(args->line);
		dl->al.line_nr = args->line_nr;

		if (dl->al.line == NULL)
			goto out_delete;

		if (offset != -1) {
		if (args->offset != -1) {
			if (disasm_line__parse(dl->al.line, &dl->ins.name, &dl->ops.raw) < 0)
				goto out_free_line;

@@ -1269,7 +1270,11 @@ static int symbol__parse_objdump_line(struct symbol *sym, FILE *file,
			parsed_line = tmp2 + 1;
	}

	dl = disasm_line__new(args, offset, parsed_line, *line_nr);
	args->offset  = offset;
	args->line    = parsed_line;
	args->line_nr = *line_nr;

	dl = disasm_line__new(args);
	free(line);
	(*line_nr)++;