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

From: Josh Poimboeuf
Date: Thu Jul 27 2023 - 12:50:01 EST


On Thu, Jul 27, 2023 at 01:18:52PM +0100, Will Deacon wrote:
> On Tue, Jul 25, 2023 at 02:38:05PM -0700, Josh Poimboeuf wrote:
> > 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?
>
> Hmm, I don't think it's needed there, is it? The awk expression has a
> strict match on $sym_name, which is going to be something extracted from
> a kernel log and therefore exists in kallsyms.

Yes, I think you're right.

> > Also it looks like it's wrongly checking for FUNC.
>
> Yes, I agree that should be dropped for the reasons you gave before.
>
> So I can spin a v3, with an extra patch to avoid checking against FUNC.

Sounds good, thanks!

--
Josh