-
Notifications
You must be signed in to change notification settings - Fork 83
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
Feature request: arguments capturing #206
Comments
This feature would be especially useful for some debugging / reverse engineering use cases which are not the main target of SPX. I'm however open to add it as long as :
Regarding the complexity, the hard part will be producing the stringified argument list summary. We must as possible reuse an existing logic within the PHP code base. Do you know if this logic is already exposed via a native PHP construct or function ? |
There is php function source C implementation: https://github.com/php/php-src/blob/master/Zend/zend_builtin_functions.c#L1334 |
@ilnytskyi I need something which roughly returns (or includes whithin a returned string) the string you want as summarized argument list. |
That is still a lot of work. |
I checked xdebug tracer and it looks like it does almost exactly what I reported:
will produce string like this
More description here https://xdebug.org/docs/all_settings#trace_format Full trace of my file
I believe this is the way that string is produced (but for textual format = 0 where arguments names are also included)
https://github.com/xdebug/xdebug/blob/master/src/tracing/trace_textual.c#L108 Now I am not sure if we need to implement this for SPX as this feature would only be needed for |
I've the same doubt, optimizing SPX for non-profiling use cases could be at best a Pandora's box. |
It would be nice to have possibility to capture arguments and its values.
Related checkbox in panel can be introduced. Like for current profile (Profile internal functions)
For the beginning only simple types like
Strings - (truncated after char limit defined in panel),
Numbers - as it is
More complex types can be simplified
Arrays - (only length for the beginning if possible)
Objects - Just info about instance type (maybe add spl object id/hash if possible)
Maybe final result would look like this
If I see correctly, arguments capturing would significantly increase dump size and added some overhead
https://github.com/NoiseByNorthwest/php-spx/blob/master/src/spx_php.c#L249
(As we need to link called function with arguments)
Maybe some optimizations like skipping arguments in constructors would help
The text was updated successfully, but these errors were encountered: