That might work well enough for C++, but I'm not sure how well it would work for other languages. For example, apparently gdb doesn't work all that well for debugging Go programs?
Each language has its own peculiarities for how objects are represented on the heap.
Each language has its own peculiarities for how objects are represented on the heap.