Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

DragonRuby Game Toolkit

An intuitive 2D game engine. Fast, cross-platform, tiny, hot loaded. · By DragonRuby

Stack Trace?

A topic by jacksonmills created Aug 23, 2019 Views: 252 Replies: 5
Viewing posts 1 to 2

Is there any way to get the stack trace of an exception? Having a hard time finding out where an error is occurring.


What OS are you using? Just so I can give you specific instructions. 

Linux, and unfortunately, occasionally Windows.

Developer (1 edit)

Linux is good!

So if you put `trace!` at the top of `def tick` you’ll get a flood in information in standard out. 

You can pass in an instance of an object to trace! To scope it down to that object. 

If neither of those help, ping Amir on Discord and he’ll troubleshoot it with you.

Ok, I was doing that, and it provides a good amount of information, but I guess what I'm asking is, is there any way to get a 'stack trace' like the output during a normal ruby error, like this?


1.9.3-p551 :004 > [].error
NoMethodError: undefined method `error' for []:Array
        from (irb):4
        from /home/stew/.rvm/rubies/ruby-1.9.3-p551/bin/irb:16:in `<main>'
1.9.3-p551 :005 >


Also, is there a way to get an inline debugger?


The problem is that it's an "append only" hot loaded environment. So you could technically write a function that throws an exception. Save the file (to patch the environment), then delete the function from the file. 

When you execute the function, there is no where to point to it.

It's quite an interesting problem ^_^;