This is an archive of the discontinued LLVM Phabricator instance.

[SymbolFilePDB] Fix null array access when parsing the type of a function without any arguments, i.e. 'int main()' and add support to test it
ClosedPublic

Authored by asmith on Jan 23 2018, 11:18 AM.

Details

Summary
  • Fix a null array access bug. This happens when creating the lldb type for a function that has no argument.
  • Implement SymbolFilePDB::ParseTypes method. Using lldb-test symbols will show all supported types in the target.
  • Create lldb types for variadic function, PDBSymbolTypePointer, PDBSymbolTypeBuiltin
  • The underlying builtin type for PDBSymbolTypeEnum is always Int, correct it with the very first enumerator's encoding if any. This is more accurate when the underlying type is not signed or another integer type.
  • Fix a bug when the compiler type is not created based on PDB_BuiltinType. For example, basic type long is of same width as int in a 32-bit target, and the compiler type of former one will be represented by the one generated for latter if using the default method. Introduce a static function GetBuiltinTypeForPDBEncodingAndBitSize to correct this issue.
  • Basic type long double and double have the same bit size in MSVC and there is no information in a PDB to distinguish them. The compiler type of the former one is represented by the latter's.
  • There is no line information about typedef, enum etc in a PDB and the source and line information for them are not shown.
  • There is no information about scoped enumeration. The compiler type is represented as an unscoped one.

Diff Detail

Event Timeline

asmith created this revision.Jan 23 2018, 11:18 AM

D41427 was reverted because the commit was missing some of the binary files for the tests. This is the same as D41427 without the binary files. I've dropped them since there are lit tests for the same functionality now.

majnemer added inline comments.
source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
162–163

Copy paste bug?

zturner accepted this revision.Jan 23 2018, 12:26 PM

looks good. May as well fix the BCD typo while you're here though (either here or in a followup patch)

This revision is now accepted and ready to land.Jan 23 2018, 12:26 PM
asmith updated this revision to Diff 131129.Jan 23 2018, 12:34 PM

Fix BCD typo

asmith closed this revision.Jan 23 2018, 12:36 PM