[lldb/DWARF] More DW_AT_const_value fixes

Authored by labath on Aug 21 2020, 6:13 AM.


[lldb/DWARF] More DW_AT_const_value fixes

This fixes several issues in handling of DW_AT_const_value attributes:

  • the first is that the size of the data given by data forms does not need to match the size of the underlying variable. We already had the case to handle this for DW_FORM_(us)data -- this extends the handling to other data forms. The main reason this was not picked up is because clang uses leb forms in these cases while gcc prefers the fixed-size ones.
  • The handling of DW_AT_strp form was completely broken -- we would end up using the pointer value as the result. I've reorganized this code so that it handles all string forms uniformly.
  • In case of a completely bogus form we would crash due to strlen(nullptr).

Depends on D86311.

Differential Revision: https://reviews.llvm.org/D86348