[lldb-dev] [Bug 42284] New: Support SWIG 4.0

via lldb-dev lldb-dev at lists.llvm.org
Fri Jun 14 05:40:06 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42284

            Bug ID: 42284
           Summary: Support SWIG 4.0
           Product: lldb
           Version: 8.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: pyry.kontio at drasa.eu
                CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org

Created attachment 22106
  --> https://bugs.llvm.org/attachment.cgi?id=22106&action=edit
A Python wrapper generated by SWIG 4

The SWIG project released SWIG 4.0.0 on 2019-04-27. Some package managers such
as Homebrew rapidly included it as the default version. However, the current
interface files seem to generate broken wrappers with SWIG 4.

Having SWIG 4 installed and LLDB built using it, it errors like this:

$ echo "import lldb" > test_lldb.py
$ bin/lldb
(lldb) command script import test_lldb.py

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File
"/Users/kon/repos/llvm-project/build/lib/python2.7/site-packages/lldb/__init__.py",
line 1500, in <module>
    class SBAddress(object):
  File
"/Users/kon/repos/llvm-project/build/lib/python2.7/site-packages/lldb/__init__.py",
line 1675, in SBAddress
    __swig_getmethods__["module"] = GetModule
NameError: name '__swig_getmethods__' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
error: module importing failed: No module named test_script.py
  File "temp.py", line 1, in <module>

The important difference seems to be that SWIG 4 doesn't, by default, generate
dictionaries __swig_getmethods__ and __swig_setmethods__ to the objects.

Looking at the release notes, the passage "Python module overhaul by
simplifying the generated code and turning most optimizations on by default."
like the likely culprit.

I'm going to ask about the recommended way to migrate on the SWIG users mailing
list, but if someone knows a good fix, please reply.

Some projects such as Rust's LLDB support were already regressed by accidental
upgrade to SWIG 4. ( https://github.com/rust-lang/rust/pull/61827 ) It would be
great if LLDB could quickly support the 4.x series.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20190614/020bd510/attachment.html>


More information about the lldb-dev mailing list