Re: MI/C++/references fixup

Daniel Jacobowitz
2006-11-29T14:01:33Z

On Wed, Nov 29, 2006 at 12:15:21PM +0300, Vladimir Prus wrote:
> We discussed this at length some time ago:
>
> http://thread.gmane.org/gmane.comp.gdb.patches/28414/
>
> The conclusion was that this "address prefix" is not necessary. In fact, both
> KDevelop and Eclipse explicitly remove it. Back then, it was decided that
> change would be hard. But recent varobj refactorings make this change
> straight-forward.

Did we? I believe you, but I can't find it in the thread, and I don't
remember.

> + /* We are not interested in address of references, and given
> + that in C++ reference is not rebindable, it cannot
> + meaningfully change. So, get hold of the real value. */

in the address of a reference, in C++ a reference.

In C++ it can't meaningfully change. In a program, though, it can;
once when it's initialized, and again if something scribbles on the
stack. And that might be what you're trying to debug. So, I'm
a little wary of this; it seems to me that we ought to check for both
changes in the address and value (sort of like we do for watchpoints).

Per your other message, I'd rather not check in the patch without this;
want me to try it?

> mi_gdb_test "200-break-insert $func" \
> - "200\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"$func\",file=\".*\",line=\"\[0-9\]*\",times=\"0\"\}" \
> + "200\\^done,bkpt=\{number=\"\[0-9\]+\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"$func\(\\\(\\\)\)?\",file=\".*\",line=\"\[0-9\]*\",times=\"0\"\}" \
> "breakpoint at $func"

Probably ought to allow (.*) for the function in case it has arguments
(or the C++ demangler gives us back a (void)).

> +proc mi_check_varobj_value { name value } {
> +
> + mi_gdb_test "-var-evaluate-expression $name" \
> + "\\^done,value=\"$value\"" \
> + "-var-evaluate-expression $name: expect $value"
> +}
> \ No newline at end of file

Please add newline :-)

> # Copyright 2002, 2003 Free Software Foundation, Inc.

And update copyright years.

> # Please email any bugs, comments, and/or additions to this file to:
> # bug-gdb@prep.ai.mit.edu

And skip that. We really should remove it from every file.

And copyright message on new tests please.

--
Daniel Jacobowitz
CodeSourcery