Forum: GNU Radio Using disconnect_all() in C++

Posted by Alexandru Csete (Guest)
on 2013-02-21 23:43
(Received via mailing list)
Hi,

In gqrx I am successfully using disconnect_all() at the top-block
level. Tonight I have tried to use it in a hier_block2 but it doesn't
seem to work.
The relevant code snippet is here:
https://gist.github.com/csete/5008658#file-iq_swap-cpp-L42 - a call to
set_enabled() results in:

terminate called after throwing an instance of 'std::invalid_argument'
  what():  input port 0 out of range for complex_to_float(26)
Aborted (core dumped)

If I disconnect the blocks manually it works fine, which lead me to
believe that disconnect_all() only works at top-block level? Or maybe
a bug?
I'm using gnuradio/master from yesterday: v3.6.3-128-gbbc4da83

Alex
Posted by Johnathan Corgan (Guest)
on 2013-02-21 23:48
(Received via mailing list)
On Thu, Feb 21, 2013 at 2:36 PM, Alexandru Csete <oz9aec@gmail.com> 
wrote:


> terminate called after throwing an instance of 'std::invalid_argument'
>   what():  input port 0 out of range for complex_to_float(26)
> Aborted (core dumped)
>

Can you get a gdb stack traceback on this?

If I disconnect the blocks manually it works fine, which lead me to
> believe that disconnect_all() only works at top-block level? Or maybe
> a bug?
>

It's very likely a bug.

Johnathan
Posted by Alexandru Csete (Guest)
on 2013-02-22 00:03
(Received via mailing list)
On Thu, Feb 21, 2013 at 11:47 PM, Johnathan Corgan
<johnathan@corganlabs.com> wrote:
> On Thu, Feb 21, 2013 at 2:36 PM, Alexandru Csete <oz9aec@gmail.com> wrote:
>
>>
>> terminate called after throwing an instance of 'std::invalid_argument'
>>   what():  input port 0 out of range for complex_to_float(26)
>> Aborted (core dumped)
>
> Can you get a gdb stack traceback on this?

I can do that but I need some instructions.
Do I need to build gnuradio with special flags or just the usual 
cmake/make?

Alex
Posted by Johnathan Corgan (Guest)
on 2013-02-22 00:21
(Received via mailing list)
On Thu, Feb 21, 2013 at 3:02 PM, Alexandru Csete <oz9aec@gmail.com> 
wrote:


> I can do that but I need some instructions.
> Do I need to build gnuradio with special flags or just the usual
> cmake/make?
>

Add -DCMAKE_BUILD_TYPE=DEBUG to your usual cmake command line.

This adds the symbol tables to the generated libraries, so gdb can do 
its
thing.

Johnathan
Posted by Alexandru Csete (Guest)
on 2013-02-22 00:22
(Received via mailing list)
On Fri, Feb 22, 2013 at 12:05 AM, Johnathan Corgan
<johnathan@corganlabs.com> wrote:
> This adds the symbol tables to the generated libraries, so gdb can do its
> thing.

Ok, I'll do that; in gdb then I run strace or backtrace after it 
crashes?

Alex
Posted by Johnathan Corgan (Guest)
on 2013-02-22 00:23
(Received via mailing list)
On Thu, Feb 21, 2013 at 3:08 PM, Alexandru Csete <oz9aec@gmail.com> 
wrote:


> Ok, I'll do that; in gdb then I run strace or backtrace after it crashes?
>

$ gdb gqrx
[...]
(gdb) set args --foo --bar [if needed]
(gdb) run
[...segfault output...]
(gdb) bt
(gdb) info threads

The output from bt and info threads should tell us exactly where it is
faulting.  Actually, that's already known, its an error handler that is
throwing due to bad data, but the stack trace will tell us who was 
calling
it.

Johnathan
Posted by Alexandru Csete (Guest)
on 2013-02-22 00:57
Attachment: trace.log (8,66 KB)
(Received via mailing list)
On Fri, Feb 22, 2013 at 12:14 AM, Johnathan Corgan
<johnathan@corganlabs.com> wrote:
> [...segfault output...]
> (gdb) bt
> (gdb) info threads
>
> The output from bt and info threads should tell us exactly where it is
> faulting.  Actually, that's already known, its an error handler that is
> throwing due to bad data, but the stack trace will tell us who was calling
> it.
>

I have attached the trace - I hope you can see something from it. If
Qt is interfering I can try to create a simpler example.

Alex
Posted by Johnathan Corgan (Guest)
on 2013-02-22 01:12
(Received via mailing list)
On Thu, Feb 21, 2013 at 3:57 PM, Alexandru Csete <oz9aec@gmail.com> 
wrote:


> I have attached the trace - I hope you can see something from it. If
> Qt is interfering I can try to create a simpler example.
>

Can you confirm you are linked against libgnuradio with debugging 
symbols?
There are no stack frames from gnuradio between #5 and #6.  This may 
also
be from running inside the QT event loop, having QT absorb the 
exception,
then rethrowing it.

So if you can get this to happen outside QT and verify the debug 
libraries
are actually linked to, that would help.

Johnathan
Posted by Johnathan Corgan (Guest)
on 2013-02-22 01:23
(Received via mailing list)
On Thu, Feb 21, 2013 at 4:10 PM, Johnathan Corgan
<johnathan@corganlabs.com>wrote:


> So if you can get this to happen outside QT and verify the debug libraries
> are actually linked to, that would help.
>

Sorry, lower in the log it does show GR debug symbols so nevermind on 
that.

Let's take the rest of this off list.

Johnathan
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.