[Lldb-commits] [lldb] Add the ability to get a C++ vtable ValueObject from another ValueObj… (PR #67599)

via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 27 14:26:19 PDT 2023


================
@@ -374,6 +374,34 @@ class LLDB_API SBValue {
   lldb::SBWatchpoint WatchPointee(bool resolve_location, bool read, bool write,
                                   SBError &error);
 
+  /// If this value represents a C++ class that has a vtable, return an value
+  /// that represents the virtual function table.
+  ///
+  /// SBValue::GetError() will be in the success state if this value represents
+  /// a C++ class with a vtable, or an appropriate error describing that the
+  /// object isn't a C++ class with a vtable or not a C++ class.
+  ///
+  /// SBValue::GetName() will be the demangled symbol name for the virtual
+  /// function table like "vtable for Baseclass".
----------------
jimingham wrote:

I think "BaseClass" was just an example here, but maybe a more abstract name would be better.  

For an actual C++ object, the object's vtable pointer always points to the most specific class of the object, a fact that lldb relies on to do C++ dynamic type detection.

https://github.com/llvm/llvm-project/pull/67599


More information about the lldb-commits mailing list