Избегайте подключения отладчика в Qt5 Qtest

У меня есть маленький QTest случай, который падает Даже если я запускаю это как обычную программу (без отладчика), кажется, что GDB присоединяется qmake/QtCreator/что-то, когда он обнаруживает, что программа потерпела крах.

Тем не менее, я хотел бы запустить мой QTest без этого. Как я могу настроить свой проект, чтобы избежать вызова отладчика для обычных сессий без отладки?

Чтобы продемонстрировать, что я имею в виду, пожалуйста, взгляните на следующий результат теста при запуске моего теста без отладчика (я просто нажимаю большую зеленую кнопку воспроизведения без ошибки в QtCreator):

Кнопки воспроизведения в QtCreator

Starting /home/lennart/Desktop/Projects/build/OctoMY/Desktop_Qt_5_8_0_GCC_64bit-Debug/test/testOpenCL/test_opencl...
********* Start testing of TestOpenCL *********
Config: Using QtTest library 5.8.0, Qt 5.8.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.1 20160406 (Red Hat 5.3.1-6))
PASS   : TestOpenCL::initTestCase()
QDEBUG : TestOpenCL::test() CL:  cl::Platform::get(&platforms)
QDEBUG : TestOpenCL::test() Making OpenCL device selection with selectstring='', allowGPU=true, allowCPU=false
QDEBUG : TestOpenCL::test() Platform-0: NVIDIA Corporation
QDEBUG : TestOpenCL::test()  |-- Device-0.0: GeForce GTX 780M ( GPU x 8 ) Memory: 3.94 GiB Global, 48.00 KiB Local, 64.00 KiB ConstantFLAGS[AC-L] profile= FULL_PROFILE [SEL]
QDEBUG : TestOpenCL::test() Platform-1: Intel(R) Corporation
QDEBUG : TestOpenCL::test()  |-- Device-1.0: Intel(R) Core(TM) i7-4900MQ CPU @ 2.80GHz ( CPU x 8 ) Memory: 31.34 GiB Global, 32.00 KiB Global, 128.00 KiB ConstantFLAGS[AC-L] profile= FULL_PROFILE [---]
QDEBUG : TestOpenCL::test() CREATED WORKER WITH INDEX  0
QDEBUG : TestOpenCL::test() CURTHREADDES:  "7fb2d2f7e8c0"
QDEBUG : TestOpenCL::test() STARTING  1  CL Thread(s)------------------------
QDEBUG : TestOpenCL::test() CURTHREAD1:  "7fb2d2f7e8c0"
QDEBUG : TestOpenCL::test() CLWORKER! PRE start in thread  "7fb2d2f7e8c0"  for device  "GeForce GTX 780M ( GPU x 8 ) Memory: 3.94 GiB Global, 48.00 KiB Local, 64.00 KiB ConstantFLAGS[AC-L] profile= FULL_PROFILE"

========= Received signal, dumping stack ==============
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Attaching to process 8381
[New LWP 8382]
[New LWP 8384]
[New LWP 8385]
[New LWP 8386]
[New LWP 8387]
[New LWP 8389]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007fb2cff3b51b in __GI___waitpid (pid=8390, 
    stat_loc=stat_loc@entry=0x7fb2d15d76d0, options=options@entry=0)
    at ../sysdeps/unix/sysv/linux/waitpid.c:29
(gdb) 
Thread 7 (Thread 0x7fb2b8a2b700 (LWP 8389)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 ()
    at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225
No locals.
#1  0x00007fb2d0d2b226 in QWaitCondition::wait(QMutex*, unsigned long) ()
   from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#2  0x00007fb2d13b46ea in ?? ()
   from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Test.so.5
No symbol table info available.
#3  0x00007fb2d0d2a549 in ?? ()
   from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#4  0x00007fb2d07d96ba in start_thread (arg=0x7fb2b8a2b700)
    at pthread_create.c:333
        __res = <optimized out>
        pd = 0x7fb2b8a2b700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140405578577664, 
                6155754743274290712, 0, 140722087602047, 140405578578368, 
                140722087602232, -6194469194561864168, -6194698366305157608}, 
              mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, 
            data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        pagesize_m1 = <optimized out>
        sp = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#5  0x00007fb2cff7682d in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
No locals.

