gdb: change thread_info::name to unique_xmalloc_ptr, add helper function
authorSimon Marchi <simon.marchi@polymtl.ca>
Wed, 1 Sep 2021 16:19:30 +0000 (12:19 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Fri, 24 Sep 2021 21:25:55 +0000 (17:25 -0400)
commit25558938d07b61ad628952a7bdc0a793d27f1b71
tree1cce292b3623c2f8cecc2426bb2011dfe1716fba
parent7ebaa5f7821682c40e79ee1fdfe43528b7d87376
gdb: change thread_info::name to unique_xmalloc_ptr, add helper function

This started out as changing thread_info::name to a unique_xmalloc_ptr.
That showed that almost all users of that field had the same logic to
get a thread's name: use thread_info::name if non-nullptr, else ask the
target.  Factor out this logic in a new thread_name free function.  Make
the field private (rename to m_name) and add some accessors.

Change-Id: Iebdd95f4cd21fbefc505249bd1d05befc466a2fc
gdb/breakpoint.c
gdb/gdbthread.h
gdb/infrun.c
gdb/python/py-infthread.c
gdb/target.h
gdb/thread.c