From: Matti V. <mav...@gm...> - 2023-12-09 10:47:01
|
Maybe the following is helpful: (gdb) bt #0 thrkill () at /tmp/-:2 #1 0xf7a555255abd010d in ?? () #2 0x000000d3e7980c52 in _libc_abort () at /usr/src/lib/libc/stdlib/abort.c:51 #3 0x000000d4b9c3ce70 in uw_init_context_1 ( context=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, context@entry=0x794f944a9560, outer_cfa=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>, outer_cfa@entry=0x794f944a9910, outer_ra=<error reading variable: dwarf2_find_location_expression: Corrupted DWARF expression.>) at /usr/obj/ports/gcc-11.2.0/gcc-11.2.0/libgcc/unwind-pe.h:88 #4 0x000000d4b9c3c5d9 in _Unwind_RaiseException (exc=0xd3f70264c0) at /usr/obj/ports/gcc-11.2.0/gcc-11.2.0/libgcc/unwind.inc:93 #5 0x000000d4b9b25414 in __cxxabiv1::__cxa_throw (obj=<optimized out>, tinfo=0xd3f5aaa770 <typeinfo for Py::ValueError>, dest=0xd3f5a9a6e2 <Py::ValueError::~ValueError()>) at /usr/obj/ports/gcc-11.2.0/gcc-11.2.0/libstdc++-v3/libsupc++/eh_throw.cc:90 #6 0x000000d3f5a9a73d in Py::ValueError::throwFunc () at ./CXX/Python3/cxx_standard_exceptions.hxx:74 #7 0x000000d3f5a98426 in Py::ifPyErrorThrowCxxException () at Src/Python3/cxx_exceptions.cxx:41 #8 0x000000d3f5a80e1c in Py::Callable::apply (this=0x794f944a9a40, args=...) at ./CXX/Python3/Objects.hxx:3241 #9 0x000000d3f5a842c8 in simple_module::func_with_callback (this=0xd45b2ef460, args=...) at Demo/Python3/simple.cxx:351 #10 0x000000d3f5a8b513 in Py::ExtensionModule<simple_module>::invoke_method_keyword ( this=0xd45b2ef460, method_def=0xd410e7b420, args=..., keywords=...) at ./CXX/Python3/ExtensionModule.hxx:192 #11 0x000000d3f5a9524d in Py::method_keyword_call_handler (Python Exception <class 'gdb.error'> There is no member named ob_item.: _self_and_name_tuple=, Python Exception <class 'gdb.error'> There is no member named ob_item.: _args=, _keywords=0x0) at Src/Python3/cxx_extensions.cxx:1695 #12 0x000000d41f076d1c in cfunction_call () from /usr/local/lib/libpython3.10.so.0.0 #13 0x000000d41f01cc75 in _PyObject_MakeTpCall () from /usr/local/lib/libpython3.10.so.0.0 #14 0x000000d41f129e60 in call_function () from /usr/local/lib/libpython3.10.so.0.0 #15 0x000000d41f1206c0 in _PyEval_EvalFrameDefault () from /usr/local/lib/libpython3.10.so.0.0 #16 0x000000d41f11d4e4 in _PyEval_Vector () from /usr/local/lib/libpython3.10.so.0.0 #17 0x000000d41f185527 in run_mod () from /usr/local/lib/libpython3.10.so.0.0 #18 0x000000d41f185e0c in PyRun_InteractiveOneObjectEx () from /usr/local/lib/libpython3.10.so.0.0 #19 0x000000d41f1848be in _PyRun_InteractiveLoopObject () from /usr/local/lib/libpython3.10.so.0.0 #20 0x000000d41f183dfb in _PyRun_AnyFileObject () from /usr/local/lib/libpython3.10.so.0.0 #21 0x000000d41f187d2d in PyRun_AnyFileExFlags () from /usr/local/lib/libpython3.10.so.0.0 #22 0x000000d41f1ac960 in Py_RunMain () from /usr/local/lib/libpython3.10.so.0.0 #23 0x000000d41f1adc33 in pymain_main () from /usr/local/lib/libpython3.10.so.0.0 #24 0x000000d41f1ae02c in Py_BytesMain () from /usr/local/lib/libpython3.10.so.0.0 #25 0x000000d1cd9a4971 in _start () On Sat, Dec 9, 2023 at 2:35 PM Matti Viljamaa <mav...@gm...> wrote: > PYTHONPATH=obj egdb python3 > GNU gdb (GDB) 9.2 > Copyright (C) 2020 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-unknown-openbsd7.4". > 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"... > Reading symbols from python3... > (No debugging symbols found in python3) > (gdb) import simple > Undefined command: "import". Try "help". > (gdb) run > Starting program: /usr/local/bin/python3 > Python 3.10.13 (main, Dec 5 2023, 18:39:12) [Clang 16.0.6 ] on openbsd7 > Type "help", "copyright", "credits" or "license" for more information. > >>> import simple > warning: File "/usr/local/lib/libestdc++.so.20.0-gdb.py" auto-loading has > been declined by your `auto-load safe-path' set to > "/usr/local/share/gdb/auto-load". > To enable execution of this file add > add-auto-load-safe-path /usr/local/lib/libestdc++.so.20.0-gdb.py > line to your configuration file "/root/.gdbinit". > To completely disable this security protection add > set auto-load safe-path / > line to your configuration file "/root/.gdbinit". > For more information about this security protection see the > "Auto-loading safe path" section in the GDB manual. E.g., run from the > shell: > info "(gdb)Auto-loading safe path" > sizeof(int) 4 > sizeof(long) 8 > sizeof(Py_hash_t) 8 > sizeof(Py_ssize_t) 8 > >>> def callback_bad( arg ): > ... raise ValueError( 'callback_bad error' ) > ... > >>> simple.func_with_callback( callback_bad, 'fred' ) > > Program received signal SIGABRT, Aborted. > thrkill () at /tmp/-:2 > 2 /tmp/-: No such file or directory. > (gdb) Quit > (gdb) > > --- > > Now what? > > On Tue, Dec 5, 2023 at 1:46 PM Barry Scott <ba...@ba...> wrote: > >> >> On 29/11/2023 13:02, Matti Viljamaa wrote: >> >> On a closer inspection it seems related to the line: >> >> simple.func_with_callback( callback_bad, 'fred' ) >> >> because replacing that with a direct call: >> >> call_back('fred') >> >> works as expected: >> >> ... >> TEST: call C++ with Python callback_good >> callback_good with 'callback_args string' >> PASS callback_good returned 'good result' >> TEST: call C++ with Python callback_bad >> callback_bad with 'fred' >> PASS callback_bad: error callback_bad error >> TEST: call C++ with Python callback_raise_simple_error >> callback_bad with 'callback_args string' >> Abort trap (core dumped) >> >> Is there some problem with raising exceptions with the >> simple.func_with_callback? >> >> However, I also think there might be a problem with: >> >> TEST: call C++ with Python callback_good >> callback_good with 'callback_args string' >> PASS callback_good returned 'good result' >> >> because I think it shouldn't show 'callback_args string' >> >> On Wed, Nov 29, 2023 at 1:15 PM Matti Viljamaa <mav...@gm...> >> wrote: >> >>> I am attempting to build pycxx-7.1.8 for OpenBSD 7.4-current. >>> >>> I am following the Unix installation guide at: >>> >>> https://cxx.sourceforge.net/ >>> >>> The final line: >>> >>> make -f linux.mak clean test >>> >>> or >>> >>> gmake -f linux.mak clean test >>> >>> in OpenBSD >>> >>> fails to >>> >>> ... >>> TEST: call C++ with Python callback_bad >>> callback_bad with 'callback_args string' >>> Abort trap (core dumped) >>> gmake: *** [linux.mak:86: test] Error 134 >>> >>> Upon inspecting test_simple.py I've noticed that it seems to be linked >>> to raising ValueError, because commenting out line 31: >>> >>> raise ValueError( 'callback_bad error' ) >>> >>> in test_simple.py makes test_simple.py progress to the next test. Now I >>> see: >>> >>> ... >>> TEST: call C++ with Python callback_bad >>> callback_bad with 'callback_args string' >>> FAILED callback_bad None >>> TEST: call C++ with Python callback_raise_simple_error >>> callback_bad with 'callback_args string' >>> Abort trap (core dumped) >>> >>> However, since the Abort traps continue showing, I speculate that this >>> is about something more. Possible reasons: >>> >>> * pycxx-7.1.8 is not compatible with Python 3.10 (or a particular >>> subversion) >>> * something is different in OpenBSD compared to Linux >>> >>> Any ideas? >>> >> This is how to run the failing test on its own to debug it: >> : 11:44:26 worthy ~/Projects/pycxx-trunk >> : [1] barry $ PYTHONPATH=obj gdb python3.10 >> GNU gdb (Fedora Linux) 13.2-11.fc39 >> Copyright (C) 2023 Free Software Foundation, Inc. >> License GPLv3+: GNU GPL version 3 or later >> <http://gnu.org/licenses/gpl.html> <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-redhat-linux-gnu". >> Type "show configuration" for configuration details. >> For bug reporting instructions, please see: >> <https://www.gnu.org/software/gdb/bugs/> >> <https://www.gnu.org/software/gdb/bugs/>. >> Find the GDB manual and other documentation resources online at: >> <http://www.gnu.org/software/gdb/documentation/> >> <http://www.gnu.org/software/gdb/documentation/>. >> >> For help, type "help". >> Type "apropos word" to search for commands related to "word"... >> Reading symbols from python3.10... >> Reading symbols from >> /home/barry/.cache/debuginfod_client/5ba318aef33a2277a4c3e2fef48addf050553288/debuginfo... >> >> (gdb) import >> simple >> >> Undefined command: "import". Try "help". >> (gdb) run >> Starting program: /usr/bin/python3.10 >> [Thread debugging using libthread_db >> enabled] >> >> Using host libthread_db library "/lib64/libthread_db.so.1". >> Python 3.10.13 (main, Aug 28 2023, 00:00:00) [GCC 13.2.1 20230728 (Red >> Hat 13.2.1-1)] on >> linux >> >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import >> simple >> >> sizeof(int) >> 4 >> >> sizeof(long) 8 >> sizeof(Py_hash_t) 8 >> sizeof(Py_ssize_t) 8 >> >>> def callback_bad( arg ): >> ... raise ValueError( 'callback_bad error' ) >> ... >> >>> simple.func_with_callback( callback_bad, 'fred' ) >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> File "<stdin>", line 2, in callback_bad >> ValueError: callback_bad error >> >>> >> >> >> _______________________________________________ >> CXX-Users mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/cxx-users >> >> _______________________________________________ >> CXX-Users mailing list >> CXX...@li... >> https://lists.sourceforge.net/lists/listinfo/cxx-users >> > |