Read more

Fixing Ruby debugger: *** Unknown command: "something". Try "help".

Dominik Schöler
July 28, 2014Software engineer at makandra GmbH

So you have placed a breakpoint somewhere and now want to dig around, but not even inspecting variables is working:

(rdb:3) @order_item
*** Unknown command: "@order_item".  Try "help".
Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

The reason is, you must tell the debugger to evaluate your expression. One workaround is to call irb to open an irb session at your breakpoint. Resume by sending Ctrl+D twice or by returning to the outer irb with "exit" and then continuing with "c".

However, the native debugger command for your issue is eval (or its shorter alias e):

(rdb:3) e @order_item
#<OrderItem id: 111471, quantity: 5, ... bla>

The debugger has a setting called autoeval that will make it pass any unknown command to the breakpoint environment. Set it with:

set autoeval

Put that line into ~/.rdebugrc to have your debugger always evaluate unknown commands. Credits Show archive.org snapshot .

Posted by Dominik Schöler to makandra dev (2014-07-28 12:47)