Re: GDB 8.2 branch 2018-06-11 Update

Joel Brobecker
2018-06-22T14:21:50Z

Hi Tom,

> Also I found out that this code in symfile.c:
>
> for (auto iter : new_objfiles)
> gdb::observers::new_objfile.notify (objfile);
>
> ... had a bug introduced by
>
> commit 4c404b8be6b1d8759eed50366207fc0e2e47d2b1
> Author: Tom Tromey <tom@tromey.com>
> Date: Fri Apr 7 15:58:25 2017 -0600
>
> Use std::vector in reread_symbols
>
> Previously it read:
>
> - for (ix = 0; VEC_iterate (objfilep, new_objfiles, ix, objfile); ix++)
> - observer_notify_new_objfile (objfile);
>
> ... where "objfile" was used in the iteration -- so now the wrong
> objfile is being passed to the observers.
>
> Fixing this is trivial, but I suppose a test case would be good. Maybe
> the simplest way would be a Python test (so it can hook into the
> observer) plus a shared library? I am actually not sure. I guess I'm
> sort of hoping not to write it.

I'm hesitating on that one. Personally, I would accept the patch without
a testcase based on it being trivial; but on the other hand, it seems
worth giving the testcase a reasonable try, as I am hoping it might not
be an unreasonable amount of work to create it, and although the fix is
trivial, we did introduce that regression, so it's something that can
happen if we continue without a testcase.

--
Joel