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] |
Hi all, This is a patch that adds thread name printers to GDB. Like pretty-printers, they are Python classes that augment the output of thread names. gdb/ChangeLog: * data-directory/Makefile.in: Add gdb/thread_printing.py. * doc/gdb.texinfo: Add section about thread name printers in Python section. Add reference to thread name printers in 'info threads' section. * python/lib/gdb/__init__.py: Import ThreadNamePrinter. * python/lib/gdb/thread_printing.py: new file. (class ThreadNamePrinter): base class, contains helper functions and list of registered printers. (class ExamplePrinter): example printer class for reference. (class EnableThreadNamePrinter, DisableThreadNamePrinter, InfoThreadNamePrinter): gdb.commands for managing and getting information about thread name printers. (register_thread_name_printer_commands): Registers thread name printer commands. * python/py-inferior.c (add_thread_object): Save pointer to thread_object in thread_info. * python/py-infthread.c (prepare_thread_name_printers): Prepares all the registered thread name printers and returns a list of the printers. Called once by thread.c:print_thread_info. (thread_printer_enabled): Returns TRUE if printer enabled. (apply_thread_name_pretty_printers): Iterates through the list of printers calling print_thread until one returns a string. Called for each thread by thread.c:print_thread_info * python/python-internal.h: Extern gdbpy_print_thread_cst PyObject string object. * pyhon/python.c: Declare and assign gdbpy_print_thread_cst. * testsuite/gdb.python/Makefile.in: add py-threadprettyprint. * testsuite/gdb.python/py-threadprettyprint.c: Basic threaded program for testing thread name printing. * testsuite/gdb.python/py-threadprettyprint.exp: Tests for thread name printers. * thread.c (print_thread_info): Calls prepare_thread_name_printers to initialize printers and get list of printers. Calls apply_thread_name_pretty_printers for each thread if no name for thread is already stored. (_initialize_thread): Add aliases for 'info threads' to disambiguate between 'info thread-name-printer'
Attachment:
thread_name_printer.patch
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |