I'm writing some debug functionality that has to be generic, and in the interest of not modifying a lot of existing code, I'm tracking some objects (most of which have nothing in common) by copying their in-memory layout (I know pointers and complex members won't be reliable) and the type of the object to a buffer (as a string) + some metadata (size & padding bytes for alignment).
So I'll basically have some memory:
Object1[padding][size][morepadding][object in binary form of size size] Object2[....]
This all works, and when I want to inspect an object I open a watch window and inspect (Object1*)(&[object in binary form])
. I correctly see the members I need. I'd like to automatize this in the debugger.
Is there a way to have the debug/watch/whatever window show me the object directly, without me having to cast to the type?
(I've explored multiple options and this is the less intrusive, which is why I chose it. This isn't an XY question. If there's no way to do this, I'll continue casting manually)