Re: [PATCH v4 05/23] perf dwarf-regs: Adapt get_dwarf_regnum() for arm64

[email protected]
Newsgroups org.kernel.vger.linux-perf-users
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The programmatic DWARF register lookup __get_dwarf_regnum_arm64() fails to support the standard AArch64 'lr' (link register) and 'fp' (frame pointer) aliases.
--

--- Patch [5]: [PATCH v4 05/23] perf dwarf-regs: Adapt get_dwarf_regnum() for arm64 ---
commit 7e82be98e18ee79f31ad73b727e21d33b0a6f30d
Author: Tengda Wu <[email protected]>

perf dwarf-regs: Adapt get_dwarf_regnum() for arm64

This patch replaces the static string table lookup for arm64 DWARF registers
with a programmatic implementation. This change allows resolving arm64
register names directly into their corresponding DWARF register numbers
during annotation parsing.

> diff --git a/tools/perf/util/dwarf-regs-arch/dwarf-regs-arm64.c b/tools/perf/util/dwarf-regs-arch/dwarf-regs-arm64.c
> index 593ca7d4fccca..720c863d18696 100644
> --- a/tools/perf/util/dwarf-regs-arch/dwarf-regs-arm64.c
> +++ b/tools/perf/util/dwarf-regs-arch/dwarf-regs-arm64.c

[ ... ]

> @@ -10,3 +13,22 @@ int __get_dwarf_regnum_for_perf_regnum_arm64(int perf_regnum)
>  
>  	return perf_regnum;
>  }
> +
> +int __get_dwarf_regnum_arm64(const char *name)
> +{
> +	int reg;
> +
> +	if (!strcmp(name, "sp"))
> +		return 31;
> +
> +	if (*name != 'x' && *name != 'w')
> +		return -ENOENT;

[Severity: Medium]
Will this strict prefix check inadvertently reject standard AArch64 aliases
like lr and fp?

These architectural aliases are frequently emitted by objdump and were
previously handled by the old static table. When perf annotate attempts
to look up lr or fp, this programmatic DWARF register lookup in
__get_dwarf_regnum_arm64() will fail because the name does not start with
x or w.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.