Attempting to debug rfbsrc plugin

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Attempting to debug rfbsrc plugin

Peter Watkins

I'd like to use the rfbsrc plugin for a project I'm working on. I know it's a "bad" plugin, but it does exactly what I want. To test it, I ran gst-launch with the following command:

gst-launch rfbsrc host=10.130.6.61 password=secret width=1024 height=768 view-only=true ! videoscale ! videorate ! video/x-raw-rgb,width=1024,height=768,framerate=10/1 ! ffmpegcolorspace ! autovideosink

I'm new to gstreamer so that pipeline might have some unnecessary pieces. Let me know if it does.

After about 10 seconds, gst-launch hits a segmentation violation:

WARNING: from element /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0/GstXImageSink:autovideosink0-actual-sink-ximage: A lot of buffers are being dropped.
Additional debug info:
gstbasesink.c(2597): gst_base_sink_is_too_late (): /GstPipeline:pipeline0/GstAutoVideoSink:autovideosink0/GstXImageSink:autovideosink0-actual-sink-ximage:
There may be a timestamping problem, or this computer is too slow.
Caught SIGSEGV accessing address 0x7fb1f0f67a90
#0  0x00007fb1f55baf93 in ?? ()
#1  0x0000000000871a80 in ?? ()
#2  0x00000000000000f9 in ?? ()
#3  0x0000000000000001 in ?? ()
#4  0x0000000000871a80 in ?? ()
#5  0x0000000000707218 in ?? ()
#6  0x00007fb1f5ac34a9 in ?? ()
#7  0x0000000000707210 in ?? ()
#8  0x00007fb1000000f9 in ?? ()
#9  0x00007fb1f5d5d788 in ?? ()
#10 0x00007fb1f5d5d7c0 in ?? ()
#11 0x0000000100000001 in ?? ()
#12 0x0000000000707218 in ?? ()
#13 0x00000000ffffffff in ?? ()
#14 0x7fffffff000000f9 in ?? ()
#15 0x00000000008b2e50 in ?? ()
#16 0x00000000008b2f90 in ?? ()
#17 0x00000000006b8080 in ?? ()
#18 0x00007fb1f5d5de60 in ?? ()
#19 0x0000000000000001 in ?? ()
#20 0x00000000008b2f9c in ?? ()
#21 0x0000000000000000 in ?? ()
Spinning.  Please run 'gdb gst-launch 8038' to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.

So I'd like to poke around in GDB and try to see what the problem is. I'm on Ubuntu 10.04 64 bit, I've installed the debug symbols for gstreamer, gstreamer-bad-plugins, and libc6.

When I run GDB, the debug symbols seem to load:

user@fermi:~/gstreamer0.10-0.10.28/tools$ gdb gst-launch 8038
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 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".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/gst-launch...Reading symbols from /usr/lib/debug/usr/bin/gst-launch...done.
done.
Attaching to program: /usr/bin/gst-launch, process 8038
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug/lib/ld-2.11.1.so...done.
done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
0x00007fb1f55baf93 in ?? ()
(gdb)


However, I can't seem to print a backtrace or display any variables:

(gdb) bt
#0  0x00007fb1f55baf93 in ?? ()
#1  0x0000000000871a80 in ?? ()
#2  0x00000000000000f9 in ?? ()
#3  0x0000000000000001 in ?? ()
#4  0x0000000000871a80 in ?? ()
#5  0x0000000000707218 in ?? ()
#6  0x00007fb1f5ac34a9 in ?? ()
#7  0x0000000000707210 in ?? ()
#8  0x00007fb1000000f9 in ?? ()
#9  0x00007fb1f5d5d788 in ?? ()
#10 0x00007fb1f5d5d7c0 in ?? ()
#11 0x0000000100000001 in ?? ()
#12 0x0000000000707218 in ?? ()
#13 0x00000000ffffffff in ?? ()
#14 0x7fffffff000000f9 in ?? ()
#15 0x00000000008b2e50 in ?? ()
#16 0x00000000008b2f90 in ?? ()
#17 0x00000000006b8080 in ?? ()
#18 0x00007fb1f5d5de60 in ?? ()
#19 0x0000000000000001 in ?? ()
#20 0x00000000008b2f9c in ?? ()
#21 0x0000000000000000 in ?? ()
(gdb) info locals
No symbol table info available.
(gdb) info args
No symbol table info available.


Maybe this is a question for the GDB list, but does anyone have any idea why I can't seem to get much debugging info for gstreamer?

Thanks,

Peter

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Attempting to debug rfbsrc plugin

Peter Watkins



[hidden email]
Sent by: gstreamer-devel-bounces+peter.watkins=[hidden email]

08/03/2011 12:57 PM

Please respond to
[hidden email]

To
[hidden email]
cc
Subject
Attempting to debug rfbsrc plugin





I'd like to use the rfbsrc plugin for a project I'm working on. I know
it's a "bad" plugin, but it does exactly what I want. To test it, I ran
gst-launch with the following command:


OK. I got my backtrace. It turns out that I can't connect to the process. I have to run gst-launch from within GDB directly. Odd.

Anyway, here's the first part of the backtrace:
GLib-ERROR **: /build/buildd/glib2.0-2.28.6/./glib/gmem.c:170: failed to allocate 3042077755 bytes
aborting...

