[Lldb-commits] [lldb] Add the ability to get a C++ vtable ValueObject from another ValueObj… (PR #67599)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Wed Sep 27 16:02:42 PDT 2023
clayborg wrote:
> This is an oft-requested feature so thanks for doing this!
>
> My only real complaint is that the code that determines the C++ "dynamic type" does much of the work that the ValueObjectVTable has to do to find the vtable pointer, and it's enough code that it seems a shame to have two copies of it. Maybe there should be a LanguageRuntime "GetVTablePointer" that factors out the part of GetDynamicTypeAndAddress that finds the VTable. Then you can get the LanguageRuntime from the Object and call this generic API. That would also make it clear that this support is for the ItaniamuABI C++ runtime, so that if another runtime comes along that does some other clever thing, it will be straightforward to support it.
I mention this in my inline comments, but we don't want to detect the dynamic type here, we just want to use what ever vtable pointer we find in the current ValueObject that we use to ask for the vtable. We might have dynamic typing on or off, and we don't want to adjust the pointer at all. If we have dynamic typing off, then we will just be in the middle of someone else's vtable, which we will locate by finding the symbol that contains it, so that is ok. If we have dynamic typing on, then the value we ask for the vtable for will point to the first vtable entry for the modified type. So there is no complexity here like there is in the GetDynamicTypeAndAddress(). We just read a pointer and look for the vtable symbol.
https://github.com/llvm/llvm-project/pull/67599
More information about the lldb-commits
mailing list