Debugger support

Those locations are not really weird. They are internals of methods that are inlined due to the inlining nature of the methods with blocks (they become part of the calling method).

I have to figure out if I can play with debug scopes to make them behave skippable on next command.

1 Like

Is there a way to see the contents of arrays/hashes? Or to call methods perhaps? My gdb foo is sadly lacking…

Calling methods would be super useful.

1 Like

For LLVM in console it shows contents of Strings and Arrays.
For hashes/set I have to add some additional synthetic providers.

For GDB I have to implement the same set.

The problem with Array#to_s:String or similar methods that they are not injecting into executable if they are not used somewhere in the code. As soon as you called it somewhere in your code you can call it from debugger then.

If method is defined (was called somewhere in the code flow) in the executable you should be able to call it in debugger (given that it has no side-effects on the other data or internal state).

I still have to figure out how to show Class Variables and Global Variables. This is not implemented yet.

1 Like

Great news!
As of today my debugger support changes was merged into Crystal’s master branch so it supposed to be in Crystal 0.35.

I still will need to add some test specs and I encourage others to help me with that.

13 Likes

Maybe you can make a shard that has a method that calls all the to_s methods on common classes, so that the #to_s methods don’t all get “lost” so they are available for debug session…? :slight_smile:

A short tutorial somewhere on how to “use a debugger” (especially in crystal land) would be nice, here’s how to view a local variable, here’s how to list all of them, here’s how to call a method, here’s how to inspect a variable…
Since it’s merged might even be useful in the crystal gitbook :)

2 Likes

Yes, I am planning to make that tutorial. I am just somehow stretched with different business projects at the same time so I am trying to find some time to make it.

8 Likes

Woot!

Thank you for being so patient and working on debugging support fo Crystal. Great work!

I can’t stress enough now valuable the debugger support will be for many of us using Crystal as well as newcomers wanting to learn Crystal.

I think it would help a lot when Crystal 1.0 is available and someone would evaluate Crystal and it’s ecosystem to see if it’s safe for them to use. Good tooling support is a big plus.

3 Likes

03/14/21 – Language code assigned

8 Likes

Excellent!!!
Now we can officially change the compiler ID in DWArF data

4 Likes

Actually, you can see it by the following link:
http://www.dwarfstd.org/Languages.php

9 Likes

What is the link for the doc’s for the debugger?

I have tried and tried to get this working on windows following Debug Crystal in VSCode via CodeLLDB - DEV Community but it doesn’t stop on any breakpoints and i cant seem to get them from the debug console either or from lldb in command line.

I would love to help you with that, but I don’t have Windows boxes; I have only MacOS or Linux.