Re: [PATCH v4 19/39] unwind_user/sframe: Add support for reading .sframe contents

Josh Poimboeuf
2025-02-04T18:38:52Z

On Thu, Jan 30, 2025 at 07:07:32AM -0800, Indu Bhagat wrote:
> On 1/21/25 6:31 PM, Josh Poimboeuf wrote:
> > + for (i = 0; i < fde->fres_num; i++) {
> > + int ret;
> > +
> > + /*
> > + * Alternate between the two fre_addr[] entries for 'fre' and
> > + * 'prev_fre'.
> > + */
> > + fre = which ? fres : fres + 1;
> > + which = !which;
> > +
> > + ret = __read_fre(sec, fde, fre_addr, fre);
> > + if (ret)
> > + return ret;
> > +
>
> It should be possible to only read the ip_off and info from FRE and defer
> the reading of offsets (as done in __read_fre) until later when you do need
> the offsets. See below.
>
> We can find the relevant FRE with the following pieces of information:
> - ip_off
> - fre_size (this will mean we need to read the uin8_t info in the FRE)

Indeed, I'll skip reading the offsets until after the loop.

--
Josh