Description
C++ code on Windows can either be using the MSVC C++ ABI, or the Itanium ABI (in mingw mode). Since 25c8a06 and 3c86789, it's possible to set the desired ABI mode when using LLDB. But for cases when running in the wrong mode, LLDB can flat out crash (triggers a failed assert) for some C++ code.
This is reproducible with the attached testcase cxxabi.zip.
To reproduce (which can be done on any OS, doesn't need to actually run on Windows):
$ lldb cxxabi.exe
(lldb) target create "cxxabi.exe"
Current executable set to '/home/martin/test/cxxabi.exe' (x86_64).
(lldb) l callFunc
Assertion failed: (IA && "Expected MSInheritanceAttr on the CXXRecordDecl!"), function getMSInheritanceModel, file /home/martin/code/llvm-project/clang/lib/AST/MicrosoftCXXABI.cpp, line 236.
(Here, the issue is avoidable e.g. by starting lldb with lldb -O "settings set plugin.object-file.pe-coff.abi gnu" cxxabi.exe
.)
CC @ZequanWu @alvinhochun @rnk @zmodem
I'm not sure exactly at what point this should be fixed - I guess it's somewhat acceptable for Clang, running in MSVC mode, to use such assertions - but when the input isn't from Clang itself but from debug info read by LLDB, some more error checks at some point seems to be needed.