[gst-devel] Gdb - help with debbug

Guilherme grlongo.ireland at gmail.com
Thu May 7 05:09:50 CEST 2009


Antoine, I have the whole profile of the problem now.
Plz, if you could give me a help with that.

(gdb) run
Starting program: /home/guilherme/EBA
[Thread debugging using libthread_db enabled]
[New Thread 0xb7ad09b0 (LWP 3585)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7ad09b0 (LWP 3585)]
0xb7e9e582 in g_type_check_instance_cast () from 
/usr/lib/libgobject-2.0.so.0
(gdb) backtrace
#0  0xb7e9e582 in g_type_check_instance_cast () from 
/usr/lib/libgobject-2.0.so.0
#1  0x08048a5b in main ()
(gdb) valgrind
Undefined command: "valgrind".  Try "help".
(gdb) bt
#0  0xb7e9e582 in g_type_check_instance_cast () from 
/usr/lib/libgobject-2.0.so.0
#1  0x08048a5b in main ()
(gdb)


And my code:

#include<gst/gst.h>
#include<glib.h>
#include<gst/fft/gstffts16.h>

static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data);

int main(int argc, char *argv[])
{
    GMainLoop *loop;
   
    GstElement *pipeline, *source, *filesink;
    GstBus *bus;
    GstFFTS16 *fft;
 
      gint16 td;
    gint16 *timedata = &td;
   
    gint16 bufferin;
    gint16 *in = &bufferin;
       
    GstFFTS16Complex fq;
    GstFFTS16Complex *freq = &fq;
   
       
    /*const gint16 *in;*/
    /*GstFFTS16Complex *freq;*/
     
   
    gst_init(&argc, &argv);
   
    loop = g_main_loop_new (NULL, FALSE);
   
    /*creating elements*/
    pipeline      = gst_pipeline_new          ("audio-player");
    source        = gst_element_factory_make  ("audiotestsrc", 
"file-source");
    fft           = gst_fft_s16_new           (128, FALSE);
    filesink      = gst_element_factory_make  ("alsasink",     
"audio-output");
   
   
   
    if (!pipeline || !source || !fft || !filesink) {
        g_printerr ("One element could not be created. Exiting.\n");
        return -1;
    }
   
    /*set-up the pipeline*/
   
    /*set up fft transform*/
    /*gst_fft_s16_window(fft, timedata, GST_FFT_WINDOW_RECTANGULAR);*/
    gst_fft_s16_fft (fft, in, freq);
   

    /*message handler*/
    bus =  gst_pipeline_get_bus (GST_PIPELINE (pipeline));
    gst_bus_add_watch (bus, bus_call, loop);   
    gst_object_unref (bus);
   
    /*colocar todos elementos na pipeline*/
    gst_bin_add_many (GST_BIN (pipeline), source, filesink, NULL);
                           
    /*Linkar elementos*/
    /*Cria o link entre os pads dos elementos*/
    gst_element_link_many (source, filesink, NULL);
 
   
    /* set pipeline playing status */
    gst_element_set_state (pipeline, GST_STATE_PLAYING);
    g_print ("Running...\n");
   
    /*iterate*/   
    g_main_loop_run (loop);
    g_print ("Recording\n");
   
    /* Out of the main loop, clean up nicely */
   g_print ("Returned, stopping playback\n");
   gst_element_set_state (pipeline, GST_STATE_NULL);

   g_print ("Deleting pipeline\n");
   gst_object_unref (GST_OBJECT (pipeline));

  return 0;
}

static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data) {

    return TRUE;
}





Can't really figure out what is gong on!















Tks!

-------------------

Guilherme Longo
Dept. Eng. da Computação
Unaerp

Linux User - #484927

*Before Asking
http://www.istf.com.br/?page=perguntas

!- I'd rather die on my feet than live on my knees -!



