Debugging Ruby Core

Hello everyone,

is there a debugger which I could use for debugging the C-Core if I
modify it?

Thanks so much,

sala

···

--
Posted via http://www.ruby-forum.com/.

Saladin Mundi wrote:

is there a debugger which I could use for debugging the C-Core if I
modify it?

There's nothing special about Ruby's C core. You can use whatever debugger goes with the compiler you use, eg Microsoft's debugging tools if compiled with MSVC; gdb if compiled with gcc (although I've found gdb on MingW / Windows pretty unstable).

If you want a step-through debugger for Ruby, I'd look into ruby-debug. It's much faster than ruby's stdlib pure-ruby debugger, and also has nice integration eg with emacs.

alex

Thank you,
I'll have a look!

···

--
Posted via http://www.ruby-forum.com/.

Alex Fenton wrote:

Saladin Mundi wrote:

is there a debugger which I could use for debugging the C-Core if I
modify it?

There's nothing special about Ruby's C core. You can use whatever
debugger goes with the compiler you use, eg Microsoft's debugging tools
if compiled with MSVC; gdb if compiled with gcc (although I've found gdb
on MingW / Windows pretty unstable).

If you want a step-through debugger for Ruby, I'd look into ruby-debug.
It's much faster than ruby's stdlib pure-ruby debugger, and also has
nice integration eg with emacs.

alex

But , in order to do this ( with gdb ) , shouldn't ruby be recompiled
with -g ? Or that option is already set ?

···

--
Posted via http://www.ruby-forum.com/\.

Lex Williams wrote:

Alex Fenton wrote:

Saladin Mundi wrote:

is there a debugger which I could use for debugging the C-Core if I
modify it?

There's nothing special about Ruby's C core. You can use whatever
debugger goes with the compiler you use, eg Microsoft's debugging tools
if compiled with MSVC; gdb if compiled with gcc (although I've found gdb
on MingW / Windows pretty unstable).

But , in order to do this ( with gdb ) , shouldn't ruby be recompiled with -g ? Or that option is already set ?

-g flag to gcc is needed, but recompilation isn't always going to be necessary.

The last time I built ruby (MingW, 1.9.0-4) gcc got the options "-g -O2" without having to do anything special, just "./configure; make"

Distro / vendor supplied rubies will vary in how they're compiled.

a

The last time I built ruby (MingW, 1.9.0-4) gcc got the options "-g -O2"
without having to do anything special, just "./configure; make"

I also use MingGW.
Do I have to put -g 02 in the config "string" ?

(Now I only use:
/configure --with-baseruby=/home/MYUSERNAME/ruby-1.8.6/bin/ruby.exe
--prefix=/rubytest --program-suffix=test
)

How would it look like with the gnu debugger?

···

--
Posted via http://www.ruby-forum.com/\.

Saladin Mundi wrote:

The last time I built ruby (MingW, 1.9.0-4) gcc got the options "-g -O2"
without having to do anything special, just "./configure; make"

I also use MingGW.
Do I have to put -g 02 in the config "string" ?

(Now I only use:
/configure --with-baseruby=/home/MYUSERNAME/ruby-1.8.6/bin/ruby.exe
--prefix=/rubytest --program-suffix=test
)

How would it look like with the gnu debugger?

Typically you specify additional/overriding gcc flags with the CFLAGS
environment variable, so you could say

export CFLAGS=-g
./configure ...whatever...

I'm surprised that Alex got "-g -O2" automatically. I would not expect
Ruby to compile with debugging information by default.

···

--
Posted via http://www.ruby-forum.com/\.

Saladin, did you succeed in debugging the MinGW Ruby? I'm interested
in this, too.

Regards,
Pit

Pit Capitain wrote:

Saladin, did you succeed in debugging the MinGW Ruby? I'm interested
in this, too.

Hey Pit,
well not really. I used this tutorial
http://www.ruby-mine.de/2007/5/7/ruby-1-9-aus-neuen-snapshots-auf-windows-erstellen
from Ruby-Mine.de (unless its in german)

Additionally I installed the gnu debugger into msys. But I have no real
clue how to really use the debugger. For my actual tasks it is enough to
look into the msys console when compiling Ruby.

I had a closer look into the compiling dialog from msys and there it
shows me the line "gcc -g -02 ....." (like Alex mentioned).

If this is equivalent to the gnu debugger than I have it. I'm a little
bit overstrained with it because I don't really now what I could really
do with it.

···

--
Posted via http://www.ruby-forum.com/\.