Skip to content

Commit e7ace97

Browse files
Zecheng Liacmel
authored andcommitted
perf dwarf-aux: Fix __die_find_scope_cb() for namespaces
Currently __die_find_scope_cb() goes to check siblings when the DIE doesn't include the given PC. However namespaces don't have a PC and could contain children that have that PC. When we encounter a namespace, we should check both its children and siblings. Reviewed-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Zecheng Li <zecheng@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Xu Liu <xliuprof@google.com> Link: https://lore.kernel.org/r/20250825195817.226560-1-zecheng@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 4a6ce9a commit e7ace97

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tools/perf/util/dwarf-aux.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,6 +1958,7 @@ struct find_scope_data {
19581958
static int __die_find_scope_cb(Dwarf_Die *die_mem, void *arg)
19591959
{
19601960
struct find_scope_data *data = arg;
1961+
int tag = dwarf_tag(die_mem);
19611962

19621963
if (dwarf_haspc(die_mem, data->pc)) {
19631964
Dwarf_Die *tmp;
@@ -1971,6 +1972,14 @@ static int __die_find_scope_cb(Dwarf_Die *die_mem, void *arg)
19711972
data->nr++;
19721973
return DIE_FIND_CB_CHILD;
19731974
}
1975+
1976+
/*
1977+
* If the DIE doesn't have the PC, we still need to check its children
1978+
* and siblings if it's a container like a namespace.
1979+
*/
1980+
if (tag == DW_TAG_namespace)
1981+
return DIE_FIND_CB_CONTINUE;
1982+
19741983
return DIE_FIND_CB_SIBLING;
19751984
}
19761985

0 commit comments

Comments
 (0)