diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-09-01 12:19:30 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-09-24 17:25:55 -0400 |
commit | 25558938d07b61ad628952a7bdc0a793d27f1b71 (patch) | |
tree | 1cce292b3623c2f8cecc2426bb2011dfe1716fba /gdb/breakpoint.c | |
parent | 7ebaa5f7821682c40e79ee1fdfe43528b7d87376 (diff) | |
download | gdb-25558938d07b61ad628952a7bdc0a793d27f1b71.zip gdb-25558938d07b61ad628952a7bdc0a793d27f1b71.tar.gz gdb-25558938d07b61ad628952a7bdc0a793d27f1b71.tar.bz2 |
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
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r-- | gdb/breakpoint.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 10b28c9..3b626b8 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -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 (" \""); |