I just found that with
__libdwfl_attach_state_for_core hooked into dwfl_core_file_report
__libdwfl_attach_state_for_pid hooked into dwfl_linux_proc_report
we no longer need most of the code as dwfl_standard_argp handles it all.
Currently it was calling dwfl_linux_proc_report / dwfl_core_file_report twice.
That is not the case for tests/backtrace.c which intentionally does not use
dwfl_standard_argp so it has to do everything by hand (=to call
dwfl_core_file_report and dwfl_linux_proc_report, nothing more).