Antoine Tremblay wrote:
> Did you try a backtrace ?
>
> Type bt <enter> in gdb ..
>
> It will show you the backtrace of the sigsegv and thus the line that 
> failed...
>
> If not you can always try valgrind ...
>
>
> On Wed, May 6, 2009 at 7:59 PM, Guilherme <grlongo.ireland at gmail.com 
> <mailto:grlongo.ireland at gmail.com>> wrote:
>
>     Hi all.
>
>     I finished building my code and it's compiled without any error, but
>     when I run it I get the beautiful segmentation fault.
>
>     No good.
>
>     Running gdb I can't get the line of the problem, instead I have this:
>
>     (gdb) run
>     Starting program: /home/guilherme/EBA
>     [Thread debugging using libthread_db enabled]
>     [New Thread 0xb7a479b0 (LWP 5565)]
>
>     Program received signal SIGSEGV, Segmentation fault.
>     [Switching to Thread 0xb7a479b0 (LWP 5565)]
>     0xb7bf2234 in ?? () from /usr/lib/libgstfft-0.10.so.0
>
>     Is this a normal debug or I'm doing smth wrong?
>     It seen a problem with my fft implementation. That is the code:
>
>
>              #include<gst/gst.h>
>
>
>              #include<glib.h>
>
>
>              #include<gst/fft/gstffts16.h>
>
>
>
>              static gboolean bus_call(GstBus *bus, GstMessage *msg,
>              gpointer data);
>
>
>
>              int main(int argc, char *argv[])
>
>
>              {
>
>
>                  GMainLoop *loop;
>
>
>
>
>
>                  GstElement *pipeline, *source, *filesink;
>
>
>                  GstBus *bus;
>
>
>                  GstBuffer *buffer;
>
>
>                  GstFFTS16 *fft;
>
>
>
>
>
>                  const gint16 *in;
>
>
>                  GstFFTS16Complex *freq;
>
>
>
>
>
>                  gst_init(&argc, &argv);
>
>
>
>
>
>                  loop = g_main_loop_new (NULL, FALSE);
>
>
>
>
>
>                  /*creating elements*/
>
>
>                  pipeline      = gst_pipeline_new        
>      ("audio-player");
>
>
>                  source        = gst_element_factory_make
>      ("audiotestsrc",
>              "file-source");
>
>
>                  filesink      = gst_element_factory_make  ("alsasink",
>              "audio-output");
>
>
>                  fft           = gst_fft_s16_new           (128, FALSE);
>
>
>
>
>
>
>
>
>                  if (!pipeline || !source || !filesink) {
>
>
>                      g_printerr ("One element could not be created.
>              Exiting.\n");
>
>
>                      return -1;
>
>
>                  }
>
>
>
>
>
>                  /*set-up the pipeline*/
>
>
>
>
>
>                  /*create and set up buffer*/
>
>
>                  g_print ("\n\nCreating Buffer\n");
>
>
>                  buffer = gst_buffer_new();
>
>
>                  if(!buffer)
>
>
>                      g_printerr ("buffer could not be created\n");
>
>
>                  else
>
>
>                      g_print ("Buffer Created\n\n");
>
>
>
>
>
>                  /*set up fft transform*/
>
>
>                  gst_fft_s16_fft (fft, in, freq);
>
>
>
>
>
>
>
>
>
>                  /*message handler*/
>
>
>                  bus =  gst_pipeline_get_bus (GST_PIPELINE (pipeline));
>
>
>                  gst_bus_add_watch (bus, bus_call, loop);
>
>
>                  gst_object_unref (bus);
>
>
>
>
>
>                  /*colocar todos elementos na pipeline*/
>
>
>                  gst_bin_add_many (GST_BIN (pipeline), source,
>     filesink, NULL);
>
>
>
>
>
>                  /*Linkar elementos*/
>
>
>                  /*Cria o link entre os pads dos elementos*/
>
>
>                  gst_element_link_many (source, filesink, NULL);
>
>
>
>
>
>
>
>
>                  /* set pipeline playing status */
>
>
>                  gst_element_set_state (pipeline, GST_STATE_PLAYING);
>
>
>                  g_print ("Running...\n");
>
>
>
>
>
>                  /*iterate*/
>
>
>                  g_main_loop_run (loop);
>
>
>                  g_print ("Recording\n");
>
>
>
>
>
>                  /* Out of the main loop, clean up nicely */
>
>
>                 g_print ("Returned, stopping playback\n");
>
>
>                 gst_element_set_state (pipeline, GST_STATE_NULL);
>
>
>
>                 g_print ("Deleting pipeline\n");
>
>
>                 gst_object_unref (GST_OBJECT (pipeline));
>
>
>
>                return 0;
>
>
>              }
>
>
>
>              static gboolean bus_call(GstBus *bus, GstMessage *msg,
>              gpointer data) {
>
>
>
>                  return TRUE;
>
>
>              }
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>     ------------------------------------------------------------------------------
>     The NEW KODAK i700 Series Scanners deliver under ANY
>     circumstances! Your
>     production scanning environment may not be a perfect world - but
>     thanks to
>     Kodak, there's a perfect scanner to get the job done! With the NEW
>     KODAK i700
>     Series Scanner you'll get full speed at 300 dpi even with all image
>     processing features enabled. http://p.sf.net/sfu/kodak-com
>     _______________________________________________
>     gstreamer-devel mailing list
>     gstreamer-devel at lists.sourceforge.net
>     <mailto:gstreamer-devel at lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
> Series Scanner you'll get full speed at 300 dpi even with all image 
> processing features enabled. http://p.sf.net/sfu/kodak-com
> ------------------------------------------------------------------------
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>   




More information about the gstreamer-devel mailing list