This patch is a refactoring of https://reviews.llvm.org/D78801. As suggested, I have created a separate patch to more easily compare the implementations.
Even here, the goal is to use the GDB-remote protocol to connect to a Wasm engine that implements a GDB-remote stub that offers the ability to access the engine runtime internal state.
Here I am removing the interface IWasmProcess and the new class WasmProcessGDBRemote and moving most of the Wasm logic in ProcessGDBRemote.
I am still adding the new Unwind class UnwindWasm, which now however is in core and not in plugins code. Having a Unwind-derived class for Wasm unwinding seems to be the cleanest solution.
The advantage with this new design is that the required changes are smaller and isolated in a few places.
The drawback is that three 'core' classes (UnwindWasm, Value and DWARFExpression) have now a dependency on ProcessGDBRemote and/or ThreadGDBRemote. This could be avoided re-introducing a core interface like IWasmProcess. We could add a couple of virtual method bool IsWasmProcess() and IWasmProcess* AsWasmProcess() to Process, which would be overridden by ProcessGDBRemote. Then these classes could just query this interface, removing direct dependencies on GDBRemote.
I am also adding a new qSupported flag named "wasm" that should tell LLDB whether the remote supports Wasm debugging.