[RFA] Remove make_cleanup_free_section_addr_info
Simon Marchi
simon.marchi@polymtl.ca
Fri Mar 16 03:29:00 GMT 2018
On 2018-03-15 10:44 PM, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
>
> Simon> Did you consider changing the section_addr_info struct to use entirely
> Simon> by an std::vector<other_sections>? Functions that return a
> Simon> section_addr_info could return a vector directly (by value? is that
> Simon> how we say it?), so we shouldn't need any custom unique pointer.
> Simon> Then, other_sections::name can be made into a string, removing the
> Simon> need to free it by hand.
>
> I didn't really consider it, but thanks for the idea. It turned out to
> be more invasive, but it did remove one weirdness from
> syms_from_objfile_1. Previously that function did:
>
> local_addr = alloc_section_addr_info (1);
>
> ... however, it doesn't actually need 1 entry -- the way this is set up,
> the minimum that can be requested is 1, but the returned
> section_addr_info actually has num_sections set to 0. Obscure!
>
> In the new code this is replaced by an empty vector.
>
> Let me know what you think. I did re-run this through the buildbot.
>
> One idea I had is that maybe other_sections should have a constructor.
> That would simplify some of the code.
Hi Tom,
I took a quick look, it LGTM, but indeed having a constructor in other_sections
would make it nicer IMO.
Simon
More information about the Gdb-patches
mailing list