Issue #7436 has been updated by headius (Charles Nutter).


A flag that's enabled at runtime would not really work, since optimizations might already have happened. There needs to be a way to specify that optimizations should be off. In JRuby, the simplest way to do that is to turn off the compiler by passing -X-C to JRuby. In that case, all code will remain interpreted with full bindings available at every ruby level of the stack (we do not provide bindings for native methods). Implementing Binding.of_caller in that scenario would be pretty simple.

JRuby currently has a --debug flag that turns on things like trace functions. It might be reasonable for it to turn on full bindings as well, though it would definitely have a major perf impact.
----------------------------------------
Feature #7436: Allow for a "granularity" flag for backtrace_locations
https://bugs.ruby-lang.org/issues/7436#change-34782

Author: sam.saffron (Sam Saffron)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: next minor


related to http://bugs.ruby-lang.org/issues/7051

Sometimes one need less information (or more information) associated with backtraces.

It would be nice if one could send in a separate flag informing the VM about the granularity of information required, eg: 

caller_locations(0,-current_depth, BacktraceInfo::Label & BacktraceInfo::Lineno)

This allows for one to take quicker backtraces if they need less information, additionally BacktraceInfo::Bindings and BacktraceInfo::Klass could be added which allow you to gather more information for heavy profiling / diagnostics. 
 




-- 
http://bugs.ruby-lang.org/