Re: [PATCH v2 2/2] scripts/faddr2line: Constrain readelf output to symbols from System.map

From: Josh Poimboeuf
Date: Tue Jul 25 2023 - 17:38:13 EST


On Tue, Jul 25, 2023 at 10:11:57PM +0100, Will Deacon wrote:
> @@ -185,7 +186,7 @@ __faddr2line() {
> found=2
> break
> fi
> - done < <(${READELF} --symbols --wide $objfile | sed 's/\[.*\]//' | ${AWK} -v sec=$sym_sec '$7 == sec' | sort --key=2)
> + done < <(${READELF} --symbols --wide $objfile | sed -f ${IGNORED_SYMS} -e 's/\[.*\]//' | ${AWK} -v sec=$sym_sec '$7 == sec' | sort --key=2)
>
> if [[ $found = 0 ]]; then
> warn "can't find symbol: sym_name: $sym_name sym_sec: $sym_sec sym_addr: $sym_addr sym_elf_size: $sym_elf_size"

Looks good, though the outer loop has another readelf incantation:

done < <(${READELF} --symbols --wide $objfile | sed 's/\[.*\]//' | ${AWK} -v fn=$sym_name '$4 == "FUNC" && $8 == fn')

It should probably have the same sed options? Also it looks like it's
wrongly checking for FUNC.

--
Josh