Although this clearly works as you have pointed out, I fear that there may be quite a few pitfalls, it may not be that easy in the end.
For example, how can the debugger plugin know a function's return type without either querying the code completion plugin or demangling the C++ function name? Both is problematic in some way.
One could argue that this functionality is only ever needed for
bool and
int values as well as pointers. You don't usually do something like
if(ReturnsAnObject()) (and with most object types, that won't compile, either).
But anyway, bool and int may have different sizes (normally, but not necessarily
sizeof(bool) == sizeof(char)), and you don't really know what kind of tampering the compiler does (and what may be the upper 24/56 bits of a
bool), so simply reading the whole register might give random nonsense (or might work fine, who knows...).
And then we have non-stdcall functions, and inline functions, register variables, all that kind of stuff. According to the GCC documentation, it is quite possible and valid to debug optimized code, so we cannot expect everything to be nice and easy.
Life is a lot easier if you do have a symbol, since then you just *ask* GDB for the value, and it is not your problem where it comes from