Kevin Pratt
7/3/2005 10:46:00 PM
Thanks for you guys help, I'm new to gdb and did not know about the bt
command (it was exactly what I was looking for) I have been able to
figure out where the program is failing. But I have not done any
work with the boost set of libraries and that is where it seems to be
failing. I've checked the values of the parameters being passed to
the call and they seem to be in good shape.
If any one here is familiar with the Gosu library it uses boost. Line
33 contains a call to the boost BlockAllocator I have checked the
inputs and they seem valid.
Even when I try a std::cerr <<" some string"; I get a segfalut on
that line instead. But that stack strace complains about problems
with and unhandled exception in the << operator.
Any suggestions would be great... Thanks for all your help so far.
This is a tricky one. If the Gosu linux developer is around I'll
gladly give him a shell account on my computer to try and figure this
out.
I'll keep hacking away at it and see what I can find.
Below is the output from the bt command in gdb.
#0 0xb7dba74b in mallopt () from /lib/libc.so.6
#1 0xb7db9803 in malloc () from /lib/libc.so.6
#2 0xb791a28e in operator new () from
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/libstdc++.so.5
#3 0xb7cf82fe in Gosu::OpenGL::Texture::alloc (this=0x80911d8,
width=255, height=255, x=0xbfffb43c, y=0xbfffb438) at Texture.cpp:33
#4 0xb7cf060a in Gosu::OpenGL::GraphicsImpl::createImage
(this=0x808f3d0, src=@0xbfffb750, srcX=0, srcY=0, srcWidth=253,
srcHeight=253, borderFlags=12)
at OpenGL.cpp:149
#5 0xb7cfa17b in LargeImageData (this=0x80911a8,
imageCreator=@0x808f3d0, source=@0xbfffb750, partWidth=253,
partHeight=253, borderFlags=15) at LargeImageData.cpp:48
#6 0xb7cf025a in Gosu::OpenGL::GraphicsImpl::createImage
(this=0x808f3d0, src=@0xbfffb750, srcX=0, srcY=0, srcWidth=640,
srcHeight=480, borderFlags=15)
at OpenGL.cpp:111
#7 0xb7cef072 in Gosu::Graphics::createImage (this=0x808e390,
src=@0xbfffb750, srcX=0, srcY=0, srcWidth=640, srcHeight=480,
hardBorders=true) at Graphics.cpp:108
#8 0xb7cf5709 in Image (this=0x8091198, graphics=@0x808e390,
source=@0xbfffb750, srcX=0, srcY=0, srcWidth=640, srcHeight=480,
hardBorders=true) at Image.cpp:18
#9 0xb7cd5f89 in RubyGosu::Image_initialize (argc=3, argv=0xbfffbe38,
self=3084121996) at Image.cpp:102
#10 0xb7f5e8d6 in rb_throw () from /usr/lib/libruby18.so.1.8
#11 0xb7f51075 in rb_with_disable_interrupt () from /usr/lib/libruby18.so.18
#12 0xb7f5196b in rb_with_disable_interrupt () from /usr/lib/libruby18.so.18
#13 0xb7f51ede in rb_funcall2 () from /usr/lib/libruby18.so.1.8
#14 0xb7f54b09 in rb_obj_call_init () from /usr/lib/libruby18.so.1.8
#15 0xb7cd8548 in RubyGosu::Default_new<boost::shared_ptr<Gosu::Image>
> (argc=3, argv=0xbfffbe38, cls=3084126776) at DataWrapper.hpp:23
#16 0xb7f5e8d6 in rb_throw () from /usr/lib/libruby18.so.1.8
#17 0xb7f51075 in rb_with_disable_interrupt () from /usr/lib/libruby18.so.18
#18 0xb7f5196b in rb_with_disable_interrupt () from /usr/lib/libruby18.so.18
#19 0xb7f4c3a6 in rb_Array () from /usr/lib/libruby18.so.1.8
#20 0xb7f4bd5f in rb_Array () from /usr/lib/libruby18.so.1.8
#21 0xb7f51252 in rb_with_disable_interrupt () from /usr/lib/libruby18.so.18
#22 0xb7f5196b in rb_with_disable_interrupt () from /usr/lib/libruby18.so.18
#23 0xb7f51ede in rb_funcall2 () from /usr/lib/libruby18.so.1.8
#24 0xb7f54b09 in rb_obj_call_init () from /usr/lib/libruby18.so.1.8
#25 0xb7cdbdf2 in
RubyGosu::Default_new<boost::shared_ptr<RubyGosu::WindowImpl> >
(argc=0, argv=0x0, cls=3084122696) at DataWrapper.hpp:23
#26 0xb7f5e8d6 in rb_throw () from /usr/lib/libruby18.so.1.8
#27 0xb7f51075 in rb_with_disable_interrupt () from /usr/lib/libruby18.so.18
#28 0xb7f5196b in rb_with_disable_interrupt () from /usr/lib/libruby18.so.18
#29 0xb7f4c3a6 in rb_Array () from /usr/lib/libruby18.so.1.8
#30 0xb7f4c293 in rb_Array () from /usr/lib/libruby18.so.1.8
#31 0xb7f484dc in ruby_cleanup () from /usr/lib/libruby18.so.1.8
#32 0xb7f48534 in ruby_exec () from /usr/lib/libruby18.so.1.8
#33 0xb7f48571 in ruby_run () from /usr/lib/libruby18.so.1.8
#34 0x08048683 in main ()
On 03/07/05, Max Nickel <max@oss-institute.org> wrote:
>
> > What would be the best way to debug this problem? I need to find out
> > where the segfault is happening. In ruby because of the SO, in the
> > Gosu SO because of invalid memory access etc.
> >
> > Any thoughts would be appreciated.
> >
> > Kevin Pratt
> >
> I'd recommend gdb.
> run 'gdb ruby', inside gdb type 'run <path_to_your_ruby_script>', wait
> till it segfaults and type 'bt' et voila ;)
>
> regards
> /max
>
>