Re: [PATCH v2 3/3] tools/perf: Fix to get declared file name from clang DWARF5

From: Georg Müller
Date: Fri Jun 09 2023 - 08:22:23 EST


Hi,

Am 01.11.22 um 14:48 schrieb Masami Hiramatsu (Google):
From: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>

Fix to get the declared file name even if it uses file index 0
in DWARF5, using custom die_get_decl_file() function.


this patch breaks perf probe on fedora 38.

I was trying to a add a probe to systemd-logind using kernel-6.3.6-200.fc38.x86_64 with kernel-tools-6.3.3-200.fc38.x86_64.

When trying to add a probe, I get the following message:

# perf probe -x /usr/lib/systemd/systemd-logind --funcs="match_unit_removed"
match_unit_removed

Function exists and was found:

# perf probe -x /usr/lib/systemd/systemd-logind match_unit_removed
A function DIE doesn't have decl_line. Maybe broken DWARF?
A function DIE doesn't have decl_line. Maybe broken DWARF?
Probe point 'match_unit_removed' not found.
Error: Failed to add events.

When reverting dc9a5d2ccd5c823cc05cafe75fcf19b682d8152c, I was able to add the probe point:

# ./perf probe -x /usr/lib/systemd/systemd-logind match_unit_removed
Added new event:
probe_systemd:match_unit_removed (on match_unit_removed in /usr/lib/systemd/systemd-logind)

You can now use it in all perf tools, such as:

perf record -e probe_systemd:match_unit_removed -aR sleep 1


Probe point is then visible with and without this commit:

# perf probe -l
probe_systemd:match_unit_removed (on match_unit_removed in /usr/lib/systemd/systemd-logind)
# ./perf probe -l
probe_systemd:match_unit_removed (on match_unit_removed@../src/login/logind-dbus.c in /usr/lib/systemd/systemd-logind)


Best regards,
Georg