Summary: | Can we grab a frame from Ruby land? | ||
---|---|---|---|
Product: | [Applications] Heaptrack | Reporter: | Sam Saffron <sam.saffron> |
Component: | general | Assignee: | Milian Wolff <mail> |
Status: | REPORTED --- | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Sam Saffron
2019-10-14 04:51:09 UTC
I'm all for finding a way to inject frames from scripting languages in some way, but so far I haven't gotten there. It will require some kind of API that would then be called by ruby. Or do you have something else in mind? Yeah I think usability wise the best thing would be: ``` gem install heaptrack_ruby # in the ruby script require 'heaptrack_ruby' ``` Then heaptrack can publish some sort of library to register callbacks for scripting languages, and the ruby gem can then on require simply register the "lookup frame function" in the heaptrack library. Then you would use libunwind to get your stack followed by calling the callback which is injected via ruby. The actual code the Ruby extension would call to get the frame is along the lines of: ``` if (ruby_thread_has_gvl_p() && ruby_current_vm_ptr && ruby_current_execution_context_ptr) { int line; const char *ptr = rb_source_location_cstr(&line); } ``` So I guess the signature of the method would be something like this if my C is write which it is likely not: ``` heaptrack_register_backtrace_lookup( *(char**)(void) ) ``` |