I did a little fiddling to make this work:
dwarf_edit f;
dwarf_edit::compile_unit &cu = f.new_unit ();
cu.children ().push_back (dwarf_edit::debug_info_entry (DW_TAG_subprogram));
cu.attributes ()[DW_AT_name].source_file () = "source-file.c";
It's on roland/dwarf_edit which is based on roland/dwarf-collector.
Since dwarf_edit stuff like this is not a focus now, I won't try to
commit this until after we have merged in the dwarf-collector branch.
(I'm still working on roland/tracker and then will merge that first.)
It may need some substantial jiggering for .dwarf_constant () to work
right. The others might be OK as is, though some of the hairy ones might
not be constructible or assignable as they need to be.
Thanks,
Roland