This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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)
Mohsan> +{

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"), 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 (inferior_ptid));

Likewise concerning the no-name case.

Mohsan> +	  printf_filtered (_("\nThread %d \"%s\" (%s):\n"), tp->num, 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 (inferior_ptid));
Mohsan> -  ui_out_text (uiout, " (");
Mohsan> +  ui_out_text (uiout, " \"");
Mohsan> +  ui_out_text (uiout, thread_name (tp));
Mohsan> +  ui_out_text (uiout, "\" (");
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]