I am trying to use the ruby debugger in a Rails app.
What command do I need to type at the (rdb:1) prompt in order to display a stack trace? I've tried backtrace
, but it only lists the topmost frame.
A stack trace is a report that provides information about program subroutines. It is commonly used for certain kinds of debugging, where a stack trace can help software engineers figure out where a problem lies or how various subroutines work together during execution.
The stack trace (usually named "backtrace" in Ruby, but also referred to as "stack backtrace" and "stack traceback") is a human-readable representation of the stack at a specific moment while running your program.
To help deal with bugs, the standard distribution of Ruby includes a debugger. In order to start the Ruby debugger, load the debug library using the command-line option -r debug. The debugger stops before the first line of executable code and asks for the input of user commands.
http://apidock.com/ruby/Kernel/caller
caller(0) # Returns the stack trace, omitting 0 initial entry.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With