]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
perf libdw: Support DWARF line 0 in inline list
authorIan Rogers <irogers@google.com>
Mon, 4 May 2026 08:12:23 +0000 (01:12 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 6 May 2026 00:49:49 +0000 (21:49 -0300)
Allow DWARF line 0 in `libdw_a2l_cb()`, as it is a valid
reference for compiler-generated code.

Filter `die_get_call_lineno` error codes (negative values), but
fallback to line 0 if `call_fname` is present to preserve the
caller's filename instead of discarding it entirely.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Zecheng Li <zli94@ncsu.edu>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/libdw.c

index 301642084c6906f92d4ec7fcfc523ae3d3110d71..196b9cdf51b26123c43652bc1fbbfaad4d514a3c 100644 (file)
@@ -80,6 +80,7 @@ static int libdw_a2l_cb(Dwarf_Die *die, void *_args)
        struct libdw_a2l_cb_args *args  = _args;
        struct symbol *inline_sym = new_inline_sym(args->dso, args->sym, dwarf_diename(die));
        const char *call_fname = die_get_call_file(die);
+       int call_lineno = die_get_call_lineno(die);
        char *call_srcline = srcline__unknown;
 
        if (!inline_sym)
@@ -87,7 +88,7 @@ static int libdw_a2l_cb(Dwarf_Die *die, void *_args)
 
        /* Assign caller information to the parent. */
        if (call_fname)
-               call_srcline = srcline_from_fileline(call_fname, die_get_call_lineno(die));
+               call_srcline = srcline_from_fileline(call_fname, call_lineno >= 0 ? call_lineno : 0);
 
        if (!list_empty(&args->node->val)) {
                struct inline_list *parent;