[PATCH v2 2/2] gdb: change regcache list to be a map
Simon Marchi
simon.marchi@polymtl.ca
Fri Aug 7 15:26:49 GMT 2020
On 2020-08-07 10:35 a.m., Pedro Alves wrote:
> On 8/6/20 9:28 PM, Simon Marchi via Gdb-patches wrote:
>> - regcache *new_regcache = new regcache (target, gdbarch, aspace);
>
> ...
>
>> + /* It does not exist, create it. */
>> + regcache *new_regcache (new regcache (target, arch, aspace));
>
> I would prefer to keep using copy initialization here:
>
> /* It does not exist, create it. */
> regcache *new_regcache = new regcache (target, arch, aspace);
Woops, not sure why I wrote that. Probably because I tried to use a
regcache_up and went back to a regular pointer, because...
> Or maybe you mean to use regcache_up instead?
>
> regcache_up new_regcache (new regcache (target, arch, aspace));
The problem is we'd have to move the regcache_up into the new map entry:
ptid_regc_map.insert (std::make_pair (ptid, std::move (new_regcache)));
which means we'd need another temporary variable to hold the return value.
Using a plain pointer just seemed simpler, since the code is quite simple.
I'll push the patch with that fixed.
Simon
More information about the Gdb-patches
mailing list