Re: [PATCH v2 3/4] gdb: dwarf2 generic implementation for caching function data

Tom Tromey
2022-12-20T21:29:54Z

>>>>> "Torbjorn" == Torbjorn SVENSSON via Gdb-patches <gdb-patches@sourceware.org> writes:

>> + fn_data = FRAME_OBSTACK_ZALLOC (struct dwarf2_frame_fn_data);
>> + fn_data->fn = fn;
>> + fn_data->data = frame_obstack_zalloc (size);

Torbjorn> Since these 2 blocks (fn_data and fn_data->fn) are allocated on the
Torbjorn> obstack, do we need to release them in dwarf2_frame_dealloc_cache() or
Torbjorn> just leave them to the generic garbage collection?

They can just be left. The obstack as a whole is destroyed at once.
However, you probably should consider the lifetime management of the
data that's attached to the frame. That said, it's fine if the answer
is that they should be allocated on the obstack as well.

Tom