On Thu, Jan 13, 2022 at 11:00:20AM +0000, Peter Maydell wrote: > On Thu, 13 Jan 2022 at 01:21, Peter Xu <[email protected]> wrote: > > > > On Wed, Jan 12, 2022 at 10:56:07AM +0000, Peter Maydell wrote: > > > We could have vmstate_register_with_alias_id() iterate through > > > and assert presence of the right terminator (probably only if > > > qtest enabled, or some other suitable condition). Then the > > > existing tests that do the basic "check we can instantiate every > > > device and initialize every board model" would run that code > > > and catch most missing terminator cases, I think. > > > > Agreed. How about assert it even without qtest? We do tons of assertion > > for > > programming errors anyway in QEMU. > > I don't inherently object, but in this case to do the assertion > we'd need to do a scan over the fields arrays which we wouldn't > otherwise need to, so the cost of the assert is not simply > the compare-and-branch but also the loop over the array. If > that's not significant in terms of start-up time costs we can > just go ahead and do it (which would be nicer for debugging > and making it really obvious to people writing new devices) > but my remark above was a gesture towards "maybe we need to > not do it for normal startup"..
Hmm.. Then how about put it into a "#ifdef CONFIG_DEBUG"? We may need some extra lines in configure, though: if test "$debug" = "yes"; then echo "CONFIG_DEBUG=y" >> $config_host_mak fi PS: I'm a bit surprised we don't have CONFIG_DEBUG already.. Thanks, -- Peter Xu
