Basic c++ification of varobj
authorSimon Marchi <simon.marchi@polymtl.ca>
Wed, 22 Nov 2017 20:08:05 +0000 (15:08 -0500)
committerSimon Marchi <simon.marchi@ericsson.com>
Wed, 22 Nov 2017 20:08:05 +0000 (15:08 -0500)
commit9e5b9d2b295d1771647a9e4bc942e398142ccf9b
treece91e5898a34b8b236602baf53b8c41c8b894d1f
parent2469b3c58447e98e073ffe7ab6c9627dbbd1aa81
Basic c++ification of varobj

This patch does a basic c++ification or the varobj data structure.

  - varobj: add constructor and destructor, initialize fields
  - varobj_root: initialize fields
  - varobj_dynamic: initialize fields

This allows getting rid of new_variable, new_root_variable.
free_variable essentially becomes varobj's destructor.  This also allows
getting rid of a cleanup, make_cleanup_free_variable, which was only
used in varobj_create in case the varobj creation fails.  It is replaced
with a unique_ptr.

gdb/ChangeLog:

* varobj.h (struct varobj): Add constructor and destructor,
initialize fields.
* varobj.c (struct varobj_root): Initialize fields.
(struct varobj_dynamic): Initialize fields.
(varobj_create): Use unique_ptr instead of cleanup.  Create
varobj with new instead of new_root_variable.
(delete_variable_1): Free variable with delete instead of
free_variable.
(create_child_with_value): Create variable with new instead of
new_variable.
(varobj::varobj): New.
(varobj::~varobj): New (body mostly coming from free_variable).
(new_variable): Remove.
(free_variable): Remove.
(do_free_variable_cleanup): Remove.
(make_cleanup_free_variable): Remove.
gdb/ChangeLog
gdb/varobj.c
gdb/varobj.h