My vague plan for what to do next revolves around figuring out how to
the low-level optimization properly. There are some moving parts that
influence each other. For example, whether it is advantageous to emit
string as strp vs. inline string depends on how many times does this
string appear, and thus depends on the way we do the dissection of the
DIE tree into partial CUs. On the other hand, the decision whether it
is advantageous to dissect a DIE sub-tree into own partial unit, is
dependent on forms that we use to store the attributes, and therefore
links back to the string/strp problem.
As I said before, please do not spend any time on the partial_unit issue.
Just deal with optimal form selection for attribute values.
The only class where duplicate values affects the globally optimal choice
is string. Don't bother trying to think big about it now. Just do the
locally optimal choice. That's a trivial rule: if s.size () < offset_size
use DW_FORM_string, else use DW_FORM_strp. Just do that.
Oh, and everything is still coded with xxx instead of proper dwarf_64
handling. We never do the 32-to-64-bit transition. I think that DWARF
files that big won't really be common, I wonder if there are any in
Fedora at all. We can take the approach of trying to emit it 32-bit,
and when we find that we can't encode some DIE reference in 32bit
quantity, we simply restart the process with dwarf_64 == true. There
will be a command-line switch for users who know that their files don't
fit 32-bit limit, that will also be useful for testing emitting and
consumption of 64-bit DWARF files.
Yes, this is exactly what I'd had in mind. Basically, the offset_size=8 is
a case we do not need to support this year. So what I think we want is
just to have a single wrapper that's used when we're encoding any
offset_size value (DW_FORM_sec_offset et al). For now, that can just do:
if (unlikely (offset >= ((Dwarf_Off) 1 << 32)))
throw std::runtime_error ("XXX implement 64-bit DWARF format!");
We'll worry about the rest later. Leave the XXX's in places where the
encoding varies by offset_size.