-var-info-path-expression

Vladimir Prus ghost@cs.msu.su
Mon Dec 25 09:02:00 GMT 2006


This patch implements new MI command, -var-info-path-expression,
that, given a variable object, returns full expression that corresponds
to it.  Both KDevelop and Eclipse have now code that guesses such
full expression, and that code is rather hacky, and not exactly correct.

Moreover, as soon as MI is taught to get the true type 
polymorphic C++ objects and display fields of the real type, such full expression 
cannot be computed in frontend at all.

The essence of this patch -- which expressions are returned in which cases -- are
ported without change from the Apple branch. The code structure is much
different though -- this patch capitalizes on MI refactoring patches I've posted
recently.

This is lightly tested by hand, I'll write automated tests later. There's no docs
either -- again, will be written after discussion.

There is a couple of issues with this patch:

	- I don't much like 'var-info-path-expression' name, but
	naming of MI commands is not very important.
	- I'm not sure why we can't report full expression in the
	output of -var-list-children. The code I have does not seem
	very computationally expensive.

Comments are appreciated.

- Volodya

	Implement -var-info-path-expression.
	* mi/mi-cmds.h (mi_cmd_var_info_path_expression):
	Declare.
	* mi/mi-cmds.c (mi_cmds): Register var-info-path-expression.
	* mi/mi-cmd-var.c (mi_cmd_var_info_path_expression): New.
	* varobj.c (struct varobj): New field 'path_expr'.
	(c_path_expr_of_child, cplus_path_expr_of_child)
	(java_path_expr_of_child): New.
	(struct language_specific): New field path_expr_of_child.
	(varobj_create): Initialize the path_expr field.
	(varobj_get_path_expr): New.
	(new_variable): Initialize the path_expr field.
	(free_variable): Free the path_expr field.
	(adjust_value_for_children_access): New parameter
	WAS_TYPE.
	(c_number_of_children): Adjust.
	(c_describe_child): New parameter CFULL_EXPRESSION.
	Compute full expression.
	(c_value_of_child, c_type_of_child): Adjust.
	(cplus_number_of_children): Adjust.
	(cplus_describe_child): New parameter CFULL_EXPRESSION.
	Compute full expression.
	(cplus_name_of_child, cplus_value_of_child)
	(cplus_type_of_child): Adjust.
	* varobj.h (varobj_get_path_expr): Declare.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: path_expression__gdb_mainline.diff
Type: text/x-diff
Size: 16939 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20061225/d5ed53b4/attachment.bin>


More information about the Gdb-patches mailing list