Compile with gcc -g to get the debug info ( this will give you line numbers in gdb)<br><br>and valgrind is another program, not a gdb command :)<br><br><br><br><div class="gmail_quote">On Wed, May 6, 2009 at 11:09 PM, Guilherme <span dir="ltr"><<a href="mailto:grlongo.ireland@gmail.com">grlongo.ireland@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Antoine, I have the whole profile of the problem now.<br>
Plz, if you could give me a help with that.<br>
<div class="im"><br>
(gdb) run<br>
Starting program: /home/guilherme/EBA<br>
[Thread debugging using libthread_db enabled]<br>
</div>[New Thread 0xb7ad09b0 (LWP 3585)]<br>
<div class="im"><br>
Program received signal SIGSEGV, Segmentation fault.<br>
</div>[Switching to Thread 0xb7ad09b0 (LWP 3585)]<br>
0xb7e9e582 in g_type_check_instance_cast () from<br>
/usr/lib/libgobject-2.0.so.0<br>
(gdb) backtrace<br>
#0 0xb7e9e582 in g_type_check_instance_cast () from<br>
/usr/lib/libgobject-2.0.so.0<br>
#1 0x08048a5b in main ()<br>
(gdb) valgrind<br>
Undefined command: "valgrind". Try "help".<br>
(gdb) bt<br>
#0 0xb7e9e582 in g_type_check_instance_cast () from<br>
/usr/lib/libgobject-2.0.so.0<br>
#1 0x08048a5b in main ()<br>
(gdb)<br>
<br>
<br>
And my code:<br>
<div class="im"><br>
#include<gst/gst.h><br>
#include<glib.h><br>
#include<gst/fft/gstffts16.h><br>
<br>
static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data);<br>
<br>
int main(int argc, char *argv[])<br>
{<br>
GMainLoop *loop;<br>
<br>
GstElement *pipeline, *source, *filesink;<br>
GstBus *bus;<br>
</div> GstFFTS16 *fft;<br>
<br>
gint16 td;<br>
gint16 *timedata = &td;<br>
<br>
gint16 bufferin;<br>
gint16 *in = &bufferin;<br>
<br>
GstFFTS16Complex fq;<br>
GstFFTS16Complex *freq = &fq;<br>
<br>
<br>
/*const gint16 *in;*/<br>
<div class="im"> /*GstFFTS16Complex *freq;*/<br>
<br>
<br>
gst_init(&argc, &argv);<br>
<br>
loop = g_main_loop_new (NULL, FALSE);<br>
<br>
/*creating elements*/<br>
pipeline = gst_pipeline_new ("audio-player");<br>
source = gst_element_factory_make ("audiotestsrc",<br>
"file-source");<br>
</div><div class="im"> fft = gst_fft_s16_new (128, FALSE);<br>
filesink = gst_element_factory_make ("alsasink",<br>
"audio-output");<br>
<br>
<br>
<br>
</div> if (!pipeline || !source || !fft || !filesink) {<br>
<div class="im"> g_printerr ("One element could not be created. Exiting.\n");<br>
return -1;<br>
}<br>
<br>
/*set-up the pipeline*/<br>
<br>
</div> /*set up fft transform*/<br>
/*gst_fft_s16_window(fft, timedata, GST_FFT_WINDOW_RECTANGULAR);*/<br>
<div class="im"> gst_fft_s16_fft (fft, in, freq);<br>
<br>
<br>
/*message handler*/<br>
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));<br>
gst_bus_add_watch (bus, bus_call, loop);<br>
gst_object_unref (bus);<br>
<br>
/*colocar todos elementos na pipeline*/<br>
gst_bin_add_many (GST_BIN (pipeline), source, filesink, NULL);<br>
<br>
/*Linkar elementos*/<br>
/*Cria o link entre os pads dos elementos*/<br>
gst_element_link_many (source, filesink, NULL);<br>
<br>
<br>
/* set pipeline playing status */<br>
gst_element_set_state (pipeline, GST_STATE_PLAYING);<br>
g_print ("Running...\n");<br>
<br>
/*iterate*/<br>
g_main_loop_run (loop);<br>
g_print ("Recording\n");<br>
<br>
/* Out of the main loop, clean up nicely */<br>
g_print ("Returned, stopping playback\n");<br>
gst_element_set_state (pipeline, GST_STATE_NULL);<br>
<br>
g_print ("Deleting pipeline\n");<br>
gst_object_unref (GST_OBJECT (pipeline));<br>
<br>
return 0;<br>
}<br>
<br>
static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data) {<br>
<br>
return TRUE;<br>
}<br>
<br>
<br>
<br>
<br>
<br>
</div>Can't really figure out what is gong on!<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
Tks!<br>
<br>
-------------------<br>
<br>
Guilherme Longo<br>
Dept. Eng. da Computação<br>
Unaerp<br>
<br>
Linux User - #484927<br>
<br>
*Before Asking<br>
<a href="http://www.istf.com.br/?page=perguntas" target="_blank">http://www.istf.com.br/?page=perguntas</a><br>
<br>
!- I'd rather die on my feet than live on my knees -!<br>
<div class="im"><br>
<br>
<br>
Antoine Tremblay wrote:<br>
> Did you try a backtrace ?<br>
><br>
> Type bt <enter> in gdb ..<br>
><br>
> It will show you the backtrace of the sigsegv and thus the line that<br>
> failed...<br>
><br>
> If not you can always try valgrind ...<br>
><br>
><br>
> On Wed, May 6, 2009 at 7:59 PM, Guilherme <<a href="mailto:grlongo.ireland@gmail.com">grlongo.ireland@gmail.com</a><br>
</div><div><div></div><div class="h5">> <mailto:<a href="mailto:grlongo.ireland@gmail.com">grlongo.ireland@gmail.com</a>>> wrote:<br>
><br>
> Hi all.<br>
><br>
> I finished building my code and it's compiled without any error, but<br>
> when I run it I get the beautiful segmentation fault.<br>
><br>
> No good.<br>
><br>
> Running gdb I can't get the line of the problem, instead I have this:<br>
><br>
> (gdb) run<br>
> Starting program: /home/guilherme/EBA<br>
> [Thread debugging using libthread_db enabled]<br>
> [New Thread 0xb7a479b0 (LWP 5565)]<br>
><br>
> Program received signal SIGSEGV, Segmentation fault.<br>
> [Switching to Thread 0xb7a479b0 (LWP 5565)]<br>
> 0xb7bf2234 in ?? () from /usr/lib/libgstfft-0.10.so.0<br>
><br>
> Is this a normal debug or I'm doing smth wrong?<br>
> It seen a problem with my fft implementation. That is the code:<br>
><br>
><br>
> #include<gst/gst.h><br>
><br>
><br>
> #include<glib.h><br>
><br>
><br>
> #include<gst/fft/gstffts16.h><br>
><br>
><br>
><br>
> static gboolean bus_call(GstBus *bus, GstMessage *msg,<br>
> gpointer data);<br>
><br>
><br>
><br>
> int main(int argc, char *argv[])<br>
><br>
><br>
> {<br>
><br>
><br>
> GMainLoop *loop;<br>
><br>
><br>
><br>
><br>
><br>
> GstElement *pipeline, *source, *filesink;<br>
><br>
><br>
> GstBus *bus;<br>
><br>
><br>
> GstBuffer *buffer;<br>
><br>
><br>
> GstFFTS16 *fft;<br>
><br>
><br>
><br>
><br>
><br>
> const gint16 *in;<br>
><br>
><br>
> GstFFTS16Complex *freq;<br>
><br>
><br>
><br>
><br>
><br>
> gst_init(&argc, &argv);<br>
><br>
><br>
><br>
><br>
><br>
> loop = g_main_loop_new (NULL, FALSE);<br>
><br>
><br>
><br>
><br>
><br>
> /*creating elements*/<br>
><br>
><br>
> pipeline = gst_pipeline_new<br>
> ("audio-player");<br>
><br>
><br>
> source = gst_element_factory_make<br>
> ("audiotestsrc",<br>
> "file-source");<br>
><br>
><br>
> filesink = gst_element_factory_make ("alsasink",<br>
> "audio-output");<br>
><br>
><br>
> fft = gst_fft_s16_new (128, FALSE);<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> if (!pipeline || !source || !filesink) {<br>
><br>
><br>
> g_printerr ("One element could not be created.<br>
> Exiting.\n");<br>
><br>
><br>
> return -1;<br>
><br>
><br>
> }<br>
><br>
><br>
><br>
><br>
><br>
> /*set-up the pipeline*/<br>
><br>
><br>
><br>
><br>
><br>
> /*create and set up buffer*/<br>
><br>
><br>
> g_print ("\n\nCreating Buffer\n");<br>
><br>
><br>
> buffer = gst_buffer_new();<br>
><br>
><br>
> if(!buffer)<br>
><br>
><br>
> g_printerr ("buffer could not be created\n");<br>
><br>
><br>
> else<br>
><br>
><br>
> g_print ("Buffer Created\n\n");<br>
><br>
><br>
><br>
><br>
><br>
> /*set up fft transform*/<br>
><br>
><br>
> gst_fft_s16_fft (fft, in, freq);<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> /*message handler*/<br>
><br>
><br>
> bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));<br>
><br>
><br>
> gst_bus_add_watch (bus, bus_call, loop);<br>
><br>
><br>
> gst_object_unref (bus);<br>
><br>
><br>
><br>
><br>
><br>
> /*colocar todos elementos na pipeline*/<br>
><br>
><br>
> gst_bin_add_many (GST_BIN (pipeline), source,<br>
> filesink, NULL);<br>
><br>
><br>
><br>
><br>
><br>
> /*Linkar elementos*/<br>
><br>
><br>
> /*Cria o link entre os pads dos elementos*/<br>
><br>
><br>
> gst_element_link_many (source, filesink, NULL);<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> /* set pipeline playing status */<br>
><br>
><br>
> gst_element_set_state (pipeline, GST_STATE_PLAYING);<br>
><br>
><br>
> g_print ("Running...\n");<br>
><br>
><br>
><br>
><br>
><br>
> /*iterate*/<br>
><br>
><br>
> g_main_loop_run (loop);<br>
><br>
><br>
> g_print ("Recording\n");<br>
><br>
><br>
><br>
><br>
><br>
> /* Out of the main loop, clean up nicely */<br>
><br>
><br>
> g_print ("Returned, stopping playback\n");<br>
><br>
><br>
> gst_element_set_state (pipeline, GST_STATE_NULL);<br>
><br>
><br>
><br>
> g_print ("Deleting pipeline\n");<br>
><br>
><br>
> gst_object_unref (GST_OBJECT (pipeline));<br>
><br>
><br>
><br>
> return 0;<br>
><br>
><br>
> }<br>
><br>
><br>
><br>
> static gboolean bus_call(GstBus *bus, GstMessage *msg,<br>
> gpointer data) {<br>
><br>
><br>
><br>
> return TRUE;<br>
><br>
><br>
> }<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> ------------------------------------------------------------------------------<br>
> The NEW KODAK i700 Series Scanners deliver under ANY<br>
> circumstances! Your<br>
> production scanning environment may not be a perfect world - but<br>
> thanks to<br>
> Kodak, there's a perfect scanner to get the job done! With the NEW<br>
> KODAK i700<br>
> Series Scanner you'll get full speed at 300 dpi even with all image<br>
> processing features enabled. <a href="http://p.sf.net/sfu/kodak-com" target="_blank">http://p.sf.net/sfu/kodak-com</a><br>
> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
</div></div>> <mailto:<a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a>><br>
<div class="im">> <a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
><br>
><br>
</div>> ------------------------------------------------------------------------<br>
<div><div></div><div class="h5">><br>
> ------------------------------------------------------------------------------<br>
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your<br>
> production scanning environment may not be a perfect world - but thanks to<br>
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700<br>
> Series Scanner you'll get full speed at 300 dpi even with all image<br>
> processing features enabled. <a href="http://p.sf.net/sfu/kodak-com" target="_blank">http://p.sf.net/sfu/kodak-com</a><br>
> ------------------------------------------------------------------------<br>
><br>
> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
> <a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
><br>
<br>
------------------------------------------------------------------------------<br>
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your<br>
production scanning environment may not be a perfect world - but thanks to<br>
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700<br>
Series Scanner you'll get full speed at 300 dpi even with all image<br>
processing features enabled. <a href="http://p.sf.net/sfu/kodak-com" target="_blank">http://p.sf.net/sfu/kodak-com</a><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
</div></div></blockquote></div><br>