<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/lldb/test/API/functionalities/vtable, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[lldb] Fix TestVTableValue.py test_overwrite_vtable test (#164910)</title>
<updated>2025-10-27T17:25:58+00:00</updated>
<author>
<name>Daniel Sanders</name>
<email>daniel_l_sanders@apple.com</email>
</author>
<published>2025-10-27T17:25:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e903494967ad9b9a68c62f984cf53db24b4532e9'/>
<id>e903494967ad9b9a68c62f984cf53db24b4532e9</id>
<content type='text'>
Some machines have read-only vtables but this test expects to overwrite
them. Use -no_data_const to ensure the vtable is writable</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some machines have read-only vtables but this test expects to overwrite
them. Use -no_data_const to ensure the vtable is writable</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] Add additional assertions to TestVTableValue.test_overwrite_vtable (#118719)</title>
<updated>2024-12-05T18:38:23+00:00</updated>
<author>
<name>Alex Langford</name>
<email>alangford@apple.com</email>
</author>
<published>2024-12-05T18:38:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=abb6919a63c7ef017bb4f9c86057adcdb8129964'/>
<id>abb6919a63c7ef017bb4f9c86057adcdb8129964</id>
<content type='text'>
If this test fails, you're likely going to see something like "Assertion
Error: A != B" which doesn't really give much explanation for why this
failed.

Instead of ignoring the error, we should assert that it succeeded. This
will lead to a better error message, for example:
`AssertionError: 'memory write failed for 0x102d7c018' is not success`</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If this test fails, you're likely going to see something like "Assertion
Error: A != B" which doesn't really give much explanation for why this
failed.

Instead of ignoring the error, we should assert that it succeeded. This
will lead to a better error message, for example:
`AssertionError: 'memory write failed for 0x102d7c018' is not success`</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] Replace assertEquals with assertEqual (NFC) (#82073)</title>
<updated>2024-02-17T04:58:50+00:00</updated>
<author>
<name>Jonas Devlieghere</name>
<email>jonas@devlieghere.com</email>
</author>
<published>2024-02-17T04:58:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=80fcecb13c388ff087a27a4b0e7ca3dd8c98eaa4'/>
<id>80fcecb13c388ff087a27a4b0e7ca3dd8c98eaa4</id>
<content type='text'>
assertEquals is a deprecated alias for assertEqual and has been removed
in Python 3.12. This wasn't an issue previously because we used a
vendored version of the unittest module. Now that we use the built-in
version this gets updated together with the Python version used to run
the test suite.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
assertEquals is a deprecated alias for assertEqual and has been removed
in Python 3.12. This wasn't an issue previously because we used a
vendored version of the unittest module. Now that we use the built-in
version this gets updated together with the Python version used to run
the test suite.</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] Fix Python test formatting (NFC)</title>
<updated>2024-02-16T06:54:00+00:00</updated>
<author>
<name>Jonas Devlieghere</name>
<email>jonas@devlieghere.com</email>
</author>
<published>2024-02-16T06:53:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=096c530ab3ea5c96526451181117f30db17b4b1d'/>
<id>096c530ab3ea5c96526451181117f30db17b4b1d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb][test] TestVTableValue.py: skip base_class_ptr test case on older Clang versions</title>
<updated>2023-11-07T05:18:23+00:00</updated>
<author>
<name>Michael Buch</name>
<email>michaelbuch12@gmail.com</email>
</author>
<published>2023-11-07T05:16:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d08d9cf55629a300a54ab1660912b044145540f1'/>
<id>d08d9cf55629a300a54ab1660912b044145540f1</id>
<content type='text'>
This failed on the public LLDB matrix build bots on Clang versions &lt;
9.0:
```
======================================================================
FAIL: test_base_class_ptr (TestVTableValue.TestVTableValue)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "lldb/test/API/functionalities/vtable/TestVTableValue.py", line 90, in test_base_class_ptr
    self.assertEquals(shape_ptr_vtable.GetNumChildren(), 5)
AssertionError: 6 != 5
```
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This failed on the public LLDB matrix build bots on Clang versions &lt;
9.0:
```
======================================================================
FAIL: test_base_class_ptr (TestVTableValue.TestVTableValue)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "lldb/test/API/functionalities/vtable/TestVTableValue.py", line 90, in test_base_class_ptr
    self.assertEquals(shape_ptr_vtable.GetNumChildren(), 5)
AssertionError: 6 != 5
```
</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb][test] TestVTableValue.py: skip test for older versions of clang (#71372)</title>
<updated>2023-11-06T19:15:39+00:00</updated>
<author>
<name>Michael Buch</name>
<email>michaelbuch12@gmail.com</email>
</author>
<published>2023-11-06T19:15:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=876bd794fc33c74fc8689015699b9fec06dd0580'/>
<id>876bd794fc33c74fc8689015699b9fec06dd0580</id>
<content type='text'>
This fails on the matrix build bot for Clang versions &lt; 9.0


https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/7309/execution/node/102/log/?consoleFull

```
FAIL: LLDB :: test_vtable (TestVTableValue.TestVTableValue)
&lt;bound method SBProcess.Kill of SBProcess: pid = 35338, state = stopped, threads = 1, executable = a.out&gt;: success

======================================================================
FAIL: test_base_class_ptr (TestVTableValue.TestVTableValue)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "lldb/test/API/functionalities/vtable/TestVTableValue.py", line 90, in test_base_class_ptr
    self.assertEquals(shape_ptr_vtable.GetNumChildren(), 5)
AssertionError: 6 != 5
======================================================================
FAIL: test_vtable (TestVTableValue.TestVTableValue)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "lldb/test/API/functionalities/vtable/TestVTableValue.py", line 67, in test_vtable
    self.assertEquals(vtable.GetNumChildren(), 5)
AssertionError: 6 != 5
----------------------------------------------------------------------
Ran 4 tests in 2.799s

RESULT: FAILED (2 passes, 2 failures, 0 errors, 0 skipped, 0 expected failures, 0 unexpected successes)
```</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This fails on the matrix build bot for Clang versions &lt; 9.0


https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/7309/execution/node/102/log/?consoleFull

```
FAIL: LLDB :: test_vtable (TestVTableValue.TestVTableValue)
&lt;bound method SBProcess.Kill of SBProcess: pid = 35338, state = stopped, threads = 1, executable = a.out&gt;: success

======================================================================
FAIL: test_base_class_ptr (TestVTableValue.TestVTableValue)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "lldb/test/API/functionalities/vtable/TestVTableValue.py", line 90, in test_base_class_ptr
    self.assertEquals(shape_ptr_vtable.GetNumChildren(), 5)
AssertionError: 6 != 5
======================================================================
FAIL: test_vtable (TestVTableValue.TestVTableValue)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "lldb/test/API/functionalities/vtable/TestVTableValue.py", line 67, in test_vtable
    self.assertEquals(vtable.GetNumChildren(), 5)
AssertionError: 6 != 5
----------------------------------------------------------------------
Ran 4 tests in 2.799s

RESULT: FAILED (2 passes, 2 failures, 0 errors, 0 skipped, 0 expected failures, 0 unexpected successes)
```</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] Fix TestVTableValue on 32 bit</title>
<updated>2023-11-03T10:36:39+00:00</updated>
<author>
<name>David Spickett</name>
<email>david.spickett@linaro.org</email>
</author>
<published>2023-11-03T10:35:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4be8a7bda55c5b50832b773b204f75cd26c5979d'/>
<id>4be8a7bda55c5b50832b773b204f75cd26c5979d</id>
<content type='text'>
7fbd427f5ebea4a4ebf25747758851875bb7e173 added a test that overwrites
a vtable entry but it uses and expects a 64 bit value. Add the 32 bit
equivalents.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
7fbd427f5ebea4a4ebf25747758851875bb7e173 added a test that overwrites
a vtable entry but it uses and expects a 64 bit value. Add the 32 bit
equivalents.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add the ability to get a C++ vtable ValueObject from another ValueObj… (#67599)</title>
<updated>2023-10-31T00:46:18+00:00</updated>
<author>
<name>Greg Clayton</name>
<email>gclayton@fb.com</email>
</author>
<published>2023-10-31T00:46:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=7fbd427f5ebea4a4ebf25747758851875bb7e173'/>
<id>7fbd427f5ebea4a4ebf25747758851875bb7e173</id>
<content type='text'>
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 &lt;class-name&gt;". 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 &lt;class&gt;"
- 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
```</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;class-name&gt;". 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 &lt;class&gt;"
- 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
```</pre>
</div>
</content>
</entry>
</feed>
