The default IRB completion code that ships with Ruby does not work well when being invoked from the debugger prompt:
The reason why this happens is that the completion code assumes that IRB.conf[:MAIN_CONTEXT] is defined, but this is not the case when debugger is used. All we are really after is a valid binding, so to patch we can just use self.binding when the irb context is not available. An example patch can be found on my fork of an unofficial ruby repository.
In these days where rvm allows multiple ruby versions to be used, patching is not a patch-once-and-forget issue any longer. Therefore I felt the need to write a utility for this. It checks if your current version of ruby is patched and if not, shows the filename that needs to be updated and the suggest code change. It is bundled as the patch_irb_completion gem: simply "gem install patch_irb_completion;patch_irb_completion". But that gives the overhead of having to install a gem for every ruby version. So maybe an executable script is a better solution. Here is one: