Re: [RFC/dwarf-2] Add support for included files

Jim Blandy
2004-04-14T19:10:10Z

Okay, let's take it as established that the speed impact is not too
bad. Given the improved accuracy, I think it's worth taking the
chance that we'll have to revisit it.

Could you try one more thing for me?

As you noticed, the only two functions that dwarf_decode_lines calls
to actually record the information it gets are
buildsym.c:start_subfile (via dwarf2_start_subfile) and
buildsym.c:record_line. Could you change dwarf_decode_lines to take
two function pointers (with an accompanying closure pointer) for those
two functions? I guess this is an instance of the 'builder' pattern,
so maybe name it something appropriately suggestive. Let
dwarf_decode_lines continue to call dwarf2_start_subfile directly,
just passing the builder func and closure along with filename and
dirname.

Then, instead of duplicating dwarf_decode_lines, have the existing
call in read_file_scope and the new call you've added just pass
different function/closures to it.

If it's easy, re-run your speed tests to make sure this doesn't make
some mysterious difference.