Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get a stack trace using the ruby debugger?

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.

like image 594
spierepf Avatar asked Apr 10 '13 17:04

spierepf


People also ask

What is stack trace in debugging?

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.

What is stack trace Ruby?

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.

How do I debug a Ruby code?

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.


1 Answers

http://apidock.com/ruby/Kernel/caller

caller(0)  # Returns the stack trace, omitting 0 initial entry.
like image 165
konyak Avatar answered Sep 30 '22 13:09

konyak