public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFA 00/12] (somewhat) clean up struct value ownership
@ 2018-04-05 21:16 Tom Tromey
  2018-04-05 21:16 ` [RFA 12/12] Change value::contents to be a unique_xmalloc_ptr Tom Tromey
                   ` (12 more replies)
  0 siblings, 13 replies; 22+ messages in thread
From: Tom Tromey @ 2018-04-05 21:16 UTC (permalink / raw)
  To: gdb-patches

struct value has long suffered from a complicated approach to
ownership.  In particular, values are reference counted, but they are
also handled specially if they are on the "value chain".  I believe
this has led to bugs on occasion; and anyway requires oddities like
release_value_or_incref.

This series goes some way toward cleaning up ownership for values.  It
introduces a gdb_ref_ptr specialization for values and then changes
various things to use it.  After this, it cleans up various code doing
manual memory mangement related to value; and in particular unifies
the value chain with the reference counting mechanism.

There is still more work that could be done in this area.  For
example:

* struct lval_funcs could be turned into a base class and then the
  implementers rewritten as ordinary objects.

* Likewise struct internalvar_funcs; and this would allow better type
  safety through the removal of union internalvar_data.

* Perhaps the "location" union could be removed from struct value,
  also providing more type safety.

However, I didn't do these, as this series seemed to reach a
reasonable stopping point.

Regression tested by the buildbot.

Tom

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2018-04-08 21:32 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-05 21:16 [RFA 00/12] (somewhat) clean up struct value ownership Tom Tromey
2018-04-05 21:16 ` [RFA 12/12] Change value::contents to be a unique_xmalloc_ptr Tom Tromey
2018-04-05 21:16 ` [RFA 05/12] Change value history to use value_ref_ptr Tom Tromey
2018-04-05 21:16 ` [RFA 01/12] Introduce a gdb_ref_ptr specialization for struct value Tom Tromey
2018-04-06 19:29   ` Pedro Alves
2018-04-05 21:16 ` [RFA 09/12] Use new and delete for values Tom Tromey
2018-04-05 21:16 ` [RFA 03/12] Change last_examine_value to value_ref_ptr Tom Tromey
2018-04-05 21:16 ` [RFA 11/12] Remove range_s VEC Tom Tromey
2018-04-05 21:16 ` [RFA 07/12] Remove free_value_chain Tom Tromey
2018-04-05 21:16 ` [RFA 02/12] Change breakpoints to use value_ref_ptr Tom Tromey
2018-04-06 19:31   ` Pedro Alves
2018-04-06 21:31     ` Tom Tromey
2018-04-05 21:16 ` [RFA 08/12] Remove value::next and value::released Tom Tromey
2018-04-06 19:32   ` Pedro Alves
2018-04-06 21:40     ` Tom Tromey
2018-04-05 21:16 ` [RFA 06/12] Remove free_all_values Tom Tromey
2018-04-05 21:16 ` [RFA 10/12] Change value::parent to a value_ref_ptr Tom Tromey
2018-04-05 21:16 ` [RFA 04/12] Change varobj to use value_ref_ptr Tom Tromey
2018-04-06 19:33 ` [RFA 00/12] (somewhat) clean up struct value ownership Pedro Alves
2018-04-06 21:20   ` Tom Tromey
2018-04-06 21:44   ` Tom Tromey
2018-04-08 21:32   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).