mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 09:08:59 +00:00
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
This commit is contained in:
@@ -4565,13 +4565,12 @@ maybe_print_thread_hit_breakpoint (struct ui_out *uiout)
|
||||
|
||||
if (show_thread_that_caused_stop ())
|
||||
{
|
||||
const char *name;
|
||||
struct thread_info *thr = inferior_thread ();
|
||||
|
||||
uiout->text ("Thread ");
|
||||
uiout->field_string ("thread-id", print_thread_id (thr));
|
||||
|
||||
name = thr->name != NULL ? thr->name : target_thread_name (thr);
|
||||
const char *name = thread_name (thr);
|
||||
if (name != NULL)
|
||||
{
|
||||
uiout->text (" \"");
|
||||
|
||||
Reference in New Issue
Block a user