Boost C++ Libraries: Ticket #2555: SIGTRAP received while calling a wrapped function with "" https://svn.boost.org/trac10/ticket/2555 <p> We have a function that takes a std::string in parameter, and we wrap it using Boost.Python: </p> <p> void foo(string s) { </p> <blockquote> <p> cout &lt;&lt; "foo" &lt;&lt; endl; </p> </blockquote> <p> } </p> <p> BOOST_PYTHON_MODULE(mymodule) { </p> <blockquote> <p> def("foo", &amp;foo); </p> </blockquote> <p> } </p> <p> When we call it under gdb, we receive a SIGTRAP signal (see attachment). Note that the problem disappears if the std::string is replaced by a const char* or if we pass a non-empty literal string. Also, it only appears under gdb, a normal run won't make the program crash. </p> <p> Here are the different platforms tested: </p> <ul><li>win32 - python2.2.3 - gcc3.4.5 - boost1.35 - gdb6.8 : KO </li><li>win32 - python2.5.2 - gcc3.4.5 - boost1.35 - gdb6.8 : KO </li><li>win32 - python2.5.2 - gcc3.4.5 - boost1.36 - gdb6.8 : KO </li><li>win32 - python2.5.2 - gcc4.2.1-sjlj - boost1.36 - gdb6.8 : KO </li><li>redhat 7.2 - python2.4. - gcc3.3.6 - boost1.35 - gdb5.0 : OK </li><li>ubuntu 8.10 - python2.5.2 - gcc4.3.2 - boost1.35 - gdb6.8: OK </li></ul><p> So the problem seems to be reproducible only with win32. </p> <p> Bruno </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2555 Trac 1.4.3 bruno dot lalande at gmail dot com Mon, 01 Dec 2008 16:02:35 GMT attachment set https://svn.boost.org/trac10/ticket/2555 https://svn.boost.org/trac10/ticket/2555 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">readme.txt</span> </li> </ul> Ticket Dave Abrahams Mon, 01 Dec 2008 16:41:41 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/2555#comment:1 https://svn.boost.org/trac10/ticket/2555#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> There isn't nearly enough information here to verify that this is a Boost.Python problem, as opposed to a gdb problem, or, for example, a problem on your end with linking incompatible libraries. I can't even see any Boost.Python symbols in your stack backtrace. </p> <p> Given how reliable Boost.Python has been in the past, and how stable it's been recently (almost no changes to the codebase), the most appropriate action seems to me to be to close the ticket. If you find more information that points at Boost.Python, please feel free to reopen the ticket. </p> Ticket bruno dot lalande at gmail dot com Tue, 02 Dec 2008 13:59:53 GMT attachment set https://svn.boost.org/trac10/ticket/2555 https://svn.boost.org/trac10/ticket/2555 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">trace.txt</span> </li> </ul> Ticket anonymous Tue, 02 Dec 2008 14:05:50 GMT <link>https://svn.boost.org/trac10/ticket/2555#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2555#comment:2</guid> <description> <p> Indeed, those informations were missing, sorry for that. </p> <p> Here is where the different things come from: </p> <ul><li>python is the precompiled official package </li><li>gcc and gdb are the precompiled packages provided by the mingw project </li><li>boost has been built using: bjam -g --v2 --toolset=gcc --mno-cygwin --with-python python-debugging=on variant=debug threading=single link=shared </li><li>bjam is the 3.1.16 precompiled binary provided by Boost </li><li>the mymodule module has been compiled using: g++ -Wall -O0 -DBUILD_DLL -g -DBOOST_DEBUG_PYTHON -IC:\Python22\include -LC:\Python22\libs (+ the -I and -L options to our compiled Boost.Python) </li></ul><p> You will find in the new attachment a trace that shows some Boost.Python debug informations. We begin by placing a pending breakpoint on foo, then we import mymodule. We first call the foo() function with a non-empty string, which works well. Then we do the same but with an empty string, which results in a SIGTRAP raised while we are in python/detail/caller.hpp:225. </p> <p> We know the stability of Boost.Python, that we heavily use. The point is that this problem can occur under this form only in gdb, as "SIGTRAP is the signal thrown by computer programs when a condition arises that a debugger has requested to be informed of" (according to wikipedia). So it won't arise in a normal run, but the potential problem it shows can have another consequence later. That's why we thought it could be useful to report it here. This being said, it's very difficult to make sure it's not a gdb bug. We are open to any suggestion of test that could be done to clarify things. </p> <p> Bruno </p> </description> <category>Ticket</category> </item> <item> <author>Bruno Lalande <bruno.lalande@…></author> <pubDate>Fri, 05 Dec 2008 09:15:53 GMT</pubDate> <title>status changed; resolution deleted https://svn.boost.org/trac10/ticket/2555#comment:3 https://svn.boost.org/trac10/ticket/2555#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">invalid</span> </li> </ul> Ticket Dave Abrahams Tue, 23 Dec 2008 09:20:15 GMT <link>https://svn.boost.org/trac10/ticket/2555#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2555#comment:4</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/2555#comment:2" title="Comment 2">anonymous</a>: </p> <blockquote class="citation"> <p> Indeed, those informations were missing, sorry for that. </p> <p> Here is where the different things come from: </p> <ul><li>python is the precompiled official package </li><li>gcc and gdb are the precompiled packages provided by the mingw project </li><li>boost has been built using: bjam -g --v2 --toolset=gcc --mno-cygwin --with-python python-debugging=on variant=debug threading=single link=shared </li></ul></blockquote> <p> Are you aware that, as documented at <a href="http://www.boost.org/doc/libs/1_37_0/libs/python/doc/building.html#id40">http://www.boost.org/doc/libs/1_37_0/libs/python/doc/building.html#id40</a>, Python doesn't ship a python debugging build by default? This looks, as I suggested, like a problem on your end with linking incompatible libraries. </p> </description> <category>Ticket</category> </item> </channel> </rss>