<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/lldb/test/API/python_api/debugger, 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] Add support for unique target ids (#160736)</title>
<updated>2025-10-07T19:36:47+00:00</updated>
<author>
<name>Janet Yang</name>
<email>qxy11@meta.com</email>
</author>
<published>2025-10-07T19:36:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=7546bd38041612e8b768f4b315e491cd549d608c'/>
<id>7546bd38041612e8b768f4b315e491cd549d608c</id>
<content type='text'>
### Summary
Add support for unique target ids per Target instance. This is needed
for upcoming changes to allow debugger instances to be shared across
separate DAP instances for child process debugging. We want the IDE to
be able to attach to existing targets in an already runny lldb-dap
session, and having a unique ID per target would make that easier.

Each Target instance will have its own unique id, and uses a
function-local counter in `TargetList::CreateTargetInternal` to assign
incremental unique ids.

### Tests
Added several unit tests to test basic functionality, uniqueness of
targets, and target deletion doesn't affect the uniqueness.
```
bin/lldb-dotest -p TestDebuggerAPI
```</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
### Summary
Add support for unique target ids per Target instance. This is needed
for upcoming changes to allow debugger instances to be shared across
separate DAP instances for child process debugging. We want the IDE to
be able to attach to existing targets in an already runny lldb-dap
session, and having a unique ID per target would make that easier.

Each Target instance will have its own unique id, and uses a
function-local counter in `TargetList::CreateTargetInternal` to assign
incremental unique ids.

### Tests
Added several unit tests to test basic functionality, uniqueness of
targets, and target deletion doesn't affect the uniqueness.
```
bin/lldb-dotest -p TestDebuggerAPI
```</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] Add class property for the version string (#145974)</title>
<updated>2025-06-27T15:30:02+00:00</updated>
<author>
<name>Jonas Devlieghere</name>
<email>jonas@devlieghere.com</email>
</author>
<published>2025-06-27T15:30:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=37b0b0f7d2b67fedd347a4011582802303657e69'/>
<id>37b0b0f7d2b67fedd347a4011582802303657e69</id>
<content type='text'>
Add a class property for the version string. This allows you to use
access the version string through `lldb.SBDebugger.version` instead of
having to call `lldb.SBDebugger.GetVersionString()`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add a class property for the version string. This allows you to use
access the version string through `lldb.SBDebugger.version` instead of
having to call `lldb.SBDebugger.GetVersionString()`.</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Renormalize line endings whitespace only after dccebddb3b80"</title>
<updated>2024-10-18T20:16:50+00:00</updated>
<author>
<name>Luke Drummond</name>
<email>luke.drummond@codeplay.com</email>
</author>
<published>2024-10-18T20:16:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b55c52c047a167f42abbde9a33356cfb96b82c7f'/>
<id>b55c52c047a167f42abbde9a33356cfb96b82c7f</id>
<content type='text'>
This reverts commit 9d98acb196a40fee5229afeb08f95fd36d41c10a.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 9d98acb196a40fee5229afeb08f95fd36d41c10a.
</pre>
</div>
</content>
</entry>
<entry>
<title>Renormalize line endings whitespace only after dccebddb3b80</title>
<updated>2024-10-17T13:49:26+00:00</updated>
<author>
<name>Luke Drummond</name>
<email>luke.drummond@codeplay.com</email>
</author>
<published>2024-10-17T13:49:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=9d98acb196a40fee5229afeb08f95fd36d41c10a'/>
<id>9d98acb196a40fee5229afeb08f95fd36d41c10a</id>
<content type='text'>
Line ending policies were changed in the parent, dccebddb3b80. To make
it easier to resolve downstream merge conflicts after line-ending
policies are adjusted this is a separate whitespace-only commit. If you
have merge conflicts as a result, you can simply `git add --renormalize
-u &amp;&amp; git merge --continue` or `git add --renormalize -u &amp;&amp; git rebase
--continue` - depending on your workflow.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Line ending policies were changed in the parent, dccebddb3b80. To make
it easier to resolve downstream merge conflicts after line-ending
policies are adjusted this is a separate whitespace-only commit. If you
have merge conflicts as a result, you can simply `git add --renormalize
-u &amp;&amp; git merge --continue` or `git add --renormalize -u &amp;&amp; git rebase
--continue` - depending on your workflow.
</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] Fixed the TestDebuggerAPI test running on a remote target (#93829)</title>
<updated>2024-05-30T15:56:46+00:00</updated>
<author>
<name>Dmitry Vasilyev</name>
<email>dvassiliev@accesssoftek.com</email>
</author>
<published>2024-05-30T15:56:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=59e2a6b08f3e40afea87da3838ba69e1e15b6672'/>
<id>59e2a6b08f3e40afea87da3838ba69e1e15b6672</id>
<content type='text'>
Recently we have disabled this test for Windows host and Linux target.
Now we faced the same issue #92419 in case of Linux x86_64 host and
Linux Aarch64 target.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Recently we have disabled this test for Windows host and Linux target.
Now we faced the same issue #92419 in case of Linux x86_64 host and
Linux Aarch64 target.</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] Fixed the TestDebuggerAPI test on x86_64 Windows host (#90580)</title>
<updated>2024-05-24T19:19:51+00:00</updated>
<author>
<name>Dmitry Vasilyev</name>
<email>dvassiliev@accesssoftek.com</email>
</author>
<published>2024-05-24T19:19:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=77369a7f1a81f7991a3df2dad1bc8e277bc7559d'/>
<id>77369a7f1a81f7991a3df2dad1bc8e277bc7559d</id>
<content type='text'>
Disable the TestDebuggerAPI test in case of the remote target and
Windows host.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Disable the TestDebuggerAPI test in case of the remote target and
Windows host.</pre>
</div>
</content>
</entry>
<entry>
<title>SBDebugger: Add new APIs `AddDestroyCallback` and `RemoveDestroyCallback` (#89868)</title>
<updated>2024-05-20T22:51:42+00:00</updated>
<author>
<name>royitaqi</name>
<email>royitaqi@users.noreply.github.com</email>
</author>
<published>2024-05-20T22:51:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=9f62775038b9135709a2c3c7ea97c944278967a2'/>
<id>9f62775038b9135709a2c3c7ea97c944278967a2</id>
<content type='text'>
# Motivation

Individual callers of `SBDebugger::SetDestroyCallback()` might think
that they have registered their callback and expect it to be called when
the debugger is destroyed. In reality, only the last caller survives,
and all previous callers are forgotten, which might be a surprise to
them. Worse, if this is called in a race condition, which callback
survives is less predictable, which may case confusing behavior
elsewhere.

# This PR

Allows multiple destroy callbacks to be registered and all called when
the debugger is destroyed.

**EDIT**: Adds two new APIs: `AddDestroyCallback()` and
`ClearDestroyCallback()`. `SetDestroyCallback()` will first clear then
add the given callback. Tests are added for the new APIs.

## Tests

```
bin/llvm-lit -sv ../external/llvm-project/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
```

## (out-dated, see comments below) Semantic change to
`SetDestroyCallback()`

~~Currently, the method overwrites the old callback with the new one.
With this PR, it will NOT overwrite. Instead, it will hold on to both.
Both callbacks get called during destroy.~~

~~**Risk**: Although the documentation of `SetDestroyCallback()` (see
[C++](https://lldb.llvm.org/cpp_reference/classlldb_1_1SBDebugger.html#afa1649d9453a376b5c95888b5a0cb4ec)
and
[python](https://lldb.llvm.org/python_api/lldb.SBDebugger.html#lldb.SBDebugger.SetDestroyCallback))
doesn't really specify the behavior, there is a risk: if existing call
sites rely on the "overwrite" behavior, they will be surprised because
now the old callback will get called. But as the above said, the current
behavior of "overwrite" itself might be unintended, so I don't
anticipate users to rely on this behavior. In short, this risk might be
less of a problem if we correct it sooner rather than later (which is
what this PR is trying to do).~~

## (out-dated, see comments below) Implementation

~~The implementation holds a `std::vector&lt;std::pair&lt;callback, baton&gt;&gt;`.
When `SetDestroyCallback()` is called, callbacks and batons are appended
to the `std::vector`. When destroy event happen, the `(callback, baton)`
pairs are invoked FIFO. Finally, the `std::vector` is cleared.~~

# (out-dated, see comments below) Alternatives considered

~~Instead of changing `SetDestroyCallback()`, a new method
`AddDestroyCallback()` can be added, which use the same
`std::vector&lt;std::pair&lt;&gt;&gt;` implementation. Together with
`ClearDestroyCallback()` (see below), they will replace and deprecate
`SetDestroyCallback()`. Meanwhile, in order to be backward compatible,
`SetDestroyCallback()` need to be updated to clear the `std::vector` and
then add the new callback. Pros: The end state is semantically more
correct. Cons: More steps to take; potentially maintaining an
"incorrect" behavior (of "overwrite").~~

~~A new method `ClearDestroyCallback()` can be added. Might be
unnecessary at this point, because workflows which need to set then
clear callbacks may exist but shouldn't be too common at least for now.
Such method can be added later when needed.~~

~~The `std::vector` may bring slight performance drawback if its
implementation doesn't handle small size efficiently. However, even if
that's the case, this path should be very cold (only used during init
and destroy). Such performance drawback should be negligible.~~

~~A different implementation was also considered. Instead of using
`std::vector`, the current `m_destroy_callback` field can be kept
unchanged. When `SetDestroyCallback()` is called, a lambda function can
be stored into `m_destroy_callback`. This lambda function will first
call the old callback, then the new one. This way, `std::vector` is
avoided. However, this implementation is more complex, thus less
readable, with not much perf to gain.~~

---------

Co-authored-by: Roy Shi &lt;royshi@meta.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
# Motivation

Individual callers of `SBDebugger::SetDestroyCallback()` might think
that they have registered their callback and expect it to be called when
the debugger is destroyed. In reality, only the last caller survives,
and all previous callers are forgotten, which might be a surprise to
them. Worse, if this is called in a race condition, which callback
survives is less predictable, which may case confusing behavior
elsewhere.

# This PR

Allows multiple destroy callbacks to be registered and all called when
the debugger is destroyed.

**EDIT**: Adds two new APIs: `AddDestroyCallback()` and
`ClearDestroyCallback()`. `SetDestroyCallback()` will first clear then
add the given callback. Tests are added for the new APIs.

## Tests

```
bin/llvm-lit -sv ../external/llvm-project/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
```

## (out-dated, see comments below) Semantic change to
`SetDestroyCallback()`

~~Currently, the method overwrites the old callback with the new one.
With this PR, it will NOT overwrite. Instead, it will hold on to both.
Both callbacks get called during destroy.~~

~~**Risk**: Although the documentation of `SetDestroyCallback()` (see
[C++](https://lldb.llvm.org/cpp_reference/classlldb_1_1SBDebugger.html#afa1649d9453a376b5c95888b5a0cb4ec)
and
[python](https://lldb.llvm.org/python_api/lldb.SBDebugger.html#lldb.SBDebugger.SetDestroyCallback))
doesn't really specify the behavior, there is a risk: if existing call
sites rely on the "overwrite" behavior, they will be surprised because
now the old callback will get called. But as the above said, the current
behavior of "overwrite" itself might be unintended, so I don't
anticipate users to rely on this behavior. In short, this risk might be
less of a problem if we correct it sooner rather than later (which is
what this PR is trying to do).~~

## (out-dated, see comments below) Implementation

~~The implementation holds a `std::vector&lt;std::pair&lt;callback, baton&gt;&gt;`.
When `SetDestroyCallback()` is called, callbacks and batons are appended
to the `std::vector`. When destroy event happen, the `(callback, baton)`
pairs are invoked FIFO. Finally, the `std::vector` is cleared.~~

# (out-dated, see comments below) Alternatives considered

~~Instead of changing `SetDestroyCallback()`, a new method
`AddDestroyCallback()` can be added, which use the same
`std::vector&lt;std::pair&lt;&gt;&gt;` implementation. Together with
`ClearDestroyCallback()` (see below), they will replace and deprecate
`SetDestroyCallback()`. Meanwhile, in order to be backward compatible,
`SetDestroyCallback()` need to be updated to clear the `std::vector` and
then add the new callback. Pros: The end state is semantically more
correct. Cons: More steps to take; potentially maintaining an
"incorrect" behavior (of "overwrite").~~

~~A new method `ClearDestroyCallback()` can be added. Might be
unnecessary at this point, because workflows which need to set then
clear callbacks may exist but shouldn't be too common at least for now.
Such method can be added later when needed.~~

~~The `std::vector` may bring slight performance drawback if its
implementation doesn't handle small size efficiently. However, even if
that's the case, this path should be very cold (only used during init
and destroy). Such performance drawback should be negligible.~~

~~A different implementation was also considered. Instead of using
`std::vector`, the current `m_destroy_callback` field can be kept
unchanged. When `SetDestroyCallback()` is called, a lambda function can
be stored into `m_destroy_callback`. This lambda function will first
call the old callback, then the new one. This way, `std::vector` is
avoided. However, this implementation is more complex, thus less
readable, with not much perf to gain.~~

---------

Co-authored-by: Roy Shi &lt;royshi@meta.com&gt;</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>[NFC][Py Reformat] Reformat python files in lldb</title>
<updated>2023-05-25T19:54:09+00:00</updated>
<author>
<name>Jonas Devlieghere</name>
<email>jonas@devlieghere.com</email>
</author>
<published>2023-05-25T15:48:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2238dcc39358353cac21df75c3c3286ab20b8f53'/>
<id>2238dcc39358353cac21df75c3c3286ab20b8f53</id>
<content type='text'>
This is an ongoing series of commits that are reformatting our Python
code. Reformatting is done with `black` (23.1.0).

If you end up having problems merging this commit because you have made
changes to a python file, the best way to handle that is to run `git
checkout --ours &lt;yourfile&gt;` and then reformat it with black.

RFC: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style

Differential revision: https://reviews.llvm.org/D151460
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is an ongoing series of commits that are reformatting our Python
code. Reformatting is done with `black` (23.1.0).

If you end up having problems merging this commit because you have made
changes to a python file, the best way to handle that is to run `git
checkout --ours &lt;yourfile&gt;` and then reformat it with black.

RFC: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style

Differential revision: https://reviews.llvm.org/D151460
</pre>
</div>
</content>
</entry>
<entry>
<title>Add a new SBDebugger::SetDestroyCallback() API</title>
<updated>2023-03-07T22:48:15+00:00</updated>
<author>
<name>Jeffrey Tan</name>
<email>jeffreytan@fb.com</email>
</author>
<published>2023-02-04T01:09:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b461398f1ce307ec80708b7eb50f3bc82b76ed3f'/>
<id>b461398f1ce307ec80708b7eb50f3bc82b76ed3f</id>
<content type='text'>
Adding a new SBDebugger::SetDestroyCallback() API.
This API can be used by any client to query for statistics/metrics before
exiting debug sessions.

Differential Revision: https://reviews.llvm.org/D143520
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Adding a new SBDebugger::SetDestroyCallback() API.
This API can be used by any client to query for statistics/metrics before
exiting debug sessions.

Differential Revision: https://reviews.llvm.org/D143520
</pre>
</div>
</content>
</entry>
</feed>
