Debugging Ruby Core

S

Saladin Mundi

Hello everyone,

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

Thanks so much,

sala
 
A

Alex Fenton

Saladin said:
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
 
L

Lex Williams

Alex said:
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 ?
 
A

Alex Fenton

Lex said:
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
 
S

Saladin Mundi

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?
 
T

Tim Hunter

Saladin said:
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.
 
P

Pit Capitain

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

Regards,
Pit
 
S

Saladin Mundi

Pit said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,200
Messages
2,571,046
Members
47,646
Latest member
xayaci5906

Latest Threads

Top