<div dir="ltr">Hi there,<div><br></div><div>I've been working on a patch for LLDB but have been having an issue running the test suite (even on a clean checkout of trunk) where the ScriptInterpreter tests are hitting SIGSEGV. From what I understand, the unit test involves an embedded Python interpreter and it's happening when we try to import the LLDB module.</div><div><br></div><div>I was wondering whether anyone has encountered this before. I'm new to LLDB and LLVM in general so I figured I'd check if there's something obvious I'm doing wrong before going too far down the rabbit hole.</div><div><br></div><div>In case it's important, my CMake and Ninja invocations look like this:</div><div><br></div><div>cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PROJECTS="clang;lldb;libcxx;libcxxabi" -DCMAKE_CXX_COMPILER="g++-5" -DLLVM_PARALLEL_LINK_JOBS=1 -DBUILD_SHARED_LIBS=ON ../llvm</div><div><br></div><div>LD_LIBRARY_PATH=/home/alexc/work/llvm-project/build/lib ninja check-lldb-unit<br></div><div><br></div><div>And each stack trace looks like this:</div><div><br></div><div>[==========] Running 1 test from 1 test case.<br>[----------] Global test environment set-up.<br>[----------] 1 test from PythonExceptionStateTest<br>[ RUN      ] PythonExceptionStateTest.TestExceptionStateChecking<br> #0 0x00007efeaf557e4d llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/alexc/work/llvm-project/llvm/lib/Support/Unix/Signals.inc:532:0<br> #1 0x00007efeaf557ee0 PrintStackTraceSignalHandler(void*) /home/alexc/work/llvm-project/llvm/lib/Support/Unix/Signals.inc:593:0<br> #2 0x00007efeaf555da8 llvm::sys::RunSignalHandlers() /home/alexc/work/llvm-project/llvm/lib/Support/Signals.cpp:68:0<br> #3 0x00007efeaf557801 SignalHandler(int) /home/alexc/work/llvm-project/llvm/lib/Support/Unix/Signals.inc:384:0<br> #4 0x00007efeaeec7890 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)<br> #5 0x00007efe9a63c6ee _init (/usr/lib/x86_64-linux-gnu/libLLVM-6.0.so.1+0x6db6ee)<br> #6 0x00007efeb74aa733 call_init /build/glibc-OTsEL5/glibc-2.27/elf/dl-init.c:72:0<br> #7 0x00007efeb74aa733 _dl_init /build/glibc-OTsEL5/glibc-2.27/elf/dl-init.c:119:0<br> #8 0x00007efeb74af1ff dl_open_worker /build/glibc-OTsEL5/glibc-2.27/elf/dl-open.c:525:0<br> #9 0x00007efeab7642df _dl_catch_exception /build/glibc-OTsEL5/glibc-2.27/elf/dl-error-skeleton.c:197:0<br>#10 0x00007efeb74ae7ca _dl_open /build/glibc-OTsEL5/glibc-2.27/elf/dl-open.c:605:0<br>#11 0x00007efeaecb1f96 __asprintf /build/glibc-OTsEL5/glibc-2.27/dlfcn/dlopen.c:66:0<br>#12 0x00007efeab7642df _dl_catch_exception /build/glibc-OTsEL5/glibc-2.27/elf/dl-error-skeleton.c:197:0<br>#13 0x00007efeab76436f _dl_catch_error /build/glibc-OTsEL5/glibc-2.27/elf/dl-error-skeleton.c:216:0<br>#14 0x00007efeaecb2735 _dlerror_run /build/glibc-OTsEL5/glibc-2.27/dlfcn/dlerror.c:162:0<br>#15 0x00007efeaecb2051 dlopen /build/glibc-OTsEL5/glibc-2.27/dlfcn/dlopen.c:87:0<br>#16 0x00007efeac1a0950 _PyImport_GetDynLoadFunc (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1ba950)<br>#17 0x00007efeac143e30 _PyImport_LoadDynamicModule (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x15de30)<br>#18 0x00007efeac1bb3ee (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1d53ee)<br>#19 0x00007efeac145041 (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x15f041)<br>#20 0x00007efeac145326 (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x15f326)<br>#21 0x00007efeac145715 PyImport_ImportModuleLevel (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x15f715)<br>#22 0x00007efeac09b274 (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0xb5274)<br>#23 0x00007efeac03a4a3 PyObject_Call (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x544a3)<br>#24 0x00007efeac1c5127 PyEval_CallObjectWithKeywords (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1df127)<br>#25 0x00007efeac0913cc PyEval_EvalFrameEx (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0xab3cc)<br>#26 0x00007efeac1c5bf8 PyEval_EvalCodeEx (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1dfbf8)<br>#27 0x00007efeac08d409 PyEval_EvalCode (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0xa7409)<br>#28 0x00007efeac1b5abc PyImport_ExecCodeModuleEx (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1cfabc)<br>#29 0x00007efeac1bad52 (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1d4d52)<br>#30 0x00007efeac1bb32e (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1d532e)<br>#31 0x00007efeac1bb63a (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1d563a)<br>#32 0x00007efeac145041 (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x15f041)<br>#33 0x00007efeac145542 PyImport_ImportModuleLevel (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x15f542)<br>#34 0x00007efeac09b274 (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0xb5274)<br>#35 0x00007efeac03a4a3 PyObject_Call (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x544a3)<br>#36 0x00007efeac1c5127 PyEval_CallObjectWithKeywords (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1df127)<br>#37 0x00007efeac0913cc PyEval_EvalFrameEx (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0xab3cc)<br>#38 0x00007efeac1c5bf8 PyEval_EvalCodeEx (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1dfbf8)<br>#39 0x00007efeac08d409 PyEval_EvalCode (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0xa7409)<br>#40 0x00007efeac13d6d6 PyRun_StringFlags (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1576d6)<br>#41 0x00007efeac13d76b PyRun_SimpleStringFlags (/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x15776b)<br>#42 0x0000558f9f40a0d1 lldb_private::ScriptInterpreterPythonImpl::InitializePrivate() /home/alexc/work/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp:3183:0<br>#43 0x0000558f9f3b2de2 PythonTestSuite::SetUp() /home/alexc/work/llvm-project/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp:39:0<br>#44 0x00007efeb704ab33 void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/alexc/work/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2404:0<br>#45 0x00007efeb704435e void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /home/alexc/work/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2455:0<br>#46 0x00007efeb702af8f testing::Test::Run() /home/alexc/work/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2472:0<br>#47 0x00007efeb702b7a4 testing::TestInfo::Run() /home/alexc/work/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2660:0<br>#48 0x00007efeb702bda8 testing::TestCase::Run() /home/alexc/work/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2773:0<br>#49 0x00007efeb7031cb4 testing::internal::UnitTestImpl::RunAllTests() /home/alexc/work/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:4647:0<br>#50 0x00007efeb704bbb6 bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/alexc/work/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2404:0<br>#51 0x00007efeb7044e73 bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /home/alexc/work/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2455:0<br>#52 0x00007efeb7030b2c testing::UnitTest::Run() /home/alexc/work/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:4260:0<br>#53 0x00007efeb7297cac RUN_ALL_TESTS() /home/alexc/work/llvm-project/llvm/utils/unittest/googletest/include/gtest/gtest.h:2234:0<br>#54 0x00007efeb7297bb8 main /home/alexc/work/llvm-project/llvm/utils/unittest/UnitTestMain/TestMain.cpp:51:0<br>#55 0x00007efeab61eb97 __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0<br>#56 0x0000558f9f39b20a _start (/mnt/data0/alexc/work/llvm-project/build/tools/lldb/unittests/ScriptInterpreter/Python/./ScriptInterpreterPythonTests+0x1a220a)<br></div><div><br></div><div>Thanks,</div><div>Alex</div></div>