This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [PATCH] fix PR-12417
- From: "Saleem, Mohsan" <Mohsan_Saleem at mentor dot com>
- To: Tom Tromey <tromey at redhat dot com>, Mohsan Saleem <mohsansaleem_ms at yahoo dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, "palves at redhat dot com" <palves at redhat dot com>
- Date: Fri, 14 Feb 2014 10:40:52 +0000
- Subject: RE: [PATCH] fix PR-12417
- Authentication-results: sourceware.org; auth=none
- References: <521E2414 dot 40602 at codesourcery dot com> <52254BC6 dot 1050105 at codesourcery dot com> <1378282781 dot 96893 dot YahooMailNeo at web142604 dot mail dot bf1 dot yahoo dot com> <0377C58828D86C4588AEEC42FC3B85A71766C229 at IRSMSX105 dot ger dot corp dot intel dot com> <1378293943 dot 43616 dot YahooMailNeo at web142603 dot mail dot bf1 dot yahoo dot com> <1379391306 dot 56146 dot YahooMailNeo at web142602 dot mail dot bf1 dot yahoo dot com> <8738n91939 dot fsf at fleche dot redhat dot 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