Thread 6 (Thread 0x7fb2b922c700 (LWP 8387)):
#0  0x00007fb2cff6ab5d in poll () at ../sysdeps/unix/syscall-template.S:84
No locals.
#1  0x00007fb2cf24738c in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#2  0x00007fb2cf24749c in g_main_context_iteration ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#3  0x00007fb2d0f42cbf in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#4  0x00007fb2d0ef09ca in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#5  0x00007fb2d0d25bdc in QThread::exec() ()
   from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#6  0x00007fb2c8688535 in ?? ()
   from /home/lennart/Qt/5.8/gcc_64/lib/libQt5DBus.so.5
No symbol table info available.
#7  0x00007fb2d0d2a549 in ?? ()
   from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#8  0x00007fb2d07d96ba in start_thread (arg=0x7fb2b922c700)
    at pthread_create.c:333
        __res = <optimized out>
        pd = 0x7fb2b922c700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140405586970368, 
                6155754743274290712, 0, 140722087601151, 140405586971072, 
                140722087601336, -6194472492559876584, -6194698366305157608}, 
              mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, 
            data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        pagesize_m1 = <optimized out>
        sp = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#9  0x00007fb2cff7682d in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
No locals.

Thread 5 (Thread 0x7fb2bacfb700 (LWP 8386)):
#0  0x00007fb2cff6ab5d in poll () at ../sysdeps/unix/syscall-template.S:84
No locals.
#1  0x00007fb2cf24738c in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#2  0x00007fb2cf247712 in g_main_loop_run ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#3  0x00007fb2c4d969d6 in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
No symbol table info available.
#4  0x00007fb2cf26dbb5 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#5  0x00007fb2d07d96ba in start_thread (arg=0x7fb2bacfb700)
    at pthread_create.c:333
        __res = <optimized out>
        pd = 0x7fb2bacfb700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140405615081216, 
                6155754743274290712, 0, 140405631863295, 140405615081920, 
                140405500865744, -6194464014831305192, -6194698366305157608}, 
              mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, 
            data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        pagesize_m1 = <optimized out>
        sp = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#6  0x00007fb2cff7682d in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
No locals.

Thread 4 (Thread 0x7fb2bb4fc700 (LWP 8385)):
#0  0x00007fb2cff6ab5d in poll () at ../sysdeps/unix/syscall-template.S:84
No locals.
#1  0x00007fb2cf24738c in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#2  0x00007fb2cf24749c in g_main_context_iteration ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#3  0x00007fb2cf2474d9 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#4  0x00007fb2cf26dbb5 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#5  0x00007fb2d07d96ba in start_thread (arg=0x7fb2bb4fc700)
    at pthread_create.c:333
        __res = <optimized out>
        pd = 0x7fb2bb4fc700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140405623473920, 
                6155754743274290712, 0, 140405631862943, 140405623474624, 0, 
                -6194467312829317608, -6194698366305157608}, 
              mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, 
            data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        pagesize_m1 = <optimized out>
        sp = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#6  0x00007fb2cff7682d in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
No locals.

Thread 3 (Thread 0x7fb2bbcfd700 (LWP 8384)):
#0  0x00007fb2cff6ab5d in poll () at ../sysdeps/unix/syscall-template.S:84
No locals.
#1  0x00007fb2cf24738c in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#2  0x00007fb2cf24749c in g_main_context_iteration ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#3  0x00007fb2bbd0528d in ?? ()
   from /usr/lib/x86_64-linux-gnu/gio/modules/libdconfsettings.so
No symbol table info available.
#4  0x00007fb2cf26dbb5 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
No symbol table info available.
#5  0x00007fb2d07d96ba in start_thread (arg=0x7fb2bbcfd700)
    at pthread_create.c:333
        __res = <optimized out>
        pd = 0x7fb2bbcfd700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140405631866624, 
                6155754743274290712, 0, 140722087597503, 140405631867328, 
                12918864, -6194466212780818920, -6194698366305157608}, 
              mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, 
            data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        pagesize_m1 = <optimized out>
        sp = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#6  0x00007fb2cff7682d in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
No locals.

Thread 2 (Thread 0x7fb2c72fd700 (LWP 8382)):
#0  0x00007fb2cff6ab5d in poll () at ../sysdeps/unix/syscall-template.S:84
No locals.
#1  0x00007fb2cb3e5c62 in poll (__timeout=-1, __nfds=1, __fds=0x7fb2c72fcc00)
    at /usr/include/x86_64-linux-gnu/bits/poll2.h:46
