1

I've been trying to debug ruby gem made with Ruby C Extension to figure out how it works, so I can modify it to my own use. It's quite an advanced gem and printing values isn't enough. So I started debugging it with gdb and gdb-ruby gem. I created instance of class in ruby and ran a method that later connects to functions written in C. There was no way I could stop at certain line in C function even after placing breakpoint. To debug ruby I use 'pry' gem if that means anything. Is there a straightforward way to place a breakpoint inside C function, so it stops at it when reaching given function/line in C file after running Ruby program?

railsmk
  • 23
  • 4
  • I have heard that it is quite hard to do so. So I use `rb_p()` and `printf()` instead! You can also have a look at [`ruby/debug.h`](https://github.com/ruby/ruby/blob/v3_1_0/include/ruby/debug.h), plenty of useful methods there. – Ulysse BN Jun 23 '23 at 04:00

0 Answers0