The following things are suggested:
ulimit -c unlimited
ulimit -a
to set the limit to something other than zero. It was previously 0 on my system.
No core files after segfault.
So,
sudo systemctl enable apport.service
(though this seems distro-related, not developer related). No corefiles in /var/crash
or working directory after that.
There's also:
sudo sysctl -w kernel.core_pattern=core.%u.%p.%t # to enable core generation
systemctl restart apport # to restore default apport settings
Nothing still.
Looking in /var/log/apport.log
shows
ERROR: apport (pid 34940) Fri Dec 24 11:48:47 2021: executable does not belong to a package, ignoring
Oh good! Ubuntu has disabled core dumps for my own code, destroying a valuable debugging tool.