discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] Understanding GNU Radio Debugging


From: Sumit Kumar
Subject: [Discuss-gnuradio] Understanding GNU Radio Debugging
Date: Thu, 16 Nov 2017 11:58:15 +0100

(My comments are unbold, system commands and prints are bold)

Hi, 

I followed tutorials below: 

https://wiki.gnuradio.org/index.php/TutorialsGDB 
https://wiki.gnuradio.org/index.php/TutorialsDebugging

I made a dummy block. I am learning to debug GR apps. I put the following inside my work function

std::cout << "Hello" << std::endl; 
GR_LOG_DEBUG(d_logger, "\n");
GR_LOG_DEBUG(d_logger, boost::format("Hello Debugger") );

And I expect them to be printed while the program runs. However I never see them printed at all :-/ Then I thought to use gdb and see whats happening. 

Here is what I did: 
First I did cmake using the following : 

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_GR_LOG=On -DCMAKE_INSTALL_PREFIX=../ ../

Its says me following. I wanted logging actually but looks like it ignored me. 

CMake Warning:
  Manually-specified variables were not used by the project:

    ENABLE_GR_LOG

Is this OK ? 

Well I went ahead and compiled. Make test was also successful. 

Now I created a grc file using my own block and in the top_block.py, I did the following at the bottom:

if __name__ == '__main__':
    print 'Blocked waiting for GDB attach (pid = %d)' % (os.getpid(),)
    raw_input ('Press Enter to continue: ')
    main()

Upon running it, I got pid and attached my gdb to that. Hit enter and I got following

address@hidden:~/radio/default/src/gr-ieee-80211/build$ sudo gdb -p 6160
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 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-linux-gnu".
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".
Attaching to process 6160
[New LWP 6161]
[New LWP 6162]
[New LWP 6163]
[New LWP 6164]
[New LWP 6165]
[New LWP 6166]
[New LWP 6167]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007f654851624d in read () at ../sysdeps/unix/syscall-template.S:84
84 ../sysdeps/unix/syscall-template.S: No such file or directory.

Is this normal ? I searched on google but couldn't understand properly. 

Well I kept going ahead and made a break point on my work function.

b gr::ieee802_11::test_cf_impl::work(int, std::vector<void const*, std::allocator<void const*> >&, std::vector<void*, std::allocator<void*> >&) 

Then I continued in gdb, program started running correctly but never saw my outputs printed. Even I made break point where the print statements are there, dint work :( 

Breakpoint 1 at 0x7f65146cc2f0: file /home/john/radio/default/src/gr-ieee-80211/lib/test_cf_impl.cc, line 63.
(gdb) c
Continuing.
[New Thread 0x7f650de3b700 (LWP 6300)]
[New Thread 0x7f650d63a700 (LWP 6301)]
[New Thread 0x7f650ce39700 (LWP 6302)]
[New Thread 0x7f64fc83b700 (LWP 6303)]
[New Thread 0x7f64fc03a700 (LWP 6304)]
[New Thread 0x7f64fb308700 (LWP 6306)]
[New Thread 0x7f64fab07700 (LWP 6307)]
[New Thread 0x7f64fa306700 (LWP 6308)]
[New Thread 0x7f64f9b05700 (LWP 6309)]
[New Thread 0x7f64f9304700 (LWP 6310)]
[Switching to Thread 0x7f64fab07700 (LWP 6307)]

Thread 15 "test_cf3" hit Breakpoint 1, gr::ieee802_11::test_cf_impl::work (this=0x2023650, noutput_items=8184, 
    input_items=std::vector of length 1, capacity 1 = {...}, 
    output_items=std::vector of length 1, capacity 1 = {...})
    at /home/john/radio/default/src/gr-ieee-80211/lib/test_cf_impl.cc:63
warning: Source file is more recent than executable.
63     {
(gdb) n
[Thread 0x7f64fc03a700 (LWP 6304) exited]
68       volk_32fc_magnitude_squared_32f(out, in, noi);
(gdb) n
63     {

What obvious mistake I am doing ? Isn't this the right way to use GR_LOG_DEBUGGER

I was also not able to see the print outputs during my make test. 

reply via email to

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