[PATCH 06/30] Move get_object_address to dwarf_expr_context

Tom Tromey tom@tromey.com
Thu Jan 21 21:31:57 GMT 2021


>>>>> "Zoran" == Zoran Zaric via Gdb-patches <gdb-patches@sourceware.org> writes:

Zoran> Following the idea of merging the evaluators, the get_object_address
Zoran> and can be moved from dwarf_expr_executor and dwarf_evaluate_loc_desc
Zoran> classes to their base class dwarf_expr_context.

Zoran> gdb/ChangeLog:

Zoran> 	* dwarf2/expr.c (dwarf_expr_context::get_object_address): Move
Zoran> 	from dwarf_evaluate_loc_desc.
Zoran> 	(class dwarf_expr_context): Add object address member to
Zoran> 	dwarf_expr_context.
Zoran> 	* dwarf2/expr.h (dwarf_expr_context::get_frame_pc): Remove
Zoran> 	method.
Zoran> 	* dwarf2/frame.c (dwarf_expr_executor::get_object_address):
Zoran> 	Remove method.
Zoran> 	* dwarf2/loc.c (dwarf_evaluate_loc_desc::get_object_address):
Zoran> 	move to dwarf_expr_context.
Zoran> 	(class dwarf_evaluate_loc_desc): Move object address member to
Zoran> 	dwarf_expr_context.

Thank you.

Zoran> +  per_cu (nullptr),
Zoran> +  obj_address (0)

Another thing I forgot earlier is that gdb is usually using inline
initialization for things like this.
 
Zoran> +  /* Object address used for the evaluation.  */
Zoran> +  CORE_ADDR obj_address;

... so this could just be " = 0".
This could be applied in the other patches as well.

Otherwise this looks good to me.

Tom


More information about the Gdb-patches mailing list