311 Commits

Author SHA1 Message Date
Jonas Devlieghere
4322d03e4a
[lldb] Avoid having to list all the headers in headers.swig (#131934)
When adding SBLock, I realized you always have to add a new header in
two places: LLDB.h and headers.swig. 

I can't think of a reason the latter can't use the umbrella header and
avoid the duplication.
2025-03-19 07:45:25 -07:00
Jacob Lalonde
5b1c281fca
[LLDB][Docstrings] Fix some poorly formatted Docstrings (#129605)
I was looking earlier on the public doc website, and noticed the
markdown was very badly mangled for this recent docstring that I added.
So I'm dropping the backticks and just leaving the snippet.


![image](https://github.com/user-attachments/assets/de63ab73-3bd5-4f8f-a07c-9f6accfee7e1)
2025-03-06 18:57:54 -08:00
Jacob Lalonde
02f024ca97
[LLDB-DAP] SBDebugger don't prefix title on progress updates (#124648)
In my last DAP patch (#123837), we piped the DAP update message into the
update event. However, we had the title embedded into the update
message. This makes sense for progress Start, but makes the update
message look pretty wonky.


![image](https://github.com/user-attachments/assets/9f6083d1-fc50-455c-a1a7-a2f9bdaba22e)

Instead, we only use the title when it's the first message, removing the
duplicate title problem.

![image](https://github.com/user-attachments/assets/ee7aefd1-1852-46f7-94bc-84b8faef6dac)
2025-03-05 12:02:44 -08:00
David Spickett
2af0e2f3e6
Revert "Push down the swig module to avoid an import cycle" (#129714)
Reverts llvm/llvm-project#129135 due to buildbot test failures.

Definitely caused remote Linux to Windows failures
(https://lab.llvm.org/buildbot/#/builders/197/builds/2712), may be the
cause of Windows on Arm failures
https://lab.llvm.org/buildbot/#/builders/141/builds/6744.
2025-03-04 14:24:02 +00:00
Jacob Lalonde
3ff6fb68d7
[LLDB][SBProgress] Add a finalize method (#128966)
This patch adds a finalize method which destroys the underlying RAII
SBProgress. My primary motivation for this is so I can write better
tests that are non-flaky, but after discussing with @clayborg in my DAP
message improvement patch (#124648) this is probably an essential API
despite that I originally argued it wasn't.
2025-03-03 14:01:29 -08:00
wieDasDing
396139a3b6
Push down the swig module to avoid an import cycle (#129135)
Fix #92603

This replaces #113066. I finally came back to this issue and it seems
that this approach is still very promising.

As requested, I have added a short explanation as to why CPython module
should be moved into a submodule.

cc @JDevlieghere who reviewed on the previous PR earlier.
2025-03-03 09:39:19 -06:00
Jason Molenda
163ccfac33 [lldb][NFC] whitespace reflow 2025-02-06 15:04:29 -08:00
Jason Molenda
18bd118893
[lldb][NFC] Add documentation for SBFrame::GetRegisters (#125969)
SBFrame::GetRegisters() (and the .registers / .regs extensions in
Python) returns an array of register-set's, not registers like you might
expect from the API name. Document this.

---------

Co-authored-by: Will Hawkins <whh8b@obs.cr>
2025-02-06 09:19:22 -08:00
Jonas Devlieghere
97f6e53386
[lldb] Support CommandInterpreter print callbacks (#125006)
Xcode uses a pseudoterminal for the debugger console.

- The upside of this apporach is that it means that it can rely on
LLDB's IOHandlers for multiline and script input.
- The downside of this approach is that the command output is printed to
the PTY and you don't get a SBCommandReturnObject. Adrian added support
for inline diagnostics (#110901) and we'd like to access those from the
IDE.

This patch adds support for registering a callback in the command
interpreter that gives access to the `(SB)CommandReturnObject` right
before it will be printed. The callback implementation can choose
whether it likes to handle printing the result or defer to lldb. If the
callback indicated it handled the result, the command interpreter will
skip printing the result.

We considered a few other alternatives to solve this problem:

- The most obvious one is using `HandleCommand`, which returns a
`SBCommandReturnObject`. The problem with this approach is the multiline
input mentioned above. We would need a way to tell the IDE that it
should expect multiline input, which isn't known until LLDB starts
handling the command.
- To address the multiline issue,we considered exposing (some of the)
IOHandler machinery through the SB API. To solve this particular issue,
that would require reimplementing a ton of logic that already exists
today in the CommandInterpeter. Furthermore that seems like overkill
compared to the proposed solution.

rdar://141254310
2025-02-04 09:01:08 -08:00
Jacob Lalonde
a3321ea5d6
[LLDB][Documentation] Add a doc string to sbprocess to show MemoryRegions is iterable (#125557)
My colleague, @lukejriddle made the SBMemoryRegionList object iterable
in #117358. This isn't documented anywhere and so I added a blurb about
it to SBProcess.
2025-02-03 11:26:03 -08:00
Jacob Lalonde
e2005d1461
[LLDB] Reapply #123873 SBSaveCore Docstrings (#124355)
In my last attempt at this (#123873), I didn't realize we needed semi
colons! Also fixed the bug that the feature summary didn't have a type
defined.

CC @JDevlieghere hope you get a laugh at needing to revert doc strings
for breaking the build....
2025-01-24 14:59:56 -08:00
Dave Lee
7293455cf2
[lldb] Add SBThread.selected_frame property (#123981)
Adds a `selected_frame` property to `SBThread`. The setter accepts either a frame index (like `SetSelectedFrame`), or a frame object.

Updates a few tests to make use of the new `selected_frame`. While doing so I noticed some of the usage could be cleaned up, so I did that too.
2025-01-24 10:02:15 -08:00
Jacob Lalonde
18ee7e1792
Revert "[LLDB] Add draft docstrings for SBSaveCoreOptions" (#123873)
Reverts llvm/llvm-project#123132
2025-01-21 19:55:17 -08:00
Jacob Lalonde
d33e33fde7
[LLDB] Add draft docstrings for SBSaveCoreOptions (#123132)
SBSaveCoreOptions has been around for awhile now, so I decided to draft
up some Docstrings describing the functionality better. Some of my
wording sounded a bit clunky due the optionality of each method call so
I would greatly appreciate feedback.

Includes the new method in #122541 so I will merge this as a follow up.
2025-01-21 15:17:45 -08:00
Jacob Lalonde
6b048aeaf8
[LLDB] Add SBProgress so Python scripts can also report progress (#119052)
Recently I've been working on a lot of internal Python tooling, and in
certain cases I want to report async to the script over DAP. Progress.h
already handles this, so I've exposed Progress via the SB API so Python
scripts can also update progress objects.

I actually have no idea how to test this, so I just wrote a [toy command
to test
it](https://gist.github.com/Jlalond/48d85e75a91f7a137e3142e6a13d0947)


![image](https://github.com/user-attachments/assets/7317cbb8-9145-4fdb-bacf-9864bf50c467)

I also copied the first section of the extensive Progress.h class
documentation to the docstrings.
2025-01-17 12:00:31 -08:00
rchamala
b6960e2a63
[lldb][ResolveSourceFileCallback] Update SBModule (#120832)
Summary:
RFC
https://discourse.llvm.org/t/rfc-python-callback-for-source-file-resolution/83545

SBModule will be used for resolve source file callback as Python
function arguments. This diff allows these things.

Can be instantiated from SBPlatform.
Can be passed to/from Python.

Test Plan:
N/A. The next set of diffs in the stack have unittests and shell test
validation

Co-authored-by: Rahul Reddy Chamala <rachamal@fb.com>
2025-01-06 09:17:58 -08:00
Dave Lee
53fd724b25
[lldb] Add lookup by name to SBValue through new member property (#118814)
Introduces a `member` property to `SBValue`. This property provides pythonic access to a
value's members, by name. The expression `value.member["name"]` will be an alternate
form form of writing `value.GetChildMemberWithName("name")`.
2024-12-09 10:48:28 -08:00
Luke Riddle
2a1a02461a
Make SBMemoryRegionInfoList iterable with Python SWIG (#117358)
This PR fixes a simple SWIG issue with SBMemoryRegionInfoList not being
iterable out-of-the-box. This is mostly because of limitations to the
`lldb_iter` function, which doesn't allow for specifying arguments to
the size / iter functions passed.

Before:
```
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
>>> for region in lldb.process.GetMemoryRegions():
...   print(region)
...
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/opt/llvm/stable/Toolchains/llvm-sand.xctoolchain/usr/lib/python3.10/site-packages/lldb/__init__.py", line 114, in lldb_iter
    yield elem(i)
TypeError: SBMemoryRegionInfoList.GetMemoryRegionAtIndex() missing 1 required positional argument: 'region_info'
```

After:
```
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
>>> for region in lldb.process.GetMemoryRegions():
...   print(region)
... 
[0x0000000000200000-0x00000000002cf000 R--]
[0x00000000002cf000-0x0000000000597000 R-X]
[0x0000000000597000-0x00000000005ad000 R--]
[0x00000000005ad000-0x00000000005b1000 RW-]
[0x00000000005b1000-0x0000000000b68000 RW-]
[0x000000007fff7000-0x000000008fff7000 RW-]
[0x000002008fff7000-0x000010007fff8000 RW-]
[0x0000503000000000-0x0000503000010000 RW-]
[0x0000503e00000000-0x0000503e00010000 RW-]
[0x0000504000000000-0x0000504000010000 RW-]
[0x0000504e00000000-0x0000504e00010000 RW-]
[0x000050d000000000-0x000050d000010000 RW-]
[0x000050de00000000-0x000050de00010000 RW-]
[0x000050e000000000-0x000050e000010000 RW-]
[0x000050ee00000000-0x000050ee00010000 RW-]
[0x0000511000000000-0x0000511000010000 RW-]
[0x0000511e00000000-0x0000511e00010000 RW-]
[0x0000513000000000-0x0000513000010000 RW-]
...
```
2024-12-03 10:29:12 -08:00
Dave Lee
f170f5fa80
[lldb] Add stop_reason_data property to SBThread python extensions (#117266)
Add a pythonic `stop_reason_data` property to `SBThread`. The property
produces a list of ints.
2024-11-22 10:30:44 -08:00
Dave Lee
170e1fe5a5
[lldb] Fix regex support in SBTarget.modules_access (#116452)
First, `SRE_Pattern` does not exist on newer Python's, use
`type(re.compile(''))` like other Python extensions do. The dynamic type
is because some earlier versions of Python 3 do not have `re.Pattern`.

Second, `SBModule` has a `file` property, not a `path` property.
2024-11-18 16:15:41 -08:00
jimingham
04b443e778
Add the ability to define custom completers to the parsed_cmd template. (#109062)
If your arguments or option values are of a type that naturally uses one
of our common completion mechanisms, you will get completion for free.
But if you have your own custom values or if you want to do fancy things
like have `break set -s foo.dylib -n ba<TAB>` only complete on symbols
in foo.dylib, you can use this new mechanism to achieve that.
2024-09-24 10:00:00 -07:00
Med Ismail Bennani
f732157a9d
[lldb/Interpreter] Introduce ScriptedStopHook{,Python}Interface & make use of it (#109498)
This patch re-lands #105449 and fixes the various test failures.

---------

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2024-09-20 16:55:47 -07:00
David Spickett
801046e330 Revert "[lldb] Fix SWIG wrapper compilation error"
...and "[lldb/Interpreter] Introduce `ScriptedStopHook{,Python}Interface` & make use of it (#105449)"

This reverts commit 76b827bb4d5b4cc4d3229c4c6de2529e8b156810, and commit 1e131ddfa8f1d7b18c85c6e4079458be8b419421
because the first commit caused the test command-stop-hook-output.test to fail.
2024-09-20 09:57:07 +00:00
Med Ismail Bennani
1e131ddfa8
[lldb/Interpreter] Introduce ScriptedStopHook{,Python}Interface & make use of it (#105449)
This patch introduces new `ScriptedStopHook{,Python}Interface` classes
that make use of the Scripted Interface infrastructure and makes use of
it in `StopHookScripted`.

It also relax the requirement on the number of argument for initializing
scripting extension if the size of the interface parameter pack contains
1 less element than the extension maximum number of positional arguments
for this initializer.
This addresses the cases where the embedded interpreter session
dictionary is passed to the extension initializer which is not used most
of the time.

---------

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2024-09-19 23:35:34 -07:00
Adrian Prantl
b798f4bd50
[lldb] Make deep copies of Status explicit (NFC) (#107170) 2024-09-05 12:44:13 -07:00
Nicolas van Kempen
c49770c60f
[NFC] Prefer subprocess.DEVNULL over os.devnull (#106500)
There is no need to support Python 2.7 anymore, Python 3.3+ has
`subprocess.DEVNULL`. This is good practice and also prevents file
handles from
staying open unnecessarily.

Also remove a couple unused or unneeded `__future__` imports.
2024-08-30 19:26:49 +01:00
Adrian Prantl
0642cd768b
[lldb] Turn lldb_private::Status into a value type. (#106163)
This patch removes all of the Set.* methods from Status.

This cleanup is part of a series of patches that make it harder use the
anti-pattern of keeping a long-lives Status object around and updating
it while dropping any errors it contains on the floor.

This patch is largely NFC, the more interesting next steps this enables
is to:
1. remove Status.Clear()
2. assert that Status::operator=() never overwrites an error
3. remove Status::operator=()

Note that step (2) will bring 90% of the benefits for users, and step
(3) will dramatically clean up the error handling code in various
places. In the end my goal is to convert all APIs that are of the form

`    ResultTy DoFoo(Status& error)
`
to

`    llvm::Expected<ResultTy> DoFoo()
`
How to read this patch?

The interesting changes are in Status.h and Status.cpp, all other
changes are mostly

` perl -pi -e 's/\.SetErrorString/ = Status::FromErrorString/g' $(git
grep -l SetErrorString lldb/source)
`
plus the occasional manual cleanup.
2024-08-27 10:59:31 -07:00
Adrian Prantl
ad75775242 Revert "Revert "[lldb][swig] Use the correct variable in the return statement""
This reverts commit 7323e7eee3a819e9a2d8ec29f00d362bcad87731.
2024-08-23 11:06:01 -07:00
Adrian Prantl
3c0fba4f24 Revert "Revert "[lldb] Extend frame recognizers to hide frames from backtraces (#104523)""
This reverts commit 547917aebd1e79a8929b53f0ddf3b5185ee4df74.
2024-08-23 11:06:01 -07:00
Dmitri Gribenko
547917aebd Revert "[lldb] Extend frame recognizers to hide frames from backtraces (#104523)"
This reverts commit f01f80ce6ca7640bb0e267b84b1ed0e89b57e2d9.

This commit introduces an msan violation. See the discussion on https://github.com/llvm/llvm-project/pull/104523.
2024-08-22 13:24:57 +02:00
Dmitri Gribenko
7323e7eee3 Revert "[lldb][swig] Use the correct variable in the return statement"
This reverts commit 65281570afd7e35e01533b07c6c2937de410fc52.

I'm reverting https://github.com/llvm/llvm-project/pull/104523
(f01f80ce6c)
and this fixup belongs to the same series of changes.
2024-08-22 13:14:30 +02:00
Dmitri Gribenko
65281570af [lldb][swig] Use the correct variable in the return statement
The issue was introduced in
https://github.com/llvm/llvm-project/pull/104523.

The code introduces the `ret_val` variable but does not use it. Instead
it returns a pointer, which gets implicitly converted to bool.
2024-08-21 15:29:03 +02:00
Adrian Prantl
f01f80ce6c
[lldb] Extend frame recognizers to hide frames from backtraces (#104523)
Compilers and language runtimes often use helper functions that are
fundamentally uninteresting when debugging anything but the
compiler/runtime itself. This patch introduces a user-extensible
mechanism that allows for these frames to be hidden from backtraces and
automatically skipped over when navigating the stack with `up` and
`down`.

This does not affect the numbering of frames, so `f <N>` will still
provide access to the hidden frames. The `bt` output will also print a
hint that frames have been hidden.

My primary motivation for this feature is to hide thunks in the Swift
programming language, but I'm including an example recognizer for
`std::function::operator()` that I wished for myself many times while
debugging LLDB.

rdar://126629381


Example output. (Yes, my proof-of-concept recognizer could hide even
more frames if we had a method that returned the function name without
the return type or I used something that isn't based off regex, but it's
really only meant as an example).

before:
```
(lldb) thread backtrace --filtered=false
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
  * frame #0: 0x0000000100001f04 a.out`foo(x=1, y=1) at main.cpp:4:10
    frame #1: 0x0000000100003a00 a.out`decltype(std::declval<int (*&)(int, int)>()(std::declval<int>(), std::declval<int>())) std::__1::__invoke[abi:se200000]<int (*&)(int, int), int, int>(__f=0x000000016fdff280, __args=0x000000016fdff224, __args=0x000000016fdff220) at invoke.h:149:25
    frame #2: 0x000000010000399c a.out`int std::__1::__invoke_void_return_wrapper<int, false>::__call[abi:se200000]<int (*&)(int, int), int, int>(__args=0x000000016fdff280, __args=0x000000016fdff224, __args=0x000000016fdff220) at invoke.h:216:12
    frame #3: 0x0000000100003968 a.out`std::__1::__function::__alloc_func<int (*)(int, int), std::__1::allocator<int (*)(int, int)>, int (int, int)>::operator()[abi:se200000](this=0x000000016fdff280, __arg=0x000000016fdff224, __arg=0x000000016fdff220) at function.h:171:12
    frame #4: 0x00000001000026bc a.out`std::__1::__function::__func<int (*)(int, int), std::__1::allocator<int (*)(int, int)>, int (int, int)>::operator()(this=0x000000016fdff278, __arg=0x000000016fdff224, __arg=0x000000016fdff220) at function.h:313:10
    frame #5: 0x0000000100003c38 a.out`std::__1::__function::__value_func<int (int, int)>::operator()[abi:se200000](this=0x000000016fdff278, __args=0x000000016fdff224, __args=0x000000016fdff220) const at function.h:430:12
    frame #6: 0x0000000100002038 a.out`std::__1::function<int (int, int)>::operator()(this= Function = foo(int, int) , __arg=1, __arg=1) const at function.h:989:10
    frame #7: 0x0000000100001f64 a.out`main(argc=1, argv=0x000000016fdff4f8) at main.cpp:9:10
    frame #8: 0x0000000183cdf154 dyld`start + 2476
(lldb) 
```

after

```
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
  * frame #0: 0x0000000100001f04 a.out`foo(x=1, y=1) at main.cpp:4:10
    frame #1: 0x0000000100003a00 a.out`decltype(std::declval<int (*&)(int, int)>()(std::declval<int>(), std::declval<int>())) std::__1::__invoke[abi:se200000]<int (*&)(int, int), int, int>(__f=0x000000016fdff280, __args=0x000000016fdff224, __args=0x000000016fdff220) at invoke.h:149:25
    frame #2: 0x000000010000399c a.out`int std::__1::__invoke_void_return_wrapper<int, false>::__call[abi:se200000]<int (*&)(int, int), int, int>(__args=0x000000016fdff280, __args=0x000000016fdff224, __args=0x000000016fdff220) at invoke.h:216:12
    frame #6: 0x0000000100002038 a.out`std::__1::function<int (int, int)>::operator()(this= Function = foo(int, int) , __arg=1, __arg=1) const at function.h:989:10
    frame #7: 0x0000000100001f64 a.out`main(argc=1, argv=0x000000016fdff4f8) at main.cpp:9:10
    frame #8: 0x0000000183cdf154 dyld`start + 2476
Note: Some frames were hidden by frame recognizers
```
2024-08-20 16:01:22 -07:00
Jacob Lalonde
4120570dc4
[LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() overload (#98403)
This PR adds `SBSaveCoreOptions`, which is a container class for options
when LLDB is taking coredumps. For this first iteration this container
just keeps parity with the extant API of `file, style, plugin`. In the
future this options object can be extended to allow users to take a
subset of their core dumps.
2024-07-18 17:10:15 -07:00
jimingham
77d131eddb
Add the ability for Script based commands to specify their "repeat command" (#94823)
Among other things, returning an empty string as the repeat command
disables auto-repeat, which can be useful for state-changing commands.

There's one remaining refinement to this setup, which is that for parsed
script commands, it should be possible to change an option value, or add
a new option value that wasn't originally specified, then ask lldb "make
this back into a command string". That would make doing fancy things
with repeat commands easier.

That capability isn't present in the lldb_private side either, however.
So that's for a next iteration.

I haven't added this to the docs on adding commands yet. I wanted to
make sure this was an acceptable approach before I spend the time to do
that.
2024-07-03 10:39:34 -07:00
Med Ismail Bennani
622df0ee92
[lldb] Add scripted thread plan python base class to lldb & website (#97481)
Following a feedback request in #97262, I took out the scripted thread
plan python base class from it and make a separate PR for it.

This patch adds the scripted thread plan base python class to the lldb
python module as well as the lldb documentation website.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2024-07-02 15:20:18 -07:00
Med Ismail Bennani
9a9ec228cd
[lldb] Make use of Scripted{Python,}Interface for ScriptedThreadPlan (#70392) (#96868)
This patch makes ScriptedThreadPlan conforming to the ScriptedInterface
& ScriptedPythonInterface facilities by introducing 2
ScriptedThreadPlanInterface & ScriptedThreadPlanPythonInterface classes.

This allows us to get rid of every ScriptedThreadPlan-specific SWIG
method and re-use the same affordances as other scripting offordances,
like Scripted{Process,Thread,Platform} & OperatingSystem.

To do so, this adds new transformer methods for `ThreadPlan`, `Stream` &
`Event`, to allow the bijection between C++ objects and their python
counterparts.

This just re-lands #70392 after fixing test failures.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2024-06-27 01:45:30 -07:00
Eisuke Kawashima
586114510c
[lldb] fix(lldb/**.py): fix comparison to None (#94017)
from PEP8
(https://peps.python.org/pep-0008/#programming-recommendations):

> Comparisons to singletons like None should always be done with is or
is not, never the equality operators.

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2024-06-26 15:59:07 +01:00
Miro Bucko
0d4da0df16
[lldb][API] Add Find(Ranges)InMemory() to Process SB API (#96569)
This is a second attempt to land #95007

Test Plan:
llvm-lit
llvm-project/lldb/test/API/python_api/find_in_memory/TestFindInMemory.py
llvm-project/lldb/test/API/python_api/find_in_memory/TestFindRangesInMemory.py

Reviewers: clayborg

Tasks: lldb
2024-06-24 18:51:12 -04:00
Chelsea Cassanova
a32b7199f0
Revert commits that add TestFind(Ranges)InMemory.py (#96560)
Reverting to unblock macOS buildbots which are currently failing on
these tests.
https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/as-lldb-cmake/6377/
2024-06-24 15:12:49 -07:00
Miro Bucko
10bd5ad0a1
[lldb][API] Add Find(Ranges)InMemory() to Process SB API (#95007)
Test Plan:
llvm-lit
llvm-project/lldb/test/API/python_api/find_in_memory/TestFindInMemory.py

llvm-project/lldb/test/API/python_api/find_in_memory/TestFindRangesInMemory.py

Reviewers: clayborg

Tasks: lldb
2024-06-24 11:06:20 -04:00
Chelsea Cassanova
3d86eebdf8
Reland "[lldb][api-test] Add API test for SBCommandInterpreter::Comm… (#95181)
…andOverrideCallback (#94518)"

This reverts commit 7cff05ada05e87408966d56b4c1675033187ff5c. The API
test that was added erroneously imports a module that isn't needed and
wouldn't be found which causes a test failures. This reversion removes
that import.
2024-06-11 16:41:31 -07:00
Chelsea Cassanova
7cff05ada0 Revert "[lldb][api-test] Add API test for SBCommandInterpreter::CommandOverrideCallback (#94518)"
This reverts commit 6fb6eba9304b63e86ebf039edcb9a0b32e4b39e7.
This test breaks due to an incorrect import in the test.
2024-06-11 15:27:10 -07:00
Chelsea Cassanova
6fb6eba930
[lldb][api-test] Add API test for SBCommandInterpreter::CommandOverrideCallback (#94518)
`SBCommandInterpreter::CommandOverrideCallback` was not being exposed to
the Python API and has no coverage in the
API test suite, so this commits exposes and adds a test for it. Doing
this involves also adding a typemap for the callback used for this
function so that it matches the functionality of other callback
functions that are exposed to Python.
2024-06-11 15:20:35 -07:00
jimingham
435dd97461
Add AllowRepeats to SBCommandInterpreterRunOptions. (#94786)
This is useful if you have a transcript of a user session and want to
rerun those commands with RunCommandInterpreter. The same functionality
is also useful in testing.

I'm adding it primarily for the second reason. In a subsequent patch,
I'm adding the ability to Python based commands to provide their
"auto-repeat" command. Among other things, that will allow potentially
state destroying user commands to prevent auto-repeat. Testing this with
Shell or pexpect tests is not nearly as accurate or convenient as using
RunCommandInterpreter, but to use that I need to allow auto-repeat.

I think for consistency's sake, having interactive sessions always do
auto-repeats is the right choice, though that's a lightly held
opinion...
2024-06-07 17:05:29 -07:00
Miro Bucko
48175a5d9f
[lldb] Add SBAddressRange and SBAddressRangeList to SB API (#93836)
This adds new SB API calls and classes to allow a user of the SB API to obtain an address range from SBFunction and SBBlock. This is a second attempt to land the reverted PR #92014.
2024-05-30 10:38:21 -07:00
Michael Buch
8b600a3732 Revert "Add SBAddressRange and SBAddressRangeList to SB API (#92014)"
This reverts commit 42944e4600827738fae868f0df831fb2678be8b4.
2024-05-30 12:40:05 +01:00
Miro Bucko
42944e4600
Add SBAddressRange and SBAddressRangeList to SB API (#92014)
This adds new SB API calls and classes to allow a user of the SB API to obtain an address ranges from SBFunction and SBBlock.
2024-05-28 09:29:10 -07:00
Med Ismail Bennani
ae3f68066c
Revert "[lldb] Make use of Scripted{Python,}Interface for ScriptedThreadPlan (Reland #70392)" (#93153)
Reverts llvm/llvm-project#93149 since it breaks
https://lab.llvm.org/buildbot/#/builders/68/builds/74799
2024-05-23 01:46:29 -07:00
Med Ismail Bennani
4cc6d0f4df
[lldb] Make use of Scripted{Python,}Interface for ScriptedThreadPlan (Reland #70392) (#93149)
This patch makes ScriptedThreadPlan conforming to the ScriptedInterface
& ScriptedPythonInterface facilities by introducing 2
ScriptedThreadPlanInterface & ScriptedThreadPlanPythonInterface classes.

This allows us to get rid of every ScriptedThreadPlan-specific SWIG
method and re-use the same affordances as other scripting offordances,
like Scripted{Process,Thread,Platform} & OperatingSystem.

To do so, this adds new transformer methods for `ThreadPlan`, `Stream` &
`Event`, to allow the bijection between C++ objects and their python
counterparts.

This just re-lands #70392 after fixing test failures.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2024-05-23 01:25:48 -07:00