Closed puremourning closed 5 months ago
Basically, implementing this TODO:
// TODO: if it's a literal and looks like an address (e.g. some
// sort of integer, use that as the addres)
@vadimcn any interest in this PR?
@vadimcn any interest in this PR?
Mmmm, probably not. Normal variables are typed, so we can tell what was intended to be a pointer and what wasn't. I think that assuming any random integer could be a pointer is a bit too much.
Cheers. On the general concept (dump arbitrary address, or memory around pointer) are you onboard with doing something though? It’s a real use case I’ve come across a number of times and had to (sadly) downshift to cpptools or command line a few times.
If so, I’ll take another look to see if there’s a way to do this more robustly. Such as including the memory reference on all pointer values regardless of representation.
If the evaluation result looks like an integer literal, then provide that as a memory reference, allowing the user to dump arbitrary addresses e.g. by typing htem in or casting some variable to (void*).
In general, given an explicit memory value, we can now "dump" memory at that address, so say we have the following code:
We may want to inspect the memory pointed to by
data
. If we putdata
in the evaluator, we get a stringified representation. Instead we can put(void*)data
or just the actual integral value and the result can be used with the "read memory" request to view the output: