Re: Running selftests in GDB

Maciej W. Rozycki
2020-10-04T17:56:11Z

On Sun, 4 Oct 2020, Eli Zaretskii wrote:

> > > Answering myself: after reconfiguring with --enable-unit-tests, one
> > > should make sure gdb/init.c is regenerated. It looks like it won't be
> > > regenerated, unless you touch one of the source files mentioned in
> > > COMMON_SFILES by gdb/Makefile.
> >
> > It looks like a dependency needs to be added to gdb/Makefile.in for
> > gdb/init.c on whatever is changed with `--enable-unit-tests' that affects
> > the file; can you run a diff on the object tree configured with and
> > without the option to figure out what has changed that affects gdb/init.c?
>
> AFAIR, the object tree didn't change, but SELFTESTS_OBS don't appear
> in CONFIG_OBS. When you reconfigure, SELFTESTS_OBS gets added to
> CONFIG_OBS, but there's nothing to trigger init.c regeneration.

Well, it couldn't have been that the object tree didn't change then, as
the addition of SELFTESTS_OBS to CONFIG_OBS is clearly a change. :) It
looks to me like gdb/Makefile should be a dependency of gdb/init.c then
(or stamp-init really).

Maciej