[lldb][COFF] Map symbols without base+complex type as 'Data' type

Both LLD and GNU ld write global/static variables to the COFF symbol
table with `IMAGE_SYM_TYPE_NULL` and `IMAGE_SYM_DTYPE_NULL` type. Map
these symbols as 'Data' type in the symtab to allow these symbols to be
used in expressions and printable.

Reviewed By: labath, DavidSpickett

Differential Revision: https://reviews.llvm.org/D134585
This commit is contained in:
Alvin Wong
2022-09-28 12:46:27 +03:00
committed by Martin Storsjö
parent acf7d08119
commit 8a67a05e93
3 changed files with 9 additions and 2 deletions

View File

@@ -379,6 +379,13 @@ lldb::SymbolType ObjectFilePECOFF::MapSymbolType(uint16_t coff_symbol_type) {
if (complex_type == llvm::COFF::IMAGE_SYM_DTYPE_FUNCTION) {
return lldb::eSymbolTypeCode;
}
const auto base_type = coff_symbol_type & 0xff;
if (base_type == llvm::COFF::IMAGE_SYM_TYPE_NULL &&
complex_type == llvm::COFF::IMAGE_SYM_DTYPE_NULL) {
// Unknown type. LLD and GNU ld uses this for variables on MinGW, so
// consider these symbols to be data to enable printing.
return lldb::eSymbolTypeData;
}
return lldb::eSymbolTypeInvalid;
}