Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Agovic, Sanimir" <sanimir.agovic@intel.com>
To: 'Mohsan Saleem' <mohsansaleem_ms@yahoo.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: RE: [PATCH] fix PR-12417
Date: Wed, 04 Sep 2013 08:58:00 -0000	[thread overview]
Message-ID: <0377C58828D86C4588AEEC42FC3B85A71766C229@IRSMSX105.ger.corp.intel.com> (raw)
In-Reply-To: <1378282781.96893.YahooMailNeo@web142604.mail.bf1.yahoo.com>

Some comments below. 

 -Sanimir

> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf
> Of Mohsan Saleem
> Sent: Wednesday, September 04, 2013 10:20 AM
> To: gdb-patches@sourceware.org
> Subject: Re: [PATCH] fix PR-12417
> 
> 
> Index: ./gdb/thread.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/thread.c,v
> retrieving revision 1.155
> diff -u -p -r1.155 thread.c
> --- ./gdb/thread.c    15 Jul 2013 11:14:32 -0000    1.155
> +++ ./gdb/thread.c    3 Sep 2013 02:36:11 -0000
> @@ -64,6 +64,7 @@ static void info_threads_command (char *
>   static void thread_apply_command (char *, int);
>   static void restore_current_thread (ptid_t);
>   static void prune_threads (void);
> +static const char *thread_name (struct thread_info *);
> 
>   /* Data to cleanup thread array.  */
> 
> @@ -78,6 +79,14 @@ struct thread_array_cleanup
>   };
> 
> 
> +const char *
> +thread_name (struct thread_info *ti)
>
Constify TI if possible.

> +{
> +  const char *name;
>
Newline between variable decl and first statement.

> +  name = ti->name != NULL ? ti->name : target_thread_name (ti);
>
A matter of taste, but I prefer explicit if/else
name = ti->name;
if (name == NULL) name = target_thread_name (ti);
if (name == NULL) name = "";


> @@ -251,7 +260,7 @@ add_thread_with_info (ptid_t ptid, struc
>     result->private = private;
> 
>     if (print_thread_events)
> -    printf_unfiltered (_("[New %s]\n"), target_pid_to_str (ptid));
> +    printf_unfiltered (_("[New %s \"%s\"\n"), target_pid_to_str (ptid), thread_name
>
This will print [New 1234 ""] in case a thread name is not available, not sure if we
should omit thread name instead.

> @@ -1456,7 +1466,9 @@ do_captured_thread_select (struct ui_out
> 
>     ui_out_text (uiout, "[Switching to thread ");
>     ui_out_field_int (uiout, "new-thread-id", pid_to_thread_id (inferior_ptid));
> -  ui_out_text (uiout, " (");
> +  ui_out_text (uiout, " \"");
> +  ui_out_text (uiout, thread_name (tp));
> +  ui_out_text (uiout, "\" (");
>     ui_out_text (uiout, target_pid_to_str (inferior_ptid));
>     ui_out_text (uiout, ")]");
> 
Is the thread name exposed via the MI protocol in some way?

 -Sanimir
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


  reply	other threads:[~2013-09-04  8:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <D5A5FA7510B2BE4089BC6266520C345F9D995C@EU-MBX-02.mgc.mentorg.com>
2013-08-28 16:24 ` Mohsan Saleem
2013-09-03  2:39   ` Mohsan Saleem
2013-09-04  8:19     ` Mohsan Saleem
2013-09-04  8:58       ` Agovic, Sanimir [this message]
2013-09-04 11:25         ` Mohsan Saleem
2013-09-04 12:24           ` Agovic, Sanimir
2013-09-17  4:18           ` Mohsan Saleem
2013-11-06 22:23             ` Tom Tromey
2014-02-14 10:41               ` Saleem, Mohsan
2014-05-15 19:03                 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0377C58828D86C4588AEEC42FC3B85A71766C229@IRSMSX105.ger.corp.intel.com \
    --to=sanimir.agovic@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mohsansaleem_ms@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox