discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] trellis_encoder_bb segfaults when inside hier_block


From: Martin Braun
Subject: [Discuss-gnuradio] trellis_encoder_bb segfaults when inside hier_block
Date: Mon, 2 Aug 2010 14:54:48 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

Hi,

I've been playing around with the gr-trellis stuff, mainly to figure out
how it works. My first step was to build a conv. coder/decoder.
When I figured out how that works, I wanted to pack everything into a
hierarchical block which handles all the configuration of the FSM etc.
However, it seems that trellis_encoder_bb (which I was using) does not
like to live inside a hier_block: Upon destruction of the hier_block, it
always segfaults. I don't get this behaviour with other blocks.

Here's the guts of my code:

chancoding_industrystd_encoder_bb::chancoding_industrystd_encoder_bb ()
  : gr_hier_block2 ("industrystd_encoder_bb",
    gr_make_io_signature (1, 1, sizeof(char)),
    gr_make_io_signature (1, 1, sizeof(char)))
{
  trellis_encoder_bb_sptr encoder = 
trellis_encoder_bb_sptrllis_make_encoder_bb(fsm(1, 2, make_G()), 0);
  connect(self(), 0, encoder, 0);
  connect(encoder, 0, self(), 0);
}

There's nothing else in the hier_block. I've also tried making the
encoder an attribute of my class, to no avail.

This simple test case is enough to create a segfault:

void
qa_industrystd_bb::t1()
{
  chancoding_industrystd_encoder_bb_sptr 
encoder(chancoding_make_industrystd_encoder_bb());
}

The segfault is thrown whenever everything is destroyed (not, however,
during execution of the destructor). For the C++ QA test code above, the
segfaults occurs right at the end, i.e. after test_all finishes.
When I try it through SWIG, it also segfaults, but I haven't exactly
pinpointed where.

Here's a backtrace of a segfault as seen from gdb:

Program received signal SIGSEGV, Segmentation fault.
0x00a1f532 in main_arena () from /lib/tls/i686/cmov/libc.so.6
(gdb) bt
#0  0x00a1f532 in main_arena () from /lib/tls/i686/cmov/libc.so.6
#1  0x0038c2e8 in checked_delete<gr_hier_block2> (this=0x8050570) at 
/usr/include/boost/checked_delete.hpp:34
#2  boost::detail::sp_counted_impl_p<gr_hier_block2>::dispose (this=0x8050570) 
at /usr/include/boost/detail/sp_counted_impl.hpp:78
#3  0x0038c3c5 in boost::detail::sp_counted_base::release (this=0x3fcc4c, 
__x=0x8050588) at /usr/include/boost/detail/sp_counted_base_gcc_x86.hpp:145
#4  ~shared_count (this=0x3fcc4c, __x=0x8050588) at 
/usr/include/boost/detail/shared_count.hpp:216
#5  ~shared_ptr (this=0x3fcc4c, __x=0x8050588) at 
/usr/include/boost/shared_ptr.hpp:165
#6  ~pair (this=0x3fcc4c, __x=0x8050588) at 
/usr/include/c++/4.4/bits/stl_pair.h:68
#7  __gnu_cxx::new_allocator<std::pair<gr_basic_block* const, 
boost::shared_ptr<gr_basic_block> > >::destroy (this=0x3fcc4c, __x=0x8050588)
    at /usr/include/c++/4.4/ext/new_allocator.h:115
#8  std::_Rb_tree<gr_basic_block*, std::pair<gr_basic_block* const, 
boost::shared_ptr<gr_basic_block> >, std::_Select1st<std::pair<gr_basic_block* 
const, boost::shared_ptr<gr_basic_block> > >, std::less<gr_basic_block*>, 
std::allocator<std::pair<gr_basic_block* const, 
boost::shared_ptr<gr_basic_block> > > >::_M_destroy_node (this=0x3fcc4c, 
__x=0x8050588)
    at /usr/include/c++/4.4/bits/stl_tree.h:383
#9  std::_Rb_tree<gr_basic_block*, std::pair<gr_basic_block* const, 
boost::shared_ptr<gr_basic_block> >, std::_Select1st<std::pair<gr_basic_block* 
const, boost::shared_ptr<gr_basic_block> > >, std::less<gr_basic_block*>, 
std::allocator<std::pair<gr_basic_block* const, 
boost::shared_ptr<gr_basic_block> > > >::_M_erase (this=0x3fcc4c, __x=0x8050588)
    at /usr/include/c++/4.4/bits/stl_tree.h:972
#10 0x0038c424 in ~_Rb_tree (this=0x3fcc4c, __in_chrg=<value optimised out>) at 
/usr/include/c++/4.4/bits/stl_tree.h:614
#11 ~map (this=0x3fcc4c, __in_chrg=<value optimised out>) at 
/usr/include/c++/4.4/bits/stl_map.h:87
#12 0x0090c428 in __cxa_finalize (d=0x3fc260) at cxa_finalize.c:56
#13 0x00293ae4 in __do_global_dtors_aux () from 
/usr/local/lib/libgnuradio-core-3.3.1git.so.0
#14 0x00399450 in _fini () from /usr/local/lib/libgnuradio-core-3.3.1git.so.0
#15 0x0011df46 in _dl_fini () at dl-fini.c:248
#16 0x0090c05f in __run_exit_handlers (status=0, listp=0xa1e304, 
run_list_atexit=true) at exit.c:78
#17 0x0090c0cf in *__GI_exit (status=0) at exit.c:100
#18 0x008f3b5e in __libc_start_main (main=0x8049d10 <main>, argc=1, 
ubp_av=0xbfffee54, init=0x804ab20 <__libc_csu_init>, fini=0x804ab10 
<__libc_csu_fini>,
    rtld_fini=0x11dd20 <_dl_fini>, stack_end=0xbfffee4c) at libc-start.c:252
#19 0x08049c71 in _start () at ../sysdeps/i386/elf/start.S:119


Does anyone have an idea why this happens? Is this a user-generated
error, or is it a bug? I was using the latest trunk for this stuff.

Any help is highly appreciated,
Martin

-- 
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin Braun
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-3790
Fax: +49 721 608-6071
www.cel.kit.edu

KIT -- University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association

Attachment: pgppmHeQCHTsT.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]