> It seems at the MI interface one wants a choice of whether a varobj
> is associated with:
> (a) a specific frame (goes away when function returns)
> (b) a function
> (c) a function at the same depth (which some implement)
GDB already does something like (b) if you use:
-var-create - @ myvar
although it's not documented. I think this can specifically be used in the
case of recursion
> How the distinction is made at the GUI level is a separate question.
> And what to do in the event of recursion when one selected a
> function-level varobj (b) is also an interesting question -- perhaps
> it always refers to the topmost instance (or to theseparately selected
> instance if the currently selected stack depth is to that function).
>
> That way, (b) and (c) have less performance impact, and one of them
> could be the default. And (a) being optional, could be fully supported
> like watchpoints by setting a breakpoint at the return PC, even though
> it has a performance hit (especially in the presence of recursion).
>
> And perhaps MI docs could even document this ;-)
If you want this functionality in GDB then I think you will have to contribute
it.