No locals.
#2  _xcb_conn_wait (c=c@entry=0xbc4800, cond=cond@entry=0xbc4840, 
    vector=vector@entry=0x0, count=count@entry=0x0)
    at ../../src/xcb_conn.c:459
        ret = <optimized out>
        fd = {fd = 3, events = 1, revents = 0}
#3  0x00007fb2cb3e78d7 in xcb_wait_for_event (c=0xbc4800)
    at ../../src/xcb_in.c:693
        ret = 0x0
#4  0x00007fb2c8937429 in ?? ()
   from /home/lennart/Qt/5.8/gcc_64/lib/libQt5XcbQpa.so.5
No symbol table info available.
#5  0x00007fb2d0d2a549 in ?? ()
   from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#6  0x00007fb2d07d96ba in start_thread (arg=0x7fb2c72fd700)
    at pthread_create.c:333
        __res = <optimized out>
        pd = 0x7fb2c72fd700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140405822707456, 
                6155754743274290712, 0, 140722087600911, 140405822708160, 
                140722087601096, -6194652854879633896, -6194698366305157608}, 
              mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, 
            data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        pagesize_m1 = <optimized out>
        sp = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#7  0x00007fb2cff7682d in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
No locals.

Thread 1 (Thread 0x7fb2d2f7e8c0 (LWP 8381)):
#0  0x00007fb2cff3b51b in __GI___waitpid (pid=8390, 
    stat_loc=stat_loc@entry=0x7fb2d15d76d0, options=options@entry=0)
    at ../sysdeps/unix/sysv/linux/waitpid.c:29
        resultvar = 18446744073709551104
        sc_cancel_oldtype = 0
#1  0x00007fb2cfeb4fbb in do_system (line=<optimized out>)
    at ../sysdeps/posix/system.c:148
        __result = <optimized out>
        _buffer = {__routine = 0x7fb2cfeb52b0 <cancel_handler>, 
          __arg = 0x7fb2d15d76ac, __canceltype = 0, __prev = 0x0}
        _avail = 1
        status = 0
        save = <optimized out>
        pid = 8390
        sa = {__sigaction_handler = {sa_handler = 0x1, sa_sigaction = 0x1}, 
          sa_mask = {__val = {65536, 0 <repeats 15 times>}}, sa_flags = 0, 
          sa_restorer = 0x7fb2d0234700 <stderr>}
        omask = {__val = {21711, 0, 18446744073692774400, 
            0 <repeats 13 times>}}
#2  0x00007fb2d13ab95e in ?? ()
   from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Test.so.5
No symbol table info available.
#3  0x00007fb2d13ab9ed in ?? ()
   from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Test.so.5
No symbol table info available.
#4  0x00007fb2d13aba82 in ?? ()
   from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Test.so.5
No symbol table info available.
#5  <signal handler called>
No locals.
#6  0x00007fb2d1ac1251 in QOpenGLContext::format() const ()
   from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Gui.so.5
No symbol table info available.
#7  0x00007fb2d1d858e8 in QOpenGLFunctions_4_0_Core::isContextCompatible(QOpenGLContext*) () from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Gui.so.5
No symbol table info available.
#8  0x00007fb2d1d859c8 in QOpenGLFunctions_4_0_Core::initializeOpenGLFunctions() () from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Gui.so.5
No symbol table info available.
#9  0x000000000041ceb7 in CLWorker::preProcess (this=0xd56130, th=...)
    at /home/lennart/Desktop/Projects/OctoMY/libs/libclt/opencl/CLWorker.cpp:119
        __PRETTY_FUNCTION__ = "void CLWorker::preProcess(QThread&)"
#10 0x0000000000411fa1 in CLThreadManager::setRunning (this=0x7ffc6a0b1f90, 
    running=true, block=true)
    at /home/lennart/Desktop/Projects/OctoMY/libs/libclt/opencl/CLThreadManager.cpp:111
        worker = 0xd56130
        thread = 0xd253e0
        wthread1 = 0xbb68f0
        i = 0
        currentThread = 0xbb68f0
        sz = 1
        isAlreadyuRunning = false
        __PRETTY_FUNCTION__ = "void CLThreadManager::setRunning(bool, bool)"