Program received signal SIGABRT, Aborted.
[Switching to Thread 0xb72d5b70 (LWP 2587)]
0x0012e416 in ?? ()
(gdb) bt
#0  0x0012e416 in ?? ()
#1  0x0035de71 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0x0036134e in abort () at abort.c:92
#3  0x0028cf27 in g_logv () from /lib/i386-linux-gnu/libglib-2.0.so.0
#4  0x0028cf62 in g_log () from /lib/i386-linux-gnu/libglib-2.0.so.0
#5  0x0028ab3d in g_malloc () from /lib/i386-linux-gnu/libglib-2.0.so.0
#6  0x00680ef0 in rfb_decoder_read (decoder=0x8058d38,
    len=<value optimized out>) at rfbdecoder.c:174
#7  0x006810db in rfb_decoder_state_server_cut_text (decoder=0x8058d38)
    at rfbdecoder.c:900

That makes sense, GLib can't allocate ~ 3GB of memory on my little machine. Here's the offending code:

(gdb) f 6
#6  0x00680ef0 in rfb_decoder_read (decoder=0x8058d38,
    len=<value optimized out>) at rfbdecoder.c:174
174            decoder->data = g_malloc (len);
(gdb) info args
decoder = 0x8058d38
len = <value optimized out>
(gdb) list
169          g_return_val_if_fail (len > 0, NULL);
170        
171          if (G_UNLIKELY (len > decoder->data_len)) {
172            if (decoder->data)
173              g_free (decoder->data);
174            decoder->data = g_malloc (len);
175            decoder->data_len = len;
176          }
177        
178          while (total < len) {


Too bad len is optimized out. Perhaps it's in a register somewhere. In any case, here's the caller to  rfb_decoder_read():

(gdb) f 7
#7  0x006810db in rfb_decoder_state_server_cut_text (decoder=0x8058d38)
    at rfbdecoder.c:900
900          rfb_decoder_read (decoder, cut_text_length);
(gdb) list
895        
896          /* 3 bytes padding, 4 bytes cut_text_length */
897          rfb_decoder_read (decoder, 7);
898          cut_text_length = RFB_GET_UINT32 (decoder->data + 3);
899        
900          rfb_decoder_read (decoder, cut_text_length);
901          GST_DEBUG ("rfb_decoder_state_server_cut_text: throw away '%s'",
902              decoder->data);
903        
904          decoder->state = rfb_decoder_state_normal;
(gdb) info locals
cut_text_length = <value optimized out>
__FUNCTION__ = "rfb_decoder_state_server_cut_text"

cut_text_length is optimized out too, but it seems like I should be able to determine what it is:

(gdb) print decoder->data
$12 = (guint8 *) 0x80b9900 "(\026I"

From the description of RFB_GET_UINT32(), it seems like it should do something like this:
(gdb) print ntohl(* (uint32_t *) (decoder->data + 3))
$10 = 2627145

However, that yelds 2627145, not 3042077755 (0xB5526C3B).

If I look in the registers for frame 5 (g_malloc ()), I can find 0xB5526C3B in the Source Index register (ESI):

(gdb) f 5
#5  0x0028ab3d in g_malloc () from /lib/i386-linux-gnu/libglib-2.0.so.0
(gdb) info registers
eax            0x0        0
ecx            0xa1b        2587
edx            0x6        6
ebx            0x318ff4        3248116
esp            0xb72d4f40        0xb72d4f40
ebp            0xb72d4f68        0xb72d4f68
esi            0xb5526c3b        -1252889541
edi            0x8058d38        134581560
eip            0x28ab3d        0x28ab3d <g_malloc+109>
eflags         0x200206        [ PF IF ID ]
cs             0x73        115
ss             0x7b        123
ds             0x7b        123
es             0x7b        123
fs             0x0        0
gs             0x33        51

ESI has a different value in frame 6:

(gdb) f 6  
#6  0x00680ef0 in rfb_decoder_read (decoder=0x8058d38,
    len=<value optimized out>) at rfbdecoder.c:174
(gdb) info registers
eax            0x0      0
ecx            0xa1b    2587
edx            0x6      6
ebx            0x686ff4 6844404
esp            0xb72d4f70       0xb72d4f70
ebp            0xb72d4fb8       0xb72d4fb8
esi            0x8058d38        134581560
edi            0x8058d38        134581560
eip            0x680ef0 0x680ef0 <rfb_decoder_read+288>
eflags         0x200206 [ PF IF ID ]
cs             0x73     115
ss             0x7b     123
ds             0x7b     123
es             0x7b     123
fs             0x0      0
gs             0x33     51

Alas, I'm not good enough at reading assembly to figure out where ESI gets changed between frame 6 and 5.

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Attempting to debug rfbsrc plugin

David Schleef-2
On Wed, Aug 03, 2011 at 05:29:56PM -0700, Peter Watkins wrote:
> I'd like to use the rfbsrc plugin for a project I'm working on. I know
> it's a "bad" plugin, but it does exactly what I want. To test it, I ran
> gst-launch with the following command:

The rfbsrc element is pretty much unmaintained.  If you need it to
work, it would be a good idea to hack on it yourself.  However,
crashes are always unwelcome -- please file a bug report in bugzilla,
and someone will hopefully eventually look at it.



David


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel