gdb/dwarf: remove cutu_reader::keep, add cutu_reader::release_cu

This is a bit subjective, but I often struggle to understand what
cutu_reader::keep is meant to do (keep what, where).  Perhaps it's just
a question of bad naming, but I think it's a bit confusing for
cutu_reader to transfer the ownership of the dwarf2_cu to the
per_objfile directly.

Add the cutu::release_cu method and make the caller of cutu_reader
transfer the ownership to the per_objfile object.

Right now, it is theoretically possible for release_cu to return
nullptr, so I made callers check the return value.  A patch later in
this series will change release_cu to ensure it always return
non-nullptr, so those callers will get simplified.

Change-Id: I3103ff894d1654a95c9d69001073c218501c988a
Approved-By: Tom Tromey <tom@tromey.com>
2 files changed