Friday, January 30, 2009

Compiling ruby with debug symbols in windows

I want to use gdb to debug an application that embeds the ruby dll. I was running into the problem that the ruby configure scripts and makefile were stripping out debug symbols during the make process.



The problem is the "-s" parameter, marked by the light blue box above.

I ended up having to manually edit the files "Makefile" and "config.status". The "-s" part in "-shared $(if $(filter-out -g -g0,$(debugflags)),,-s)" needs to be deleted.

I wonder if there is a better way to do this.

UPDATE (2/2/2009):

I posted this question to ruby-core and Nobuyoshi Nakada responded: I have to add the 'debugflags' command line option to the configure script and the "-s" parameter goes away:

./configure --enable-shared --disable-install-doc optflags="-O0" debugflags="-g3 -ggdb"
make

More info from the ruby-core thread:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/21769

2 comments:

Roger Pack said...

I'd probably bring this question up on ruby core.
-=r

tim said...

Thanks for the advice Roger. I posted the question to ruby-core and got a solution almost immediately.