1

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)

Luchian Grigore
  • 253,575
  • 64
  • 457
  • 625
  • That sounds similar to the problem with [visualizing `boost::optional` in Visual Studio](http://stackoverflow.com/questions/11300631/cant-see-boostoptional-contents-when-debugging-with-visual-studio), for which [there is a solution (C++ Debugger Visualizers for VS2012)](https://visualstudiogallery.msdn.microsoft.com/c7e02633-86d9-4262-b745-6cc647afb3a8) which you might be able to adapt (I've never used this so can't vouch for it, but I have seen it mentioned in the context of the `boost::optional` debugger problem before). – softwariness Apr 02 '15 at 16:04

0 Answers0