[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Debugging in gnuradio
From: |
frankist |
Subject: |
Re: [Discuss-gnuradio] Debugging in gnuradio |
Date: |
Thu, 5 Apr 2012 02:11:06 -0700 (PDT) |
It seems I found the solution, in spite of not knowing the reason.
I just have to re-assign a new block to each block variable every time I
re-connect them. It seems that connecting and disconnecting the same blocks
several times was the cause for the segmentation fault.
frankist wrote:
>
> Hi,
>
> I am having a hard time with a "segmentation fault" error. I am no expert
> in python (I just started to use it last week) but I find it difficult to
> believe that a segmentation fault error would appear in python code.
> However, I am not using any block made by me.
>
> So this is the part of my code where there is an segmentation fault:
>
> def measure_callback(self,kv):
> print "Measuring!!"
> if self.state==SNR_MEASURE:
> print "Measuring SNR"
> self.lock()
> self.disconnect((self.gr_file_source_0, 0),
> (self.gr_throttle_0,0), self.fft_sink)
> self.connect((self.gr_file_source_0, 0),
> (self.gr_complex_to_mag_squared_0, 0), (self.gr_moving_average_ff_1, 0),
> (self.gr_multiply_const_ff_0, 0), self.pwr_measure)
> self.unlock()
> time.sleep(5)
> snr_val=10*math.log(self.pwr_measure.level())
> print "SNR measured = ", snr_val
> self.lock()
> self.disconnect((self.gr_file_source_0,
> 0),(self.gr_complex_to_mag_squared_0, 0), (self.gr_moving_average_ff_1,
> 0), (self.gr_multiply_const_ff_0, 0), self.pwr_measure)
> self.connect((self.gr_file_source_0, 0),
> self.gr_throttle_0,
> self.fft_sink)
> self.unlock()
>
> So basically I am reading a signal from a file_source and showing its FFT
> on a graphical interface. Then when there is a callback from a button I
> made, this measure_callback(self,kv) is called and I change my circuit to
> measure SNR.
>
> I used some prints and discovered that the "segmentation fault" happens at
> "time.sleep(5)". Lol. Furthermore, the error doesn't happen all the times
> I run this code.
>
> Unfortunately, I don't know any type of debugging programs for gnuradio (I
> don't know if there is one) but it would be very handy because with just a
> "Segmentation Fault" message with no traceback it is difficult to know
> what to do.
>
> So, any suggestion about what might be causing this problem?
>
> Francisco
>
--
View this message in context:
http://old.nabble.com/Debugging-in-gnuradio-tp33557751p33568799.html
Sent from the GnuRadio mailing list archive at Nabble.com.