Segmentation fault (core dump)

Hello,

I have modified gr_constellation_decoder_cb.cc in order to have a second
output stream (type float) sending back min_euclid_dist.

http://www.nabble.com/file/p18313925/gr_constellation_decoder_cb.cc
gr_constellation_decoder_cb.cc

Please take a look and let me know if there are any errors, I am not
sure of
how to code two outputs with different data types.

To update the code after this modification I have done a make and make
install in the directory /usr/src/gnuradio/gnuradio-core/src/lib/general
as
well as in /usr/src/gnuradio/gnuradio-core/src/lib.

I am now permanently receiving “Segmentation fault (core dump)” error
message.

Can somebody help me out ?

Regards,
Irene

View this message in context:
http://www.nabble.com/Segmentation-fault-(core-dump)-tp18313925p18313925.html
Sent from the GnuRadio mailing list archive at Nabble.com.

On Mon, Jul 07, 2008 at 03:38:18AM -0700, irene159 wrote:

Please take a look and let me know if there are any errors, I am not sure of
how to code two outputs with different data types.

Your io_signature allows either 1 or 2 outputs, but the code in work
assumes that there are always two outputs, thus writing indeterminate
memory in the case where only 1 output is hooked up.

foptr is not valid if there’s only one output connected.

You can determine the number of outputs connected using

output_items.size()

Eric

Irene,

I believe the problem is that you are trying to have two different
types of output streams. According to the documentation on
gr_io_signature, it looks like multiple output streams must
all be of the same type. Or at least of types that have the
same size.

In your code, you try to declare an output signature with
two types:

gr_make_io_signature2 (1, 2, sizeof (unsigned char), sizeof (float)))

Apparently, the first one (sizeof(unsigned char)) is getting used
for all outputs, and the second one is being ignored.

Then, later in your “work” method, you setup the output pointers
as “pointer to unsigned char” and “pointer to float”:

unsigned char *out = (unsigned char *) output_items[0];
float *foptr = (float *) output_items[1];

But since what you are being handed is a “pointer to unsigned char”
for both, the successive values of foptr will overwrite each other,
and the ones towards the end of the array will overrun the buffer
entirely.

Your segmentation fault is likely caused by either the buffer overrun,
or trying to write a float to an odd or non-aligned address.

@(^.^)@ Ed

Arrrgh! Apologies to all. I totally missed the all-important “2”
at the end of Irene’s gr_make_io_signature2 call. Please ignore my
previous post.

@(^.^)@ Ed

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs