No subject
Wed Aug 3 17:12:22 PDT 2011
(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.
--=_alternative 0002BD51882578E2_=
Content-Type: text/html; charset="US-ASCII"
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>gstreamer-devel-request at lists.freedesktop.org</b>
</font>
<br><font size=1 face="sans-serif">Sent by: gstreamer-devel-bounces+peter.watkins=biotronik.com at lists.freedesktop.org</font>
<p><font size=1 face="sans-serif">08/03/2011 12:57 PM</font>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
gstreamer-devel at lists.freedesktop.org</font></div></table>
<br>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">gstreamer-devel at lists.freedesktop.org</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">Attempting to debug rfbsrc plugin</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br><tt><font size=2><br>
<br>
I'd like to use the rfbsrc plugin for a project I'm working on. I know
<br>
it's a "bad" plugin, but it does exactly what I want. To test
it, I ran <br>
gst-launch with the following command:</font></tt>
<br>
<br><font size=2 face="sans-serif">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.</font>
<br>
<br><font size=2 face="sans-serif">Anyway, here's the first part of the
backtrace:</font>
<br><font size=2 face="sans-serif">GLib-ERROR **: /build/buildd/glib2.0-2.28.6/./glib/gmem.c:170:
failed to allocate 3042077755 bytes</font>
<br><font size=2 face="sans-serif">aborting...</font>
<br>
<br><font size=2 face="sans-serif">Program received signal SIGABRT, Aborted.</font>
<br><font size=2 face="sans-serif">[Switching to Thread 0xb72d5b70 (LWP
2587)]</font>
<br><font size=2 face="sans-serif">0x0012e416 in ?? ()</font>
<br><font size=2 face="sans-serif">(gdb) bt</font>
<br><font size=2 face="sans-serif">#0 0x0012e416 in ?? ()</font>
<br><font size=2 face="sans-serif">#1 0x0035de71 in raise (sig=6)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:64</font>
<br><font size=2 face="sans-serif">#2 0x0036134e in abort () at abort.c:92</font>
<br><font size=2 face="sans-serif">#3 0x0028cf27 in g_logv () from
/lib/i386-linux-gnu/libglib-2.0.so.0</font>
<br><font size=2 face="sans-serif">#4 0x0028cf62 in g_log () from
/lib/i386-linux-gnu/libglib-2.0.so.0</font>
<br><font size=2 face="sans-serif">#5 0x0028ab3d in g_malloc () from
/lib/i386-linux-gnu/libglib-2.0.so.0</font>
<br><font size=2 face="sans-serif">#6 0x00680ef0 in rfb_decoder_read
(decoder=0x8058d38, </font>
<br><font size=2 face="sans-serif"> len=<value optimized
out>) at rfbdecoder.c:174</font>
<br><font size=2 face="sans-serif">#7 0x006810db in rfb_decoder_state_server_cut_text
(decoder=0x8058d38)</font>
<br><font size=2 face="sans-serif"> at rfbdecoder.c:900</font>
<br>
<br><font size=2 face="sans-serif">That makes sense, GLib can't allocate
~ 3GB of memory on my little machine. Here's the offending code:</font>
<br>
<br><font size=2 face="sans-serif">(gdb) f 6</font>
<br><font size=2 face="sans-serif">#6 0x00680ef0 in rfb_decoder_read
(decoder=0x8058d38, </font>
<br><font size=2 face="sans-serif"> len=<value optimized
out>) at rfbdecoder.c:174</font>
<br><font size=2 face="sans-serif">174
decoder->data = g_malloc (len);</font>
<br><font size=2 face="sans-serif">(gdb) info args</font>
<br><font size=2 face="sans-serif">decoder = 0x8058d38</font>
<br><font size=2 face="sans-serif">len = <value optimized out></font>
<br><font size=2 face="sans-serif">(gdb) list</font>
<br><font size=2 face="sans-serif">169
g_return_val_if_fail (len > 0, NULL);</font>
<br><font size=2 face="sans-serif">170 </font>
<br><font size=2 face="sans-serif">171
if (G_UNLIKELY (len > decoder->data_len)) {</font>
<br><font size=2 face="sans-serif">172
if (decoder->data)</font>
<br><font size=2 face="sans-serif">173
g_free (decoder->data);</font>
<br><font size=2 face="sans-serif">174
decoder->data = g_malloc (len);</font>
<br><font size=2 face="sans-serif">175
decoder->data_len = len;</font>
<br><font size=2 face="sans-serif">176
}</font>
<br><font size=2 face="sans-serif">177 </font>
<br><font size=2 face="sans-serif">178
while (total < len) {</font>
<br>
<br>
<br><font size=2 face="sans-serif">Too bad len is optimized out. Perhaps
it's in a register somewhere. In any case, here's the caller to rfb_decoder_read():</font>
<br>
<br><font size=2 face="sans-serif">(gdb) f 7</font>
<br><font size=2 face="sans-serif">#7 0x006810db in rfb_decoder_state_server_cut_text
(decoder=0x8058d38)</font>
<br><font size=2 face="sans-serif"> at rfbdecoder.c:900</font>
<br><font size=2 face="sans-serif">900
rfb_decoder_read (decoder, cut_text_length);</font>
<br><font size=2 face="sans-serif">(gdb) list</font>
<br><font size=2 face="sans-serif">895 </font>
<br><font size=2 face="sans-serif">896
/* 3 bytes padding, 4 bytes cut_text_length */</font>
<br><font size=2 face="sans-serif">897
rfb_decoder_read (decoder, 7);</font>
<br><font size=2 face="sans-serif">898
cut_text_length = RFB_GET_UINT32 (decoder->data + 3);</font>
<br><font size=2 face="sans-serif">899 </font>
<br><font size=2 face="sans-serif">900
rfb_decoder_read (decoder, cut_text_length);</font>
<br><font size=2 face="sans-serif">901
GST_DEBUG ("rfb_decoder_state_server_cut_text: throw away '%s'",</font>
<br><font size=2 face="sans-serif">902
decoder->data);</font>
<br><font size=2 face="sans-serif">903 </font>
<br><font size=2 face="sans-serif">904
decoder->state = rfb_decoder_state_normal;</font>
<br><font size=2 face="sans-serif">(gdb) info locals</font>
<br><font size=2 face="sans-serif">cut_text_length = <value optimized
out></font>
<br><font size=2 face="sans-serif">__FUNCTION__ = "rfb_decoder_state_server_cut_text"</font>
<br>
<br><font size=2 face="sans-serif">cut_text_length is optimized out too,
but it seems like I should be able to determine what it is:</font>
<br>
<br><font size=2 face="sans-serif">(gdb) print decoder->data</font>
<br><font size=2 face="sans-serif">$12 = (guint8 *) 0x80b9900 "(\026I"</font>
<br>
<br><font size=2 face="sans-serif">From the description of RFB_GET_UINT32(),
it seems like it should do something like this:</font>
<br><font size=2 face="sans-serif">(gdb) print ntohl(* (uint32_t *) (decoder->data
+ 3))</font>
<br><font size=2 face="sans-serif">$10 = 2627145</font>
<br>
<br><font size=2 face="sans-serif">However, that yelds 2627145, not 3042077755
(0xB5526C3B).</font>
<br>
<br><font size=2 face="sans-serif">If I look in the registers for frame
5 (g_malloc ()), I can find 0xB5526C3B in the Source Index register (ESI):</font>
<br>
<br><font size=2 face="sans-serif">(gdb) f 5</font>
<br><font size=2 face="sans-serif">#5 0x0028ab3d in g_malloc () from
/lib/i386-linux-gnu/libglib-2.0.so.0</font>
<br><font size=2 face="sans-serif">(gdb) info registers</font>
<br><font size=2 face="sans-serif">eax
0x0 0</font>
<br><font size=2 face="sans-serif">ecx
0xa1b 2587</font>
<br><font size=2 face="sans-serif">edx
0x6 6</font>
<br><font size=2 face="sans-serif">ebx
0x318ff4 3248116</font>
<br><font size=2 face="sans-serif">esp
0xb72d4f40 0xb72d4f40</font>
<br><font size=2 face="sans-serif">ebp
0xb72d4f68 0xb72d4f68</font>
<br><font size=2 face="sans-serif">esi
0xb5526c3b -1252889541</font>
<br><font size=2 face="sans-serif">edi
0x8058d38 134581560</font>
<br><font size=2 face="sans-serif">eip
0x28ab3d 0x28ab3d <g_malloc+109></font>
<br><font size=2 face="sans-serif">eflags 0x200206
[ PF IF ID ]</font>
<br><font size=2 face="sans-serif">cs
0x73 115</font>
<br><font size=2 face="sans-serif">ss
0x7b 123</font>
<br><font size=2 face="sans-serif">ds
0x7b 123</font>
<br><font size=2 face="sans-serif">es
0x7b 123</font>
<br><font size=2 face="sans-serif">fs
0x0 0</font>
<br><font size=2 face="sans-serif">gs
0x33 51</font>
<br>
<br><font size=2 face="sans-serif">ESI has a different value in frame 6:</font>
<br>
<br><font size=2 face="sans-serif">(gdb) f 6 </font>
<br><font size=2 face="sans-serif">#6 0x00680ef0 in rfb_decoder_read
(decoder=0x8058d38, </font>
<br><font size=2 face="sans-serif"> len=<value optimized
out>) at rfbdecoder.c:174</font>
<br><font size=2 face="sans-serif">(gdb) info registers</font>
<br><font size=2 face="sans-serif">eax
0x0 0</font>
<br><font size=2 face="sans-serif">ecx
0xa1b 2587</font>
<br><font size=2 face="sans-serif">edx
0x6 6</font>
<br><font size=2 face="sans-serif">ebx
0x686ff4 6844404</font>
<br><font size=2 face="sans-serif">esp
0xb72d4f70 0xb72d4f70</font>
<br><font size=2 face="sans-serif">ebp
0xb72d4fb8 0xb72d4fb8</font>
<br><font size=2 face="sans-serif">esi
0x8058d38 134581560</font>
<br><font size=2 face="sans-serif">edi
0x8058d38 134581560</font>
<br><font size=2 face="sans-serif">eip
0x680ef0 0x680ef0 <rfb_decoder_read+288></font>
<br><font size=2 face="sans-serif">eflags 0x200206
[ PF IF ID ]</font>
<br><font size=2 face="sans-serif">cs
0x73 115</font>
<br><font size=2 face="sans-serif">ss
0x7b 123</font>
<br><font size=2 face="sans-serif">ds
0x7b 123</font>
<br><font size=2 face="sans-serif">es
0x7b 123</font>
<br><font size=2 face="sans-serif">fs
0x0 0</font>
<br><font size=2 face="sans-serif">gs
0x33 51</font>
<br>
<br><font size=2 face="sans-serif">Alas, I'm not good enough at reading
assembly to figure out where ESI gets changed between frame 6 and 5.</font>
<br>
--=_alternative 0002BD51882578E2_=--
More information about the gstreamer-devel
mailing list