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]

[patch] info threads sort by name and name regex matching


Hello all,

Here is a patch for adding sorting by name in 'info threads' and regex
pattern matching of thread names for filtering threads.

With this patch sorting by name will happen always. (Perhaps a switch
to enable sorting would be better?)

Regex matching is specified by doing 'info threads r<regex>'. This is
not ambiguous with previous behavior where parameters to info threads
were only numbers. (spaces between 'r' and <regex> are ignored)

e.g. info threads r ^name_prefix

Regards,

gdb/ChangeLog:
    * gdbthread.h: Add char *cached_name to struct thread_info for use
when sorting.
    * thread.c: #include <stdlib.h>.
    (thread_list_size): New global.
    (init_Thread_list): Initialize it.
    (free_thread): Decrement it.
    (new_thread): Increment it.
    (print_thread_filter_check): New function.
    (print_thread_sort_cmp): New function.
    (print_thread_info_single): New function.
    (print_thread_info): Sort threads by name and filter by regex match.

    testsuite/
    * gdb.threads/Makefile.in (EXECUTABLES): Add info-thread-sort-regex.
    * gdb.threads/info-thread-sort-regex.c: New file.
    * gdb.threads/info-thread-sort-regex.exp: New file.

    doc/
    * gdb.texinfo (Threads): Add information about sorting and regex parameters.

Attachment: info_threads_sort_and_regex.patch
Description: Binary data


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