From 43792cf0de3a49fb871d432343672bdf16270e99 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 13 Jan 2016 10:56:06 +0000 Subject: Centralize thread ID printing Add a new function to print a thread ID, in the style of paddress, plongest, etc. and adjust all CLI-reachable paths to use it. This gives us a single place to tweak to print inferior-qualified thread IDs later: - [Switching to thread 1 (Thread 0x7ffff7fc2740 (LWP 8155))] + [Switching to thread 1.1 (Thread 0x7ffff7fc2740 (LWP 8155))] etc., though for now, this has no user-visible change. No regressions on x86_64 Fedora 20. gdb/ChangeLog: 2016-01-13 Pedro Alves * breakpoint.c (remove_threaded_breakpoints) (print_one_breakpoint_location): Use print_thread_id. * btrace.c (btrace_enable, btrace_disable, btrace_teardown) (btrace_fetch, btrace_clear): Use print_thread_id. * common/print-utils.c (CELLSIZE): Delete. (get_cell): Rename to ... (get_print_cell): ... this and made extern. Adjust call callers. Adjust to use PRINT_CELL_SIZE. * common/print-utils.h (get_print_cell): Declare. (PRINT_CELL_SIZE): New. * gdbthread.h (print_thread_id): Declare. * infcmd.c (signal_command): Use print_thread_id. * inferior.c (print_inferior): Use print_thread_id. * infrun.c (handle_signal_stop) (insert_exception_resume_breakpoint) (insert_exception_resume_from_probe) (print_signal_received_reason): Use print_thread_id. * record-btrace.c (record_btrace_info) (record_btrace_resume_thread, record_btrace_cancel_resume) (record_btrace_step_thread, record_btrace_wait): Use print_thread_id. * thread.c (thread_apply_all_command): Use print_thread_id. (print_thread_id): New function. (thread_apply_command): Use print_thread_id. (thread_command, thread_find_command, do_captured_thread_select): Use print_thread_id. --- gdb/common/print-utils.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gdb/common/print-utils.h') diff --git a/gdb/common/print-utils.h b/gdb/common/print-utils.h index 706877b..8790d0b 100644 --- a/gdb/common/print-utils.h +++ b/gdb/common/print-utils.h @@ -20,6 +20,10 @@ #ifndef COMMON_CELLS_H #define COMMON_CELLS_H +/* How many characters (including the terminating null byte) fit in a + cell. */ +#define PRINT_CELL_SIZE 50 + /* %d for LONGEST. The result is stored in a circular static buffer, NUMCELLS deep. */ @@ -71,4 +75,8 @@ extern const char *host_address_to_string_1 (const void *addr); #define host_address_to_string(ADDR) \ host_address_to_string_1 ((const void *) (ADDR)) +/* Return the next entry in the circular print buffer. */ + +extern char *get_print_cell (void); + #endif /* COMMON_CELLS_H */ -- cgit v1.1