I still don´t quite understand this. Yes, initializers of static or file scope variables are executed before the execution of the main programm. But those need to have an unique name, at file scope. For static variables in functions, you could have one identifier for each function. There is no way the macros could enforce this, besides using LINE or whatever. But then, you could never go back and reference the identifiers you have created in a useful way. And, IMO, there is no meaningful information you could extract from those initializers. Also, the order in which they are called is not defined. And if you use the macro on “auto” variables that are created on the stack, not only is their initializer not called before execution of the main programm, but keeping their addresses and dereferencing them is inherently unsafe.
I don´t want to be unfriendly, but it seem to me that the OP wants to implement some sort of homebrew debugger. This will almost never work; a custom made tracer is often used, but the debugger that is supplied with your compilier is practically always superior to your own efforts. The debuggers use all sorts of (maybe) undocumented hooks, and they usually dig deep into the runtime system.
Also, ** Omphaloskeptic **, I think this doesn´t work as you suggested:
#define TEST(a,b) TestObj a(b)
TEST(x,3); // expands to TestObj x(3);
It does not exapnd to TestObj x(3); It expands to TestObj a(3).