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
Store copies of data at trace-time. #456
Conversation
This is basically a plea for discussion; I think it's worth doing. |
@phmarek the usual way to achieve that is to store the print representation. (That's of course how purely textual traces work, but Lispworks does that too, IIRC.) That way, it'll be time/space-bound by Another idea would be tuse swank-presentation-streams (which would need to be fixed beforehand, since it's currently buggy). This way would get a printed representation that is inspectable. Upon inspection it should usually be clear if the object changed since being printed. Yet another idea would be to do a shallow copy (as you've implemented) and use that to somehow point out slots that have been changed. At this point, I worry about the performance implications of this approach though. Perhaps, something like this can also be achieved by comparing printed representations, without or without presentations, and doing some sort of diff between the two. That'd be neat! What do you think of these ideas? |
This is how it should work (and is akin to very quickly refreshing the buffer). Though I don't think you need to mess with the swank-presentation-streams goo, the print representation is already inspectable (at least that's how I remember implementing it). My two cents to add to Luis:
|
I tried with a Furthermore, seeing different print formats (decimal, hex, octal, binary) of integers is really helpful, too; so I searched for a way to keep the representation as identically as possible. @joaotavora: yeah, object identity gets lost with any other representation. Perhaps we should store the original argument as well, and then have some output like Still, I believe that (shallowly) copying |
You probably want something like
Indeed but there are ways to solve this using a smarter printer. SLY by default presents integers in various formats (and you can add your own).
Sound like famous last words. It really depends if the function that you're tracing is very deep/tight in your program's the critical path. You can probably wreck your process easily by tracing say |
Yeah, everything can be broken. But tracing is not a permanent change ("just" reload the image ;), and tracing alone will already be expensive. |
Those are extremely large quotation marks
But now you want to make the price grow with the size of the objects being traced, which wasn't true before. |
Well, how about having a few ways selectable via a special variable? |
Yeah, making it optional is probably a good idea. If like your implementation, I'll probably backport it to Sly. |
You're right. I was thinking that it'd be useful to inspect the object's sub-components directly, which is what swank-presentation-streams let's you do, but in retrospect it seems quite orthogonal to the topic at hand.
Yep, another good point against copying objects. |
f28b43b
to
3be87fe
Compare
6e6f654
to
0463132
Compare
Due to the asynchronicity of multithreaded connections we have to use autodetection: by the time the "switch to json" command has been processed the READ-MESSAGE loop has already been invoked again, and so passing the decoder in as argument would just give the old (stale) value again. Other ideas discussed on #slime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's the right interface, but it returns a Java object https://docs.oracle.com/javase/8/docs/api/java/net/ServerSocket.html#getLocalSocketAddress-- which needs to be interpolated into whatever the defimplementation
expects across the implementations.
shutting off, branch is used for other things ;/ |
When passing structures or other identity-preserving items (arrays,
list heads) around, tracing the call chain wouldn't show how these
items evolve.
At least for the simple well-known cases we can store a copy of the
arguments; the time/space effort only occurs during tracing anyway
and is well spent, IMO.