[PATCH] libctf: check for problems with error returns
Nick Alcock
nick.alcock@oracle.com
Tue Oct 17 14:45:59 GMT 2023
On 16 Oct 2023, Torbjorn SVENSSON told this:
> On 2023-10-15 21:18, Nick Alcock wrote:
>>>> + if (ctf_member_info (fp, stype, "bar", &mi) < 0)
>>>> + fprintf (stderr, "cannot get member info: %s\n", ctf_errmsg (ctf_errno (fp)));
>>>> +
>>>> + /* Iteration should never produce an offset bigger than the offset just returned,
>>>> + and should quickly terminate. */
>>>> +
>>>> + while ((ret = ctf_member_next (fp, stype, &i, NULL, NULL, 0)) >= 0) {
>>>> + if (ret > mi.ctm_offset)
>>>> + fprintf (stderr, "ssize_t return: unexpected offset: %zi\n", ret);
>> (here.)
>
> Ah, okay. In any case, I think it would be clearer if you get all the lines in one go that fails than just the first one (in case of
> multiple failures...). - But, that's only my 2 cents.
We do that for failures that actually relate to what's being tested, but
these lines are only setup, and each depends on the one before: if any
fail, all the ones after it are certain to.
I think I might change it to not do the actual tests if we can't do the
setup, though!
I'll give v8 a quick sanity check: more in about an hour.
--
NULL && (void)
More information about the Binutils
mailing list