[Lldb-commits] [PATCH] D142926: [lldb] Replace SB swig interfaces with API headers

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 16 15:30:07 PST 2023


bulbazord added a comment.

In D142926#4133356 <https://reviews.llvm.org/D142926#4133356>, @saugustine wrote:

> I don't think this necessarily matters or is a reason to revert, but we are seeing issues with this patch and swig 3.0.2, that disappear with swig 4.0.
>
> The docs claim that versions past 3.0 are supported (except for some odd corner cases).
>
> The failure is:
>
>   Traceback (most recent call last):
>     File "/build/work/37f17038e9cfbfbee7db556850bc7314bdb1/google3/runfiles/google3/third_party/llvm/llvm-project/lldb/test/API/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py", line 19, in test_address_breakpoints
>       self.address_breakpoints()
>     File "/build/work/37f17038e9cfbfbee7db556850bc7314bdb1/google3/runfiles/google3/third_party/llvm/llvm-project/lldb/test/API/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py", line 50, in address_breakpoints
>       launch_info = lldb.SBLaunchInfo(None)
>     File "/build/work/37f17038e9cfbfbee7db556850bc7314bdb1/google3/runfiles/google3/third_party/py/lldb/dotest_wrapper.par/google3/third_party/llvm/llvm-project/lldb/lib/python/site-packages/lldb/__init__.py", line 6239, in __init__
>       this = _lldb.new_SBLaunchInfo(*args)
>   ValueError: invalid null reference in method 'new_SBLaunchInfo', argument 1 of type 'lldb::SBLaunchInfo const &'
>   Config=x86_64-/build/work/37f17038e9cfbfbee7db556850bc7314bdb1/google3/runfiles/google3/devtools/c/lldb/testing/clang
>
> If I modify the line
>
>   launch_info = lldb.SBLaunchInfo(None)
>
> to
>
>   launch_info = lldb.SBLaunchInfo("")
>
> I get this error, which gives a clue to the fix:
>
>   NotImplementedError: Wrong number or type of arguments for overloaded function 'new_SBLaunchInfo'.
>     Possible C/C++ prototypes are:
>       lldb::SBLaunchInfo::SBLaunchInfo(char const **)
>       lldb::SBLaunchInfo::SBLaunchInfo(lldb::SBLaunchInfo const &)
>
> So if I use a vector of strings to match the first overload, the error disappears and the tests pass:
>
>   launch_info = lldb.SBLaunchInfo(["", ""])
>
> Not sure the best way forward here. Either to abandon old versions of swig, or to clean up the launch command.

I'm not sure we're going to be able to drop support for older versions of swig at this time. Prior to this change, `SBLaunchInfo` only had one constructor exposed to python (the one that takes a `const char **`). This change exposes the `SBLaunchInfo` copy constructor.
The way I see it there are two options: (1) Stop exposing the copy constructor, or (2) Modify all the uses of `SBLaunchInfo` to take a list of empty strings.
Considering that this worked fine before, I'm inclined to stop exposing the SBLaunchInfo copy constructor. I'll upload a patch to handle that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142926/new/

https://reviews.llvm.org/D142926



More information about the lldb-commits mailing list