What is best way to debug Shoes applications?
Asked Answered
Y

5

8

Shoes has some built in dump commands (Shoes.debug), but are there other tools that can debug the code without injecting debug messages throughout? Something like gdb would be great.

Yester answered 15/9, 2008 at 14:54 Comment(0)
A
5

You can also use Shoes.show_log to automatically open a debug console.

Agulhas answered 15/9, 2008 at 14:54 Comment(1)
"puts" (and "p") messages should appear in stdout in the terminal window from which you launched the shoes application. This is working with Shoes 4.0.0.pre5 running on jruby 9.1.0.0 - but I can't speak for earlier versions of Shoes.Demasculinize
K
3

The shoes console. Press Alt+/ (or apple+/ on a mac) to see the stack trace of your application.

Kelbee answered 15/9, 2008 at 20:47 Comment(0)
M
2

Note that if you use Alt + / you'll have to run that "before" starting the app

Mb answered 15/9, 2008 at 14:54 Comment(0)
S
1

Have you looked at the ruby-debug gem?


% sudo gem install ruby-debug

The rdebug executable gives you a similar interface to gdb (breakpoint setting, etc). You just simply execute your script with rdebug instead of ruby.

You can also do something like this to avoid manually setting breakpoints:


class Foo
  require 'ruby-debug'
  def some_method_somewhere
    debugger # acts like a breakpoint is set at this point
  end
end

Here's a tutorial on ruby-debug: http://www.datanoise.com/articles/2006/7/12/tutorial-on-ruby-debug

Sulfite answered 15/9, 2008 at 15:25 Comment(2)
How would you do this in Shoes? There's no terminal.Lamere
This is useful debugging info, but its not clear how to apply to Shoes.Unspotted
L
0

I was a bit confused about the Apple-/ (or Alt-/) bit mentioned here. What I ended up doing was running ./shoes with no arguments, which popped up the console, then started my app with ./shoes my_app.rb.

Lunar answered 15/9, 2008 at 14:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.