[lldb-dev] Trouble with ScriptInterpreter unit tests

Alex Cameron via lldb-dev lldb-dev at lists.llvm.org
Sat Sep 14 01:49:47 PDT 2019


Hi there,

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.

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.

In case it's important, my CMake and Ninja invocations look like this:

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

LD_LIBRARY_PATH=/home/alexc/work/llvm-project/build/lib ninja
check-lldb-unit

And each stack trace looks like this:

[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from PythonExceptionStateTest
[ RUN      ] PythonExceptionStateTest.TestExceptionStateChecking
 #0 0x00007efeaf557e4d llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/alexc/work/llvm-project/llvm/lib/Support/Unix/Signals.inc:532:0
 #1 0x00007efeaf557ee0 PrintStackTraceSignalHandler(void*)
/home/alexc/work/llvm-project/llvm/lib/Support/Unix/Signals.inc:593:0
 #2 0x00007efeaf555da8 llvm::sys::RunSignalHandlers()
/home/alexc/work/llvm-project/llvm/lib/Support/Signals.cpp:68:0
 #3 0x00007efeaf557801 SignalHandler(int)
/home/alexc/work/llvm-project/llvm/lib/Support/Unix/Signals.inc:384:0
 #4 0x00007efeaeec7890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #5 0x00007efe9a63c6ee _init
(/usr/lib/x86_64-linux-gnu/libLLVM-6.0.so.1+0x6db6ee)
 #6 0x00007efeb74aa733 call_init
/build/glibc-OTsEL5/glibc-2.27/elf/dl-init.c:72:0
 #7 0x00007efeb74aa733 _dl_init
/build/glibc-OTsEL5/glibc-2.27/elf/dl-init.c:119:0
 #8 0x00007efeb74af1ff dl_open_worker
/build/glibc-OTsEL5/glibc-2.27/elf/dl-open.c:525:0
 #9 0x00007efeab7642df _dl_catch_exception
/build/glibc-OTsEL5/glibc-2.27/elf/dl-error-skeleton.c:197:0
#10 0x00007efeb74ae7ca _dl_open
/build/glibc-OTsEL5/glibc-2.27/elf/dl-open.c:605:0
#11 0x00007efeaecb1f96 __asprintf
/build/glibc-OTsEL5/glibc-2.27/dlfcn/dlopen.c:66:0
#12 0x00007efeab7642df _dl_catch_exception
/build/glibc-OTsEL5/glibc-2.27/elf/dl-error-skeleton.c:197:0
#13 0x00007efeab76436f _dl_catch_error
/build/glibc-OTsEL5/glibc-2.27/elf/dl-error-skeleton.c:216:0
#14 0x00007efeaecb2735 _dlerror_run
/build/glibc-OTsEL5/glibc-2.27/dlfcn/dlerror.c:162:0
#15 0x00007efeaecb2051 dlopen
/build/glibc-OTsEL5/glibc-2.27/dlfcn/dlopen.c:87:0
#16 0x00007efeac1a0950 _PyImport_GetDynLoadFunc
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1ba950)
#17 0x00007efeac143e30 _PyImport_LoadDynamicModule
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x15de30)
#18 0x00007efeac1bb3ee
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1d53ee)
#19 0x00007efeac145041
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x15f041)
#20 0x00007efeac145326
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x15f326)
#21 0x00007efeac145715 PyImport_ImportModuleLevel
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x15f715)
#22 0x00007efeac09b274
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0xb5274)
#23 0x00007efeac03a4a3 PyObject_Call
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x544a3)
#24 0x00007efeac1c5127 PyEval_CallObjectWithKeywords
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1df127)
#25 0x00007efeac0913cc PyEval_EvalFrameEx
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0xab3cc)
#26 0x00007efeac1c5bf8 PyEval_EvalCodeEx
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1dfbf8)
#27 0x00007efeac08d409 PyEval_EvalCode
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0xa7409)
#28 0x00007efeac1b5abc PyImport_ExecCodeModuleEx
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1cfabc)
#29 0x00007efeac1bad52
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1d4d52)
#30 0x00007efeac1bb32e
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1d532e)
#31 0x00007efeac1bb63a
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1d563a)
#32 0x00007efeac145041
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x15f041)
#33 0x00007efeac145542 PyImport_ImportModuleLevel
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x15f542)
#34 0x00007efeac09b274
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0xb5274)
#35 0x00007efeac03a4a3 PyObject_Call
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x544a3)
#36 0x00007efeac1c5127 PyEval_CallObjectWithKeywords
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1df127)
#37 0x00007efeac0913cc PyEval_EvalFrameEx
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0xab3cc)
#38 0x00007efeac1c5bf8 PyEval_EvalCodeEx
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1dfbf8)
#39 0x00007efeac08d409 PyEval_EvalCode
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0xa7409)
#40 0x00007efeac13d6d6 PyRun_StringFlags
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x1576d6)
#41 0x00007efeac13d76b PyRun_SimpleStringFlags
(/usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0+0x15776b)
#42 0x0000558f9f40a0d1
lldb_private::ScriptInterpreterPythonImpl::InitializePrivate()
/home/alexc/work/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp:3183:0
#43 0x0000558f9f3b2de2 PythonTestSuite::SetUp()
/home/alexc/work/llvm-project/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp:39:0
#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
#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
#46 0x00007efeb702af8f testing::Test::Run()
/home/alexc/work/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2472:0
#47 0x00007efeb702b7a4 testing::TestInfo::Run()
/home/alexc/work/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2660:0
#48 0x00007efeb702bda8 testing::TestCase::Run()
/home/alexc/work/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:2773:0
#49 0x00007efeb7031cb4 testing::internal::UnitTestImpl::RunAllTests()
/home/alexc/work/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:4647:0
#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
#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
#52 0x00007efeb7030b2c testing::UnitTest::Run()
/home/alexc/work/llvm-project/llvm/utils/unittest/googletest/src/gtest.cc:4260:0
#53 0x00007efeb7297cac RUN_ALL_TESTS()
/home/alexc/work/llvm-project/llvm/utils/unittest/googletest/include/gtest/gtest.h:2234:0
#54 0x00007efeb7297bb8 main
/home/alexc/work/llvm-project/llvm/utils/unittest/UnitTestMain/TestMain.cpp:51:0
#55 0x00007efeab61eb97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#56 0x0000558f9f39b20a _start
(/mnt/data0/alexc/work/llvm-project/build/tools/lldb/unittests/ScriptInterpreter/Python/./ScriptInterpreterPythonTests+0x1a220a)

Thanks,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20190914/55199df8/attachment.html>


More information about the lldb-dev mailing list