llvm-capstone/lldb/bindings/interface
Greg Clayton 7fbd427f5e
Add the ability to get a C++ vtable ValueObject from another ValueObj… (#67599)
Add the ability to get a C++ vtable ValueObject from another
ValueObject.

This patch adds the ability to ask a ValueObject for a ValueObject that
represents the virtual function table for a C++ class. If the
ValueObject is not a C++ class with a vtable, a valid ValueObject value
will be returned that contains an appropriate error. If it is successful
a valid ValueObject that represents vtable will be returned. The
ValueObject that is returned will have a name that matches the demangled
value for a C++ vtable mangled name like "vtable for <class-name>". It
will have N children, one for each virtual function pointer. Each
child's value is the function pointer itself, the summary is the
symbolication of this function pointer, and the type will be a valid
function pointer from the debug info if there is debug information
corresponding to the virtual function pointer.

The vtable SBValue will have the following:
- SBValue::GetName() returns "vtable for <class>"
- SBValue::GetValue() returns a string representation of the vtable
address
- SBValue::GetSummary() returns NULL
- SBValue::GetType() returns a type appropriate for a uintptr_t type for
the current process
- SBValue::GetLoadAddress() returns the address of the vtable adderess
- SBValue::GetValueAsUnsigned(...) returns the vtable address
- SBValue::GetNumChildren() returns the number of virtual function
pointers in the vtable
- SBValue::GetChildAtIndex(...) returns a SBValue that represents a
virtual function pointer

The child SBValue objects that represent a virtual function pointer has
the following values:
- SBValue::GetName() returns "[%u]" where %u is the vtable function
pointer index
- SBValue::GetValue() returns a string representation of the virtual
function pointer
- SBValue::GetSummary() returns a symbolicated respresentation of the
virtual function pointer
- SBValue::GetType() returns the function prototype type if there is
debug info, or a generic funtion prototype if there is no debug info
- SBValue::GetLoadAddress() returns the address of the virtual function
pointer
- SBValue::GetValueAsUnsigned(...) returns the virtual function pointer
- SBValue::GetNumChildren() returns 0
- SBValue::GetChildAtIndex(...) returns invalid SBValue for any index

Examples of using this API via python:

```
(lldb) script vtable = lldb.frame.FindVariable("shape_ptr").GetVTable()
(lldb) script vtable
vtable for Shape = 0x0000000100004088 {
  [0] = 0x0000000100003d20 a.out`Shape::~Shape() at main.cpp:3
  [1] = 0x0000000100003e4c a.out`Shape::~Shape() at main.cpp:3
  [2] = 0x0000000100003e7c a.out`Shape::area() at main.cpp:4
  [3] = 0x0000000100003e3c a.out`Shape::optional() at main.cpp:7
}
(lldb) script c = vtable.GetChildAtIndex(0)
(lldb) script c
(void ()) [0] = 0x0000000100003d20 a.out`Shape::~Shape() at main.cpp:3
```
2023-10-30 17:46:18 -07:00
..
SBAddressDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBAddressExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBAttachInfoDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBBlockDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBBlockExtensions.i Revert "Re-land "[lldb/docs] Silence warnings when generating website"" 2023-08-31 16:31:10 +01:00
SBBreakpointDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBBreakpointExtensions.i Revert "Re-land "[lldb/docs] Silence warnings when generating website"" 2023-08-31 16:31:10 +01:00
SBBreakpointListExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBBreakpointLocationDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBBreakpointLocationExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBBreakpointNameDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBBreakpointNameExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBBroadcasterDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBBroadcastExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBCommandInterpreterDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBCommandInterpreterRunOptionsDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBCommandReturnObjectDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBCommandReturnObjectExtensions.i Revert "Re-land "[lldb/docs] Silence warnings when generating website"" 2023-08-31 16:31:10 +01:00
SBCommunicationDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBCompileUnitDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBCompileUnitExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBDataDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBDataExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBDebuggerDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBDebuggerExtensions.i Revert "Re-land "[lldb/docs] Silence warnings when generating website"" 2023-08-31 16:31:10 +01:00
SBDeclarationDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBDeclarationExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBEnvironmentDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBErrorDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBErrorExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBEventDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBExecutionContextDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBExecutionContextExtensions.i Revert "Re-land "[lldb/docs] Silence warnings when generating website"" 2023-08-31 16:31:10 +01:00
SBExpressionOptionsDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBFileDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBFileExtensions.i Revert "Re-land "[lldb/docs] Silence warnings when generating website"" 2023-08-31 16:31:10 +01:00
SBFileSpecDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBFileSpecExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBFileSpecListDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBFileSpecListExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBFrameDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBFrameExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBFunctionDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBFunctionExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBHostOSDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBInstructionDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBInstructionExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBInstructionListDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBInstructionListExtensions.i Revert "Re-land "[lldb/docs] Silence warnings when generating website"" 2023-08-31 16:31:10 +01:00
SBLanguageRuntimeDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBLaunchInfoDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBLineEntryDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBLineEntryExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBListenerDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBMemoryRegionInfoDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBMemoryRegionInfoExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBMemoryRegionInfoListDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBMemoryRegionInfoListExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBModuleDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBModuleExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBModuleSpecDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBModuleSpecExtensions.i Revert "Re-land "[lldb/docs] Silence warnings when generating website"" 2023-08-31 16:31:10 +01:00
SBModuleSpecListExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBPlatformDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBProcessDocstrings.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBProcessExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBProcessInfoDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBProcessInfoListExtensions.i [lldb] Expose SBPlatform::GetAllProcesses to the SB API (#68378) 2023-10-06 10:43:31 -07:00
SBQueueDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBQueueItemDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBQueueItemExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBReproducerDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBScriptObjectExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBSectionDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBSectionExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBSourceManagerDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBStreamDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBStreamExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBStringListDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBStringListExtensions.i Revert "Re-land "[lldb/docs] Silence warnings when generating website"" 2023-08-31 16:31:10 +01:00
SBStructuredDataDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBStructuredDataExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBSymbolContextDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBSymbolContextExtensions.i Revert "Re-land "[lldb/docs] Silence warnings when generating website"" 2023-08-31 16:31:10 +01:00
SBSymbolContextListDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBSymbolContextListExtensions.i Revert "Re-land "[lldb/docs] Silence warnings when generating website"" 2023-08-31 16:31:10 +01:00
SBSymbolDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBSymbolExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBTargetDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBTargetExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBThreadCollectionDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBThreadCollectionExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBThreadDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBThreadExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBThreadPlanDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBTraceCursorDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBTraceDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBTypeCategoryDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBTypeCategoryExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBTypeDocstrings.i Add the ability to get a C++ vtable ValueObject from another ValueObj… (#67599) 2023-10-30 17:46:18 -07:00
SBTypeEnumMemberDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBTypeEnumMemberExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBTypeExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBTypeFilterDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBTypeFilterExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBTypeFormatDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBTypeFormatExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBTypeNameSpecifierDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBTypeNameSpecifierExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBTypeSummaryDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBTypeSummaryExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBTypeSyntheticDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBTypeSyntheticExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBUnixSignalsDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBUnixSignalsExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBValueDocstrings.i Revert "Add SBValue::GetValueAsAddress API for removing non-addressing metadata" 2023-03-02 14:36:37 -08:00
SBValueExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBValueListDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBValueListExtensions.i Revert "Re-land "[lldb/docs] Silence warnings when generating website"" 2023-08-31 16:31:10 +01:00
SBVariablesOptionsDocstrings.i [lldb] Replace SB swig interfaces with API headers 2023-02-16 11:18:04 -08:00
SBWatchpointDocstrings.i [LLDB] Expose several methods in SBWatchpoint 2023-03-01 11:15:05 -08:00
SBWatchpointExtensions.i Re-land "[lldb/docs] Silence warnings when generating website" 2023-08-31 20:35:10 +01:00
SBWatchpointOptionsDocstrings.i Reland "[lldb] Add 'modify' type watchpoints, make it default (#66308)" 2023-09-21 10:35:15 +00:00