Hello Daco and Ben,
I hope you are both doing well.
This is Nourhan again,
I've been comparing the possible approaches to find the best fit. I wanted to share my current thoughts with you and ask for your opinion.
I initially considered an out-of-process solution , but ruled it out because it doesn't work when DDS and the VM are on different machines, wihch happens in remote Flutter debugging.
Instead, I've been exploring in VM safe read APIs (pread64 on Linux, ReadProcessMemory on Windows) that return error codes instead of crashing on invalid addresses. I built working prototypes on both platforms confirming this works.
recently, I studied
expression_evaluator.dart and realized there's a second viable path: using the existing evaluate/evaluateInFrame RPC to call new internal _readNativeMemory native function from DDS. This would work for remote debugging since the memory read still happens inside the VM process. However, my earlier prototypes showed that the expression evaluator cannot access struct layout metadata (sizeOf throws UnimplementedError, ptr.ref.a throws UNREACHABLE, #offsetOf is a syntax error) so a new VM side RPC for the layout would still be needed. This path also adds multiple network round trips and does not work in AOT mode.
My current preference is a single dedicated VM Service RPC that handles the safe read and field decoding in one call which is simpler and faster.
So I want to ask does the multi round trip network dependency of the evaluate-based approach matter in practice, or is the latency acceptable for a debugging feature? I want to make sure I'm weighing the tradeoffs correctly.Thank you for your time,
Nourhan Hasan