gdbserver: introduce threads_debug_printf, THREADS_SCOPED_DEBUG_ENTER_EXIT

Add the threads_debug_printf and THREADS_SCOPED_DEBUG_ENTER_EXIT, which
use the logging infrastructure from gdbsupport/common-debug.h.  Replace
all debug_print uses that are predicated by debug_threads with
threads_dethreads_debug_printf.  Replace uses of the debug_enter and
debug_exit macros with THREADS_SCOPED_DEBUG_ENTER_EXIT, which serves
essentially the same purpose, but allows showing what comes between the
enter and the exit in an indented form.

Note that "threads" debug is currently used for a bit of everything in
GDBserver, not only threads related stuff.  It should ideally be cleaned
up and separated logically as is done in GDB, but that's out of the
scope of this patch.

Change-Id: I2d4546464462cb4c16f7f1168c5cec5a89f2289a
This commit is contained in:
Simon Marchi
2022-01-16 21:27:58 -05:00
parent c68665c726
commit c058728c31
13 changed files with 483 additions and 798 deletions

View File

@ -1628,9 +1628,8 @@ add_insns (unsigned char *start, int len)
{
CORE_ADDR buildaddr = current_insn_ptr;
if (debug_threads)
debug_printf ("Adding %d bytes of insn at %s\n",
len, paddress (buildaddr));
threads_debug_printf ("Adding %d bytes of insn at %s",
len, paddress (buildaddr));
append_insns (&buildaddr, len, start);
current_insn_ptr = buildaddr;