Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Saleem, Mohsan" <Mohsan_Saleem@mentor.com>
To: Tom Tromey <tromey@redhat.com>,
	Mohsan Saleem <mohsansaleem_ms@yahoo.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	"palves@redhat.com" <palves@redhat.com>
Subject: RE: [PATCH] fix PR-12417
Date: Fri, 14 Feb 2014 10:41:00 -0000	[thread overview]
Message-ID: <D5A5FA7510B2BE4089BC6266520C345FABDEBA@EU-MBX-04.mgc.mentorg.com> (raw)
In-Reply-To: <8738n91939.fsf@fleche.redhat.com>

Hi Everyone,
>>Mohsan> +const char *
>>Mohsan> +thread_name (struct thread_info *ti) {

>>This needs an introductory comment.
Ok

>>Mohsan>    if (print_thread_events)
>>Mohsan> -    printf_unfiltered (_("[New %s]\n"), target_pid_to_str (ptid));
>>Mohsan> +    printf_unfiltered (_("[New %s \"%s\"]\n"), 
>>Mohsan> + target_pid_to_str (ptid), thread_name (result));

>>This line is too long.
>>Also, I think the output will be weird if the thread does not have a name.
What I'm supposed to do about line length?
Any thread without a name is automatically assigned with the program name argv[0]. So Empty string could not be a problem here.


>>Two thoughts come to mind for the patch.

>>First, perhaps a single function for emitting the thread description would be better.  Then it could be normalized across all of gdb.
>>Second, it would be nice to use ui-out properly in such a function, so that MI can see the thread name distinctly from the other bits.

Sorry, I didn't got your point here. Could you please elaborate it a little more, as I am new to GDB.


-----Original Message-----
From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Tom Tromey
Sent: Thursday, November 07, 2013 3:04 AM
To: Mohsan Saleem
Cc: gdb-patches@sourceware.org; palves@redhat.com
Subject: Re: [PATCH] fix PR-12417

>>>>> "Mohsan" == Mohsan Saleem <mohsansaleem_ms@yahoo.com> writes:

Mohsan> 2013-09-04  Mohsan Saleem  <msaleem@codesourcery.com>
Mohsan>     PR threads/12417
Mohsan>     * thread.c (thread_name): New function.
Mohsan>     (add_thread_with_info): Update to print thread name.
Mohsan>     (thread_apply_all_command): Likewise.
Mohsan>     (thread_apply_command): Likewise.
Mohsan>     (thread_find_command): Likewise.
Mohsan>     (do_captured_thread_select): Likewise.

Thanks.
 
Mohsan> +const char *
Mohsan> +thread_name (struct thread_info *ti) {

This needs an introductory comment.

Mohsan>    if (print_thread_events)
Mohsan> -    printf_unfiltered (_("[New %s]\n"), target_pid_to_str (ptid));
Mohsan> +    printf_unfiltered (_("[New %s \"%s\"]\n"), 
Mohsan> + target_pid_to_str (ptid), thread_name (result));

This line is too long.
Also, I think the output will be weird if the thread does not have a name.

Mohsan> +            printf_filtered (_("\nThread %d \"%s\" (%s):\n"),
Mohsan> +                             tp_array[k]->num,
Mohsan> +                             thread_name (tp_array[k]),
Mohsan> +                             target_pid_to_str 
Mohsan> + (inferior_ptid));

Likewise concerning the no-name case.

Mohsan> +	  printf_filtered (_("\nThread %d \"%s\" (%s):\n"), tp->num, 
Mohsan> +thread_name (tp),

Too long, plus no-name.

Mohsan>    ui_out_text (uiout, "[Switching to thread ");
Mohsan>    ui_out_field_int (uiout, "new-thread-id", pid_to_thread_id 
Mohsan> (inferior_ptid));
Mohsan> -  ui_out_text (uiout, " (");
Mohsan> +  ui_out_text (uiout, " \"");
Mohsan> +  ui_out_text (uiout, thread_name (tp));  ui_out_text (uiout, 
Mohsan> + "\" (");
Mohsan>    ui_out_text (uiout, target_pid_to_str (inferior_ptid));
Mohsan>    ui_out_text (uiout, ")]");

Two thoughts come to mind for the patch.

First, perhaps a single function for emitting the thread description would be better.  Then it could be normalized across all of gdb.

Second, it would be nice to use ui-out properly in such a function, so that MI can see the thread name distinctly from the other bits.

Tom

  reply	other threads:[~2014-02-14 10:41 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
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 [this message]
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=D5A5FA7510B2BE4089BC6266520C345FABDEBA@EU-MBX-04.mgc.mentorg.com \
    --to=mohsan_saleem@mentor.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mohsansaleem_ms@yahoo.com \
    --cc=palves@redhat.com \
    --cc=tromey@redhat.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