This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [PATCH] Print thread name when executing thread commands
- From: "Agovic, Sanimir" <sanimir dot agovic at intel dot com>
- To: "'pat dot pannuto at gmail dot com'" <pat dot pannuto at gmail dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Mon, 23 Sep 2013 12:18:24 +0000
- Subject: RE: [PATCH] Print thread name when executing thread commands
- Authentication-results: sourceware.org; auth=none
- References: <CA+Yp1NUTX7fQ4eq_LyGfR3JwRzOoEsT8dAFwX+WwFA9gaA22KQ at mail dot gmail dot com> <alpine dot DEB dot 2 dot 00 dot 1309180856200 dot 2394 at lnxricardw dot se dot axis dot com> <CA+Yp1NUY9CWW3L7U8D-hj7q4RLfgxJB9g4-YdDrF+US3=nfdsg at mail dot gmail dot com>
Hello Pat,
please have a look at https://sourceware.org/ml/gdb-patches/2013-09/msg00485.html
A question below.
-Sanimir
> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf
> Of Pat Pannuto
> Sent: Wednesday, September 18, 2013 08:37 PM
> To: Ricard Wanderlof
> Cc: gdb-patches@sourceware.org
> Subject: Re: [PATCH] Print thread name when executing thread commands
>
> $ cat print_thread_names.diff
> Index: gdb/thread.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/thread.c,v
> retrieving revision 1.157
> diff -u -p -r1.157 thread.c
> --- gdb/thread.c 17 Sep 2013 18:26:39 -0000 1.157
> +++ gdb/thread.c 18 Sep 2013 18:31:15 -0000
> @@ -1255,10 +1255,14 @@ thread_apply_all_command (char *cmd, int
> for (k = 0; k != i; k++)
> if (thread_alive (tp_array[k]))
> {
> + char *name;
> switch_to_thread (tp_array[k]->ptid);
> - printf_filtered (_("\nThread %d (%s):\n"),
> + name = tp_array[k]->name ? tp_array[k]->name
> + : target_thread_name (tp_array[k]);
>
What happens if a thread changes its name during execution, do we get the
cached or the actual thread name? It looks to me as we should never directly
access the thread_info::name member, or?
Btw, a testcase would be great.
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052