[systemd-devel] coredumpctl: matching by e.g. env var?

Stephan Bergmann sbergman at redhat.com
Wed Mar 15 08:43:37 UTC 2023


Hi all,

I have a question about coredumpctl core dump matching, maybe somebody 
has an idea:  The LibreOffice build system's `make check` machinery has 
some logic to identify core files generated by crashed tests and to use 
gdb to automatically obtain backtraces from them (similar to 
`coredumpctl debug`; which is especially useful for builds running as 
remote CI jobs, where all you get back is the build log including the 
gdb backtraces).

But that LibreOffice machinery relies on the traditional 
/proc/sys/kernel/core_pattern=core setting.  For each test (which can 
each spawn any number of sub-processes), it first cd's to a dedicated 
per-test directory prior to starting the test, and then when the test 
failed it invokes gdb on any core.* files found in that directory. 
Which worked quite well (hardly any test process would internally 
establish a different cwd).

Now, for environments using coredumpctl rather than the traditional 
core_pattern, I'd like to make that machinery work too.  I'd need some 
way to match exactly those core dumps coming from processes belonging to 
a given test invocation.  (And many different tests use the same test 
runner executable, which rules out matching by COREDUMP_EXE.)  I find no 
journalctl match filter variable in systemd.journal-fields(7) that looks 
like it could help me here.

So one idea I had was whether it could be possible to match by a given 
environment variable value?  The LibreOffice test machinery would set 
some specific environment variable E to a (hopefully) unique per-test 
value V prior to starting a test, and then when the test failed it could 
query `coredumpctl debug` on matches of E=V.

Any thoughts?



More information about the systemd-devel mailing list