#11 0x000000000040ba6a in TestOpenCL::test (this=0x7ffc6a0b2ad0)
    at /home/lennart/Desktop/Projects/OctoMY/test/testOpenCL/TestOpenCL.cpp:74
        twf = {<CLWorkerFactory> = {
            _vptr.CLWorkerFactory = 0x6407b0 <vtable for TestCLWorkerFactory+16>}, <No data fields>}
        ic = {mDoGLInterop = true, mWidth = 320, mHeight = 240}
        sz = {wd = 320, ht = 240}
        tm = {<QObject> = {<No data fields>}, static staticMetaObject = {d = {
              superdata = 0x7fb2d138f720 <QObject::staticMetaObject>, 
              stringdata = 0x433040 <qt_meta_stringdata_CLThreadManager>, 
              data = 0x433080 <qt_meta_data_CLThreadManager>, 
              static_metacall = 0x42058c <CLThreadManager::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, 
              extradata = 0x0}}, mFactory = @0x7ffc6a0b1f50, 
          mDeviceSelection = {<QVector<cl::Device>> = {d = 0xdd41d0}, 
            _vptr.CLDeviceSelection = 0x6409b0 <vtable for CLDeviceSelection+16>}, mInteropConfig = {mDoGLInterop = true, mWidth = 320, mHeight = 240}, 
          mWorkers = {d = 0xdd4250}, mThreads = {d = 0xdce0a0}, 
          mDesiredCurrent = 0xbb68f0}
        start = 140402480906240
        now = 140406020391432
#12 0x0000000000410b62 in TestOpenCL::qt_static_metacall (_o=0x7ffc6a0b2ad0, 
    _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7ffc6a0b21a0)
    at moc_TestOpenCL.cpp:78
        _t = 0x7ffc6a0b2ad0
#13 0x00007fb2d0efcf7a in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const ()
   from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Core.so.5
No symbol table info available.
#14 0x00007fb2d13b2ad4 in ?? ()
   from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Test.so.5
No symbol table info available.
#15 0x00007fb2d13b33e6 in ?? ()
   from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Test.so.5
No symbol table info available.
#16 0x00007fb2d13b39d2 in ?? ()
   from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Test.so.5
No symbol table info available.
#17 0x00007fb2d13b3ea9 in QTest::qExec(QObject*, int, char**) ()
   from /home/lennart/Qt/5.8/gcc_64/lib/libQt5Test.so.5
No symbol table info available.
#18 0x000000000040bbfb in main (argc=1, argv=0x7ffc6a0b2be8)
    at /home/lennart/Desktop/Projects/OctoMY/test/testOpenCL/TestOpenCL.cpp:92
        app = <incomplete type>
        tc = {<QObject> = {<No data fields>}, static staticMetaObject = {d = {
              superdata = 0x7fb2d138f720 <QObject::staticMetaObject>, 
              stringdata = 0x431580 <qt_meta_stringdata_TestOpenCL>, 
              data = 0x431640 <qt_meta_data_TestOpenCL>, 
              static_metacall = 0x410b02 <TestOpenCL::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, 
              extradata = 0x0}}, crashHelper = {
            _vptr.CrashHelp = 0x640c90 <vtable for CrashHelp+16>}}
Detaching from program: /home/lennart/Desktop/Projects/build/OctoMY/Desktop_Qt_5_8_0_GCC_64bit-Debug/test/testOpenCL/test_opencl, process 8381
QFATAL : TestOpenCL::test() Received signal 11
         Function time: 16ms Total time: 16ms
FAIL!  : TestOpenCL::test() Received a fatal error.
   Loc: [Unknown file(0)]
Totals: 1 passed, 1 failed, 0 skipped, 0 blacklisted, 859ms
********* Finished testing of TestOpenCL *********
========= End of stack trace ==============
The program has unexpectedly finished.
/home/lennart/Desktop/Projects/build/OctoMY/Desktop_Qt_5_8_0_GCC_64bit-Debug/test/testOpenCL/test_opencl crashed.

1 ответ

Я нашел ответ вскоре после того, как задал вопрос.

После прочтения документации для QTest тщательно, я нашел параметр командной строки, который обещал "отключить обработчик сбоя". Вот документация по параметрам:

-nocrashhandler Отключает обработчик сбоев на платформах Unix. В Windows он снова включает диалоговое окно отчетов об ошибках Windows, которое по умолчанию отключено. Это полезно для отладки сбоев.

Добавив это в параметры запуска моего проекта в QtCreator, это сработало!

введите описание изображения здесь

Другие вопросы по тегам