I have c/gtk+ application 开发者_高级运维and GList which filled three elements, when i try to run following code with gdb:
if (g_list_length(mw->img_list) > 0)
printf(">0");
else
printf("<0");
i see:
Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb73c4700 (LWP 7936)] IA__g_list_length (list=0x6e6920) at glist.c:767 767 glist.c: No such file or directory. in glist.c
What is it?
Thank you.
This is a crash in glib, probably because you're handing it a bad pointer to a list. The debugger tries to load the source code to show you where it crashed, but can't find it (probably because you just linked to the lib, without even having the source handy).
Use the gdb up
command to step upwards in the call stack until you reach your code, and inspect the argument you passed to the g_list_length()
function.
Your debugger is trying to find the source code for GList to help you to debug the problem. Typically, you won't have the source installed. You'll need to install debugging packages or source of some kind.
If you are on a Fedora system, debuginfo-install glib2
will do it. On Debian or Ubuntu, there may be a package for this, possibly ending in -dbg
?
It looks as though its trying to find something(on your hard disk)that doesn't exist. Is that all of the code?
精彩评论