-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LLDB misses the const method qualifier on Windows #117
Comments
@Teemperor knows a lot about standard library functions evaluation, so maybe he has an idea of what's going wrong here. |
The error I assume that on Windows, Clang is emitting PDB (?) and LLDB's PDB parser is currently not able to create member functions marked as const (at least that's what I see in the code). Maybe take that with a grain of salt as I never touched the PDB code in LLDB before. The reason why you see the The FWIW, vector's size method (and STL methods in general) are really weird corner cases. If you just want to look at a STL container just doing a simple |
@Teemperor thank you for the comment. Yes, this is a PDB file generated by Clang. I think the vector's size method is not inlined, otherwise LLDB says about it and the function is not present in 'image lookup'. If I compile using MSVC, it inlines size() even in debug (and I have no idea how to disable it) and LLDB says about it. I believe LLDB looks for vector::size() const but because the vector variable is not const, it is not able to match the method. I use the STL provided by Microsoft. |
I can't really help with anything related to PDB or Microsoft's standard library. I guess @sstamenova maybe knows more about the state of LLDB with PDB (I'm not sure if she's active on GitHub though). I wasn't even aware that Clang supports Microsoft's standard library. But anyway, It shouldn't matter if your vector is const or not, the problem is rather that your As you already built your own LLDB, you could try changing the |
I've checked the _NODISCARD size_type size() const noexcept I put 1 instead of 0, but unfortunately see no changes.
also works a bit strange, I see the following results after the line where
or
|
I meant that the internal representation of the I don't think LLDB supports printing the std::vector from Microsoft's STL so I assume that's why you see an empty std::vector. But as said, I'm not sure what's the state of LLDB on Windows with Microsoft's STL. |
@Teemperor I see there are two folders inside if (func_sig->isConstType())
type_quals |= clang::Qualifiers::Const;
if (func_sig->isVolatileType())
type_quals |= clang::Qualifiers::Volatile;
auto cc = TranslateCallingConvention(func_sig->getCallingConvention());
CompilerType func_sig_ast_type =
m_ast.CreateFunctionType(return_ast_type, arg_list.data(),
arg_list.size(), is_variadic, type_quals, cc); I've changed
(So, here is the
|
@Teemperor If I right get the idea, this is a problem in the PDB file generated by Clang. But as my previous experiment show, LLDB is also not able to lookup the right symbol even if we force it to "understand" |
Also, I don't understand why LLDB shows the following error when it analyses the code and PDB generated by MSVC:
But I see in the generated assembly file, the method ...
lea rcx, QWORD PTR v$[rsp]
call ?size@?$vector@HV?$allocator@H@std@@@std@@QEBA_KXZ ; std::vector<int,std::allocator<int> >::size
...
?size@?$vector@HV?$allocator@H@std@@@std@@QEBA_KXZ PROC ; std::vector<int,std::allocator<int> >::size, COMDAT
; File C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.22.27905\include\vector
; Line 1446
$LN3:
...
ret 0
?size@?$vector@HV?$allocator@H@std@@@std@@QEBA_KXZ ENDP ; std::vector<int,std::allocator<int> >::size |
@rnk, in case he's got thoughts here |
Punt to @amccarth-google |
Nothing obvious comes to immediately to mind. I'll have to dig in a little to see what's going on. This is on my radar to investigate, but it's not my first priority right now. The first step would be to try to determine whether problem is in the debug info generated by clang or in lldb's interpretation of it. Perhaps some poking about with llvm_pdbdump can yield some clues. Are you linking the standard library statically or dynamically? If the latter, I wonder if there's conflicting debug info in the library's PDB compared to the one for your executable. |
@llvm/issue-subscribers-lldb |
…604.1 (llvm#117) [release/11.x] Update dependencies from dotnet/arcade
…2023.07.27 Promote develop branch (as of 7ea6313) to mainline
[OpenMP] Fix use_device_ptr(addr) mappings for Fortran Pointer types Fixes test in https://ontrack-internal.amd.com/browse/SWDEV-471469. This fix also depends on @agozillon patch llvm#96265.
…policy (llvm#117) * [Clang][XTHeadVector] make wrappers default to TAMU policy * [Clang][XTHeadVector] fix wrapper tests for vector-floating-conv (TAMU) * [Clang][XTHeadVector] fix wrapper tests for vector-integer-compare (TAMU) * [Clang][XTHeadVector] fix wrapper tests for vector-mask-logical (TAMU) * [Clang][XTHeadVector] fix wrapper tests for vector-permutation (TAMU) * [Clang][XTHeadVector] fix `HasMaskedOffOperand` of `th_vslidedown` * [Clang][XTHeadVector] fix wrapper tests for vector-single-width-averaging (TAMU) * [Clang][XTHeadVector] fix wrapper tests for `vsmul` (TAMU) * [Clang][XTHeadVector] fix wrapper tests for vector-single-width-with-saturation-add (TAMU) * [Clang][XTHeadVector] make wrappers for vector-reduction defaults to TUM policy * [Clang][XTHeadVector] fix wrapper tests for vector-reduction (TUMU) * [Clang][XTHeadVector] fix wrapper tests for vector-floating (TAMU)
I've tried LLDB built from the current
release/10.x
branch as well as frommaster
.On Windows, I'm using Clang++ to build a simple demo program.
Or
I've see that the method
is found in the output of
But when I put a breakpoint after the vector
v
definition and try doe v.size()
or
p v.size()
I get only the following error:
I see the
const
qualifier next to the method declaration in the output ofSo, I tried to declare my vector also as
const
:Now LLDB is able to lookup the method but what I get is only the following error:
But I'm sure
this
in my vector is marked asconst
:I tried on Linux and LLDB works fine there, I get the right result: 3.
The text was updated successfully, but these errors were encountered: