New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rbspy does not work with nonstandard ruby binaries #356
Comments
Hey, sorry for the delay. I don't have time to work on this feature, but I'd be happy to support anyone who wants to give it a try. The main problem to solve is how to find the embedded ruby VM in memory. When you try to profile a program, rbspy first looks at the program's exported symbols to find the addresses of a few key structures in memory. (This happens in initialize.rs.) If it can't find them, e.g. because ruby is embedded in another program, then you'll get the error you shared above. But with some effort, I think it should be possible to get those memory addresses using the C API. I'd suggest something like this as a proof of concept:
I'm not sure how we would automate that so that rbspy could do it without help, but getting a valid profile would at least show that we can profile embedded ruby. |
Alright, I'll see what I can do. |
py-spy successfully profiles executables which were built statically with libpython, given that symbols are present. So it should be possible with ruby as well, depending on the necessary symbols existing. |
Okay, I should probably start off by establishing what I mean by "nonstandard ruby binary."
MRI supports being embedded inside a C/C++ program (or even rust when using ffi), and there are a couple of projects out there that make heavy use of this, namely mkxp and rutie.
Since these projects are essentially just a custom 'distribution' of ruby, I was wondering how possible it would be to get these to work with rbspy?
They're not standard at all, and the use case is very specific, so I don't want to push anyone to spend time adding in support for this unless it is trivial.
I've tried a couple of times handing rbspy a PID or path to one of these executables, and it doesn't work.
(Output)
I'd love for this to work, but again, I really don't want to push anyone to spend time on something so obscure!
The text was updated successfully, but these errors were encountered: