Bug report #19373

Aborted when debugging python plugin with pdb

Added by Zhan Li almost 2 years ago.

Status:Open
Priority:Normal
Assignee:-
Category:Python plugins
Affected QGIS version:3.2 Regression?:No
Operating System:Ubuntu 18.04 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:Yes Copied to github as #:27201

Description

Hi, I'm not sure if this is the right place to submit this issue for help. But I can't find a solution on google and failed to find a place to submit questions for help. I'm trying to debug a python plugin with pdb, without using IDE following the instruction here: https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/ide_debugging.html#debugging-using-pdb

The plugin "Value Tool" works well but I just tried to add something I need. I haven't changed anything in the .py files of the plugin except adding the following lines inside the script to test debugging a python plugin in QGIS with pdb.

# Use pdb for debugging
import pdb
# These lines allow you to set a breakpoint in the app
pyqtRemoveInputHook()
pdb.set_trace()

I started QGIS from the command line. The plugin was added and activated successfully. However, when I started using it which was supposed to hit the set_trace and enter pdb, the QGIS crashed with the following messages in the terminal.

<QgsPointXY: POINT>
1 active rasters, 1 canvas layers
QGIS died on signal 11[New LWP 10462]
[New LWP 10463]
[New LWP 10464]
[New LWP 10465]
[New LWP 10466]
[New LWP 10467]
[New LWP 10470]
[New LWP 10471]
[New LWP 10473]
[New LWP 10480]
[New LWP 10482]
[New LWP 10486]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007f26fd0656c2 in GI_waitpid (pid=10487, stat_loc=0x7ffeb01d406c, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
30 ../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
[Current thread is 1 (Thread 0x7f2700c28380 (LWP 10459))]
#0 0x00007f26fd0656c2 in GI_waitpid (pid=10487, stat_loc=0x7ffeb01d406c, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
resultvar = 18446744073709551104
sc_cancel_oldtype = 0
#1 0x0000556b04823fde in ()
#2 0x00007f26fcfbff20 in <signal handler called> () at /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007f26a6c13b5b in PyModule_GetState () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#4 0x00007f26500ad3b2 in () at /usr/lib/python3.6/lib-dynload/readline.cpython-36m-x86_64-linux-gnu.so
#5 0x00007f26c8b7b441 in rl_initialize () at /usr/lib/x86_64-linux-gnu/libedit.so.2
#6 0x00007f26500ada79 in PyInit_readline () at /usr/lib/python3.6/lib-dynload/readline.cpython-36m-x86_64-linux-gnu.so
#7 0x00007f26a6cc4bf3 in _PyImport_LoadDynamicModuleWithSpec () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#8 0x00007f26a6cc2ec7 in () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#9 0x00007f26a6c129a5 in PyCFunction_Call () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#10 0x00007f26a6ca78c0 in _PyEval_EvalFrameDefault () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#11 0x00007f26a6ca09fa in () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#12 0x00007f26a6ca0c92 in () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#13 0x00007f26a6ca5eb1 in _PyEval_EvalFrameDefault () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#14 0x00007f26a6ca0ff9 in () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#15 0x00007f26a6ca5eb1 in _PyEval_EvalFrameDefault () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#16 0x00007f26a6ca0ff9 in () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#17 0x00007f26a6ca5eb1 in _PyEval_EvalFrameDefault () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#18 0x00007f26a6ca0ff9 in () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#19 0x00007f26a6ca5eb1 in _PyEval_EvalFrameDefault () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#20 0x00007f26a6ca0ff9 in () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#21 0x00007f26a6ca5eb1 in _PyEval_EvalFrameDefault () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#22 0x00007f26a6ca9747 in _PyFunction_FastCallDict () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#23 0x00007f26a6ba83ae in _PyObject_FastCallDict () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#24 0x00007f26a6ba95f4 in _PyObject_CallMethodIdObjArgs () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#25 0x00007f26a6cc3ddc in PyImport_ImportModuleLevelObject () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#26 0x00007f26a6c9c7e4 in () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#27 0x00007f26a6c1288a in _PyCFunction_FastCallDict () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#28 0x00007f26a6ca0dff in () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#29 0x00007f26a6ca5eb1 in _PyEval_EvalFrameDefault () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#30 0x00007f26a6ca09fa in () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#31 0x00007f26a6ca95a9 in _PyFunction_FastCallDict () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#32 0x00007f26a6ba83ae in _PyObject_FastCallDict () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#33 0x00007f26a6ca3230 in _PyEval_EvalFrameDefault () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#34 0x00007f26a6ca09fa in () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#35 0x00007f26a6ca95a9 in _PyFunction_FastCallDict () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#36 0x00007f26a6ba83ae in _PyObject_FastCallDict () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#37 0x00007f26a6ba84ac in _PyObject_Call_Prepend () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#38 0x00007f26a6ba8178 in PyObject_Call () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#39 0x00007f26a6c30439 in () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#40 0x00007f26a6c2b6e2 in () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#41 0x00007f26a6ba82e9 in _PyObject_FastCallDict () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#42 0x00007f26a6ca0b59 in () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#43 0x00007f26a6ca5eb1 in _PyEval_EvalFrameDefault () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#44 0x00007f26a6ca0ff9 in () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#45 0x00007f26a6ca5eb1 in _PyEval_EvalFrameDefault () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#46 0x00007f26a6ca9747 in _PyFunction_FastCallDict () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#47 0x00007f26a6ba83ae in _PyObject_FastCallDict () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#48 0x00007f26a6ba84ac in _PyObject_Call_Prepend () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#49 0x00007f26a6ba8178 in PyObject_Call () at /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
#50 0x00007f26a6421c30 in () at /usr/lib/python3/dist-packages/PyQt5/QtCore.cpython-36m-x86_64-linux-gnu.so
#51 0x00007f26a6422108 in () at /usr/lib/python3/dist-packages/PyQt5/QtCore.cpython-36m-x86_64-linux-gnu.so
#52 0x00007f26a6422390 in () at /usr/lib/python3/dist-packages/PyQt5/QtCore.cpython-36m-x86_64-linux-gnu.so
#53 0x00007f26a6422d07 in () at /usr/lib/python3/dist-packages/PyQt5/QtCore.cpython-36m-x86_64-linux-gnu.so
#54 0x00007f26fdbd1679 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#55 0x00007f26fb515122 in QgsMapCanvas::xyCoordinates(QgsPointXY const&) () at /usr/lib/libqgis_gui.so.3.2.0
#56 0x00007f26fb3c3975 in QgsMapCanvas::mouseMoveEvent(QMouseEvent*) () at /usr/lib/libqgis_gui.so.3.2.0
#57 0x00007f26fe95f038 in QWidget::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#58 0x00007f26fea004be in QFrame::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#59 0x00007f26fec4dbfb in QGraphicsView::viewportEvent(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#60 0x00007f26fdba268c in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#61 0x00007f26fe920805 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#62 0x00007f26fe92864f in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#63 0x00007f26ff47bf3b in QgsApplication::notify(QObject*, QEvent*) () at /usr/lib/libqgis_core.so.3.2.0
#64 0x00007f26fdba29a8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#65 0x00007f26fe927622 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#66 0x00007f26fe97a14b in () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#67 0x00007f26fe97c7ba in () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#68 0x00007f26fe92082c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#69 0x00007f26fe9280f4 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#70 0x00007f26ff47bf3b in QgsApplication::notify(QObject*, QEvent*) () at /usr/lib/libqgis_core.so.3.2.0
#71 0x00007f26fdba29a8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#72 0x00007f26fe164523 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#73 0x00007f26fe165ff5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#74 0x00007f26fe13d2eb in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#75 0x00007f26d8bc81c0 in () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#76 0x00007f26f1b0a287 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#77 0x00007f26f1b0a4c0 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#78 0x00007f26f1b0a54c in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#79 0x00007f26fdbfb8ef in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#80 0x00007f26fdba09ea in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#81 0x00007f26fdba9a84 in QCoreApplication::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#82 0x0000556b048208a6 in ()
#83 0x00007f26fcfa2b97 in __libc_start_main (main=0x556b0481e5a0, argc=1, argv=0x7ffeb01d7d08, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffeb01d7cf8) at ../csu/libc-start.c:310
result = <optimized out>
unwind_buf = {cancel_jmp_buf = {{jmp_buf = {0, 8404711572231051399, 93918125504960, 140731853143296, 0, 0, 2416429254252320903, 2321737910928038023}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x7f2700a82733 <_dl_init+259>, 0x7f2700a44638}, data = {prev = 0x0, cleanup = 0x0, canceltype = 11020083}}}
not_first_call = <optimized out>
#84 0x0000556b048239ea in _start ()
gdb returned 0
Aborted

Also available in: Atom PDF