public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 1/4] gdb: make target debug functions return std::string
@ 2024-04-19 19:46 Simon Marchi
  2024-04-19 19:46 ` [PATCH v2 2/4] gdb: make debug_target use one-liners Simon Marchi
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Simon Marchi @ 2024-04-19 19:46 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

From: Simon Marchi <simon.marchi@efficios.com>

Change the functions in target-debug.h to return string representations
in an std::string, such that they don't need to know how the printing
part is done.  This also helps the following patch that makes the debug
prints in debug_target one-liners.

Update target-delegates.c (through make-target-delegates.py) to do the
printing.

Add an overload of gdb_puts to avoid using `.c_str ()`.

Change-Id: I55cbff1c1b03a3b24a81740e34c6ad41ac4f8453
---
 gdb/make-target-delegates.py |   5 +-
 gdb/target-debug.h           | 339 ++++++++++++++---------------
 gdb/target-delegates.c       | 404 +++++++++++++++++------------------
 gdb/utils.c                  |   6 +
 gdb/utils.h                  |   2 +
 5 files changed, 379 insertions(+), 377 deletions(-)

diff --git a/gdb/make-target-delegates.py b/gdb/make-target-delegates.py
index 1893fc63ca84..051efce94dab 100755
--- a/gdb/make-target-delegates.py
+++ b/gdb/make-target-delegates.py
@@ -301,7 +301,10 @@ def write_debugmethod(
         if i > 0:
             print('  gdb_puts (", ", gdb_stdlog);', file=f)
         printer = munge_type(argtypes[i])
-        print("  " + printer + " (" + names[i] + ");", file=f)
+        print(
+            "  gdb_puts (" + printer + " (" + names[i] + "), gdb_stdlog);",
+            file=f,
+        )
     if return_type != "void":
         print('  gdb_puts (") = ", gdb_stdlog);', file=f)
         printer = munge_type(return_type)
diff --git a/gdb/target-debug.h b/gdb/target-debug.h
index 801b96298c5f..efe695e07690 100644
--- a/gdb/target-debug.h
+++ b/gdb/target-debug.h
@@ -49,337 +49,324 @@
    that any function not used by target-delegates.c (the only user of this file)
    will be flagged as unused.  */
 
-static void
-target_debug_do_print (const char *s)
-{ gdb_puts (s, gdb_stdlog); }
-
-static void
+static std::string
 target_debug_print_target_object (target_object object)
-{ target_debug_do_print (plongest (object)); }
+{ return plongest (object); }
 
-static void
+static std::string
 target_debug_print_CORE_ADDR (CORE_ADDR addr)
-{ target_debug_do_print (core_addr_to_string (addr)); }
+{ return core_addr_to_string (addr); }
 
-static void
+static std::string
 target_debug_print_const_char_p (const char *s)
-{ target_debug_do_print (s != nullptr ? s : "(null)"); }
+{ return s != nullptr ? s : "(null)"; }
 
-static void
+static std::string
 target_debug_print_int (int v)
-{ target_debug_do_print (plongest (v)); }
+{ return plongest (v); }
 
-static void
+static std::string
 target_debug_print_bool (bool v)
-{ target_debug_do_print (v ? "true" : "false"); }
+{ return v ? "true" : "false"; }
 
-static void
+static std::string
 target_debug_print_long (long v)
-{ target_debug_do_print (plongest (v)); }
+{ return plongest (v); }
 
-static void
+static std::string
 target_debug_print_target_xfer_status (target_xfer_status status)
-{ target_debug_do_print (plongest (status)); }
+{ return plongest (status); }
 
-static void
+static std::string
 target_debug_print_exec_direction_kind (exec_direction_kind kind)
-{ target_debug_do_print (plongest (kind)); }
+{ return plongest (kind); }
 
-static void
+static std::string
 target_debug_print_trace_find_type (trace_find_type type)
-{ target_debug_do_print (plongest (type)); }
+{ return plongest (type); }
 
-static void
+static std::string
 target_debug_print_btrace_read_type (btrace_read_type type)
-{ target_debug_do_print (plongest (type)); }
+{ return plongest (type); }
 
-static void
+static std::string
 target_debug_print_btrace_error (btrace_error error)
-{ target_debug_do_print (plongest (error)); }
+{ return plongest (error); }
 
-static void
+static std::string
 target_debug_print_ptid_t (ptid_t ptid)
-{ target_debug_do_print (plongest (ptid.pid ())); }
+{ return plongest (ptid.pid ()); }
 
-static void
+static std::string
 target_debug_print_gdbarch_p (gdbarch *arch)
-{ target_debug_do_print (gdbarch_bfd_arch_info (arch)->printable_name); }
+{ return gdbarch_bfd_arch_info (arch)->printable_name; }
 
-static void
+static std::string
 target_debug_print_const_gdb_byte_p (const gdb_byte *p)
-{ target_debug_do_print (host_address_to_string (p)); }
+{ return host_address_to_string (p); }
 
-static void
+static std::string
 target_debug_print_gdb_byte_p (gdb_byte *p)
-{ target_debug_do_print (host_address_to_string (p)); }
+{ return host_address_to_string (p); }
 
-static void
+static std::string
 target_debug_print_const_gdb_byte_pp (const gdb_byte **p)
-{ target_debug_do_print (host_address_to_string (*p)); }
+{ return host_address_to_string (*p); }
 
-static void
+static std::string
 target_debug_print_gdb_signal (gdb_signal sig)
-{ target_debug_do_print (gdb_signal_to_name (sig)); }
+{ return gdb_signal_to_name (sig); }
 
-static void
+static std::string
 target_debug_print_ULONGEST (ULONGEST v)
-{ target_debug_do_print (hex_string (v)); }
+{ return hex_string (v); }
 
-static void
+static std::string
 target_debug_print_ULONGEST_p (ULONGEST *p)
-{ target_debug_do_print (hex_string (*p)); }
+{ return hex_string (*p); }
 
-static void
+static std::string
 target_debug_print_LONGEST (LONGEST v)
-{ target_debug_do_print (phex (v, 0)); }
+{ return phex (v, 0); }
 
-static void
+static std::string
 target_debug_print_LONGEST_p (LONGEST *p)
-{ target_debug_do_print (phex (*p, 0)); }
+{ return phex (*p, 0); }
 
-static void
+static std::string
 target_debug_print_bp_target_info_p (bp_target_info *bp)
-{ target_debug_do_print (core_addr_to_string (bp->placed_address)); }
+{ return core_addr_to_string (bp->placed_address); }
 
-static void
+static std::string
 target_debug_print_expression_p (expression *exp)
-{ target_debug_do_print (host_address_to_string (exp)); }
+{ return host_address_to_string (exp); }
 
-static void
+static std::string
 target_debug_print_CORE_ADDR_p (CORE_ADDR *p)
-{ target_debug_do_print (core_addr_to_string (*p)); }
+{ return core_addr_to_string (*p); }
 
-static void
+static std::string
 target_debug_print_int_p (int *p)
-{ target_debug_do_print (plongest (*p)); }
+{ return plongest (*p); }
 
-static void
+static std::string
 target_debug_print_regcache_p (regcache *regcache)
-{ target_debug_do_print (host_address_to_string (regcache)); }
+{ return host_address_to_string (regcache); }
 
-static void
+static std::string
 target_debug_print_thread_info_p (thread_info *thread)
-{ target_debug_do_print (host_address_to_string (thread)); }
+{ return host_address_to_string (thread); }
 
-static void
+static std::string
 target_debug_print_ui_file_p (ui_file *file)
-{ target_debug_do_print (host_address_to_string (file)); }
+{ return host_address_to_string (file); }
 
-static void
+static std::string
 target_debug_print_const_std_vector_target_section_p
   (const std::vector<target_section> *vec)
-{ target_debug_do_print (host_address_to_string (vec->data ())); }
+{ return host_address_to_string (vec->data ()); }
 
-static void
+static std::string
 target_debug_print_void_p (void *p)
-{ target_debug_do_print (host_address_to_string (p)); }
+{ return host_address_to_string (p); }
 
-static void
+static std::string
 target_debug_print_find_memory_region_ftype (find_memory_region_ftype func)
-{ target_debug_do_print (host_address_to_string (func)); }
+{ return host_address_to_string (func); }
 
-static void
+static std::string
 target_debug_print_bfd_p (bfd *bfd)
-{ target_debug_do_print (host_address_to_string (bfd)); }
+{ return host_address_to_string (bfd); }
 
-static void
+static std::string
 target_debug_print_std_vector_mem_region (const std::vector<mem_region> &vec)
-{ target_debug_do_print (host_address_to_string (vec.data ())); }
+{ return host_address_to_string (vec.data ()); }
 
-static void
+static std::string
 target_debug_print_std_vector_static_tracepoint_marker
   (const std::vector<static_tracepoint_marker> &vec)
-{ target_debug_do_print (host_address_to_string (vec.data ())); }
+{ return host_address_to_string (vec.data ()); }
 
-static void
+static std::string
 target_debug_print_const_target_desc_p (const target_desc *tdesc)
-{ target_debug_do_print (host_address_to_string (tdesc)); }
+{ return host_address_to_string (tdesc); }
 
-static void
+static std::string
 target_debug_print_bp_location_p (bp_location *loc)
-{ target_debug_do_print (host_address_to_string (loc)); }
+{ return host_address_to_string (loc); }
 
-static void
+static std::string
 target_debug_print_const_trace_state_variable_r
   (const trace_state_variable &tsv)
-{ target_debug_do_print (host_address_to_string (&tsv)); }
+{ return host_address_to_string (&tsv); }
 
-static void
+static std::string
 target_debug_print_trace_status_p (trace_status *status)
-{ target_debug_do_print (host_address_to_string (status)); }
+{ return host_address_to_string (status); }
 
-static void
+static std::string
 target_debug_print_tracepoint_p (tracepoint *tp)
-{ target_debug_do_print (host_address_to_string (tp)); }
+{ return host_address_to_string (tp); }
 
-static void
+static std::string
 target_debug_print_uploaded_tp_p (uploaded_tp *tp)
-{ target_debug_do_print (host_address_to_string (tp)); }
+{ return host_address_to_string (tp); }
 
-static void
+static std::string
 target_debug_print_uploaded_tp_pp (uploaded_tp **v)
-{ target_debug_do_print (host_address_to_string (*v)); }
+{ return host_address_to_string (*v); }
 
-static void
+static std::string
 target_debug_print_uploaded_tsv_pp (uploaded_tsv **tsv)
-{ target_debug_do_print (host_address_to_string (tsv)); }
+{ return host_address_to_string (tsv); }
 
-static void
+static std::string
 target_debug_print_static_tracepoint_marker_p (static_tracepoint_marker *marker)
-{ target_debug_do_print (host_address_to_string (marker)); }
+{ return host_address_to_string (marker); }
 
-static void
+static std::string
 target_debug_print_btrace_target_info_p (btrace_target_info *info)
-{ target_debug_do_print (host_address_to_string (info)); }
+{ return host_address_to_string (info); }
 
-static void
+static std::string
 target_debug_print_const_frame_unwind_p (const frame_unwind *fu)
-{ target_debug_do_print (host_address_to_string (fu)); }
+{ return host_address_to_string (fu); }
 
-static void
+static std::string
 target_debug_print_btrace_data_p (btrace_data *data)
-{ target_debug_do_print (host_address_to_string (data)); }
+{ return host_address_to_string (data); }
 
-static void
+static std::string
 target_debug_print_record_method (record_method method)
-{ target_debug_do_print (plongest (method)); }
+{ return plongest (method); }
 
-static void
+static std::string
 target_debug_print_const_btrace_config_p (const btrace_config *config)
-{ target_debug_do_print (host_address_to_string (config)); }
+{ return host_address_to_string (config); }
 
-static void
+static std::string
 target_debug_print_const_btrace_target_info_p (const btrace_target_info *info)
-{ target_debug_do_print (host_address_to_string (info)); }
+{ return host_address_to_string (info); }
 
-static void
+static std::string
 target_debug_print_target_hw_bp_type (target_hw_bp_type type)
-{ target_debug_do_print (plongest (type)); }
+{ return plongest (type); }
 
-static void
+static std::string
 target_debug_print_bptype (bptype type)
-{ target_debug_do_print (plongest (type)); }
+{ return plongest (type); }
 
-static void
+static std::string
 target_debug_print_inferior_p (inferior *inf)
-{ target_debug_do_print (host_address_to_string (inf)); }
+{ return host_address_to_string (inf); }
 
-static void
+static std::string
 target_debug_print_remove_bp_reason (remove_bp_reason reason)
-{ target_debug_do_print (plongest (reason)); }
+{ return plongest (reason); }
 
-static void
+static std::string
 target_debug_print_gdb_disassembly_flags (gdb_disassembly_flags flags)
-{ target_debug_do_print (plongest (flags)); }
+{ return plongest (flags); }
 
-static void
+static std::string
 target_debug_print_traceframe_info_up (std::unique_ptr<traceframe_info> &info)
-{ target_debug_do_print (host_address_to_string (info.get ())); }
+{ return host_address_to_string (info.get ()); }
 
-static void
+static std::string
 target_debug_print_gdb_array_view_const_int
   (const gdb::array_view<const int> &view)
-{ target_debug_do_print (host_address_to_string (view.data ())); }
+{ return host_address_to_string (view.data ()); }
 
-static void
+static std::string
 target_debug_print_record_print_flags (record_print_flags flags)
-{ target_debug_do_print (plongest (flags)); }
+{ return plongest (flags); }
 
-static void
+static std::string
 target_debug_print_thread_control_capabilities (thread_control_capabilities cap)
-{ target_debug_do_print (plongest (cap)); }
+{ return plongest (cap); }
 
-static void
+static std::string
 target_debug_print_std_string (const std::string &str)
-{ target_debug_do_print (str.c_str ()); }
+{ return str.c_str (); }
 
-static void
+static std::string
 target_debug_print_gdb_unique_xmalloc_ptr_char
   (const gdb::unique_xmalloc_ptr<char> &p)
-{ target_debug_do_print (p.get ()); }
+{ return p.get (); }
 
-static void
+static std::string
 target_debug_print_target_waitkind (target_waitkind kind)
-{ target_debug_do_print (pulongest (kind)); }
+{ return pulongest (kind); }
 
-static void
+static std::string
 target_debug_print_gdb_thread_options (gdb_thread_options options)
-{ target_debug_do_print (to_string (options).c_str ()); }
+{ return to_string (options); }
 
-static void
+static std::string
 target_debug_print_target_waitstatus_p (struct target_waitstatus *status)
-{
-  gdb_puts (status->to_string ().c_str (), gdb_stdlog);
-}
+{ return status->to_string (); }
 
 /* Functions that are used via TARGET_DEBUG_PRINTER.  */
 
-static void
+static const char *
 target_debug_print_step (int step)
-{ target_debug_do_print (step ? "step" : "continue"); }
+{ return step ? "step" : "continue"; }
 
-static void
+static std::string
 target_debug_print_target_wait_flags (target_wait_flags options)
-{
-  std::string str = target_options_to_string (options);
-
-  gdb_puts (str.c_str (), gdb_stdlog);
-}
+{ return target_options_to_string (options); }
 
-static void
+static std::string
 target_debug_print_signals (gdb::array_view<const unsigned char> sigs)
 {
-  gdb_puts ("{", gdb_stdlog);
+  std::string s = "{";
 
   for (size_t i = 0; i < sigs.size (); i++)
     if (sigs[i] != 0)
-      {
-	gdb_printf (gdb_stdlog, " %s",
-		    gdb_signal_to_name ((enum gdb_signal) i));
-      }
-  gdb_puts (" }", gdb_stdlog);
+      string_appendf (s, " %s",
+		      gdb_signal_to_name (static_cast<gdb_signal>(i)));
+
+  s += " }";
+
+  return s;
 }
 
-static void
+static const char *
 target_debug_print_size_t (size_t size)
 {
-  gdb_printf (gdb_stdlog, "%s", pulongest (size));
+  return pulongest (size);
 }
 
-static void
+static std::string
 target_debug_print_gdb_array_view_const_gdb_byte (gdb::array_view<const gdb_byte> vector)
 {
-  gdb_puts ("{", gdb_stdlog);
-
-  for (size_t i = 0; i < vector.size (); i++)
-    {
-      gdb_printf (gdb_stdlog, " %s",
-		  phex_nz (vector[i], 1));
-    }
-  gdb_puts (" }", gdb_stdlog);
+  std::string s = "{";
+
+  for (const auto b : vector)
+    string_appendf (s, " %s", phex_nz (b, 1));
+
+  s += " }";
+
+  return s;
 }
 
-static void
+static std::string
 target_debug_print_const_gdb_byte_vector_r (const gdb::byte_vector &vector)
-{
-  target_debug_print_gdb_array_view_const_gdb_byte (vector);
-}
+{ return target_debug_print_gdb_array_view_const_gdb_byte (vector); }
 
-static void
+static std::string
 target_debug_print_gdb_byte_vector_r (gdb::byte_vector &vector)
-{
-  target_debug_print_const_gdb_byte_vector_r (vector);
-}
+{ return target_debug_print_const_gdb_byte_vector_r (vector); }
 
-static void
+static std::string
 target_debug_print_x86_xsave_layout (const x86_xsave_layout &layout)
 {
-  gdb_puts ("{", gdb_stdlog);
-  gdb_printf (gdb_stdlog, " sizeof_xsave=%d", layout.sizeof_xsave);
-#define POFFS(region)							\
-  if (layout.region##_offset != 0)					\
-    gdb_printf (gdb_stdlog, ", %s_offset=%d", #region,			\
-		layout.region##_offset)
+  std::string s = string_printf ("{ sizeof_xsave=%d", layout.sizeof_xsave);
+
+#define POFFS(region)						\
+  if (layout.region##_offset != 0)				\
+    string_appendf (s, ", " #region "_offset=%d", layout.region##_offset);
+
   POFFS(avx);
   POFFS(bndregs);
   POFFS(bndcfg);
@@ -387,7 +374,11 @@ target_debug_print_x86_xsave_layout (const x86_xsave_layout &layout)
   POFFS(zmm_h);
   POFFS(zmm);
   POFFS(pkru);
+
 #undef POFFS
-  gdb_puts (" }", gdb_stdlog);
+
+  s += " }";
+
+  return s;
 }
 #endif /* TARGET_DEBUG_H */
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index e322bbbe481a..1f5de689894f 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -395,7 +395,7 @@ debug_target::post_attach (int arg0)
   gdb_printf (gdb_stdlog, "-> %s->post_attach (...)\n", this->beneath ()->shortname ());
   this->beneath ()->post_attach (arg0);
   gdb_printf (gdb_stdlog, "<- %s->post_attach (", this->beneath ()->shortname ());
-  target_debug_print_int (arg0);
+  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -416,9 +416,9 @@ debug_target::detach (inferior *arg0, int arg1)
   gdb_printf (gdb_stdlog, "-> %s->detach (...)\n", this->beneath ()->shortname ());
   this->beneath ()->detach (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->detach (", this->beneath ()->shortname ());
-  target_debug_print_inferior_p (arg0);
+  gdb_puts (target_debug_print_inferior_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg1);
+  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -440,9 +440,9 @@ debug_target::disconnect (const char *arg0, int arg1)
   gdb_printf (gdb_stdlog, "-> %s->disconnect (...)\n", this->beneath ()->shortname ());
   this->beneath ()->disconnect (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->disconnect (", this->beneath ()->shortname ());
-  target_debug_print_const_char_p (arg0);
+  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg1);
+  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -464,11 +464,11 @@ debug_target::resume (ptid_t arg0, int arg1, enum gdb_signal arg2)
   gdb_printf (gdb_stdlog, "-> %s->resume (...)\n", this->beneath ()->shortname ());
   this->beneath ()->resume (arg0, arg1, arg2);
   gdb_printf (gdb_stdlog, "<- %s->resume (", this->beneath ()->shortname ());
-  target_debug_print_ptid_t (arg0);
+  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_step (arg1);
+  gdb_puts (target_debug_print_step (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_gdb_signal (arg2);
+  gdb_puts (target_debug_print_gdb_signal (arg2), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -511,11 +511,11 @@ debug_target::wait (ptid_t arg0, struct target_waitstatus *arg1, target_wait_fla
   ptid_t result
     = this->beneath ()->wait (arg0, arg1, arg2);
   gdb_printf (gdb_stdlog, "<- %s->wait (", this->beneath ()->shortname ());
-  target_debug_print_ptid_t (arg0);
+  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_target_waitstatus_p (arg1);
+  gdb_puts (target_debug_print_target_waitstatus_p (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_target_wait_flags (arg2);
+  gdb_puts (target_debug_print_target_wait_flags (arg2), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_ptid_t (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -539,9 +539,9 @@ debug_target::fetch_registers (struct regcache *arg0, int arg1)
   gdb_printf (gdb_stdlog, "-> %s->fetch_registers (...)\n", this->beneath ()->shortname ());
   this->beneath ()->fetch_registers (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->fetch_registers (", this->beneath ()->shortname ());
-  target_debug_print_regcache_p (arg0);
+  gdb_puts (target_debug_print_regcache_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg1);
+  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -563,9 +563,9 @@ debug_target::store_registers (struct regcache *arg0, int arg1)
   gdb_printf (gdb_stdlog, "-> %s->store_registers (...)\n", this->beneath ()->shortname ());
   this->beneath ()->store_registers (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->store_registers (", this->beneath ()->shortname ());
-  target_debug_print_regcache_p (arg0);
+  gdb_puts (target_debug_print_regcache_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg1);
+  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -587,7 +587,7 @@ debug_target::prepare_to_store (struct regcache *arg0)
   gdb_printf (gdb_stdlog, "-> %s->prepare_to_store (...)\n", this->beneath ()->shortname ());
   this->beneath ()->prepare_to_store (arg0);
   gdb_printf (gdb_stdlog, "<- %s->prepare_to_store (", this->beneath ()->shortname ());
-  target_debug_print_regcache_p (arg0);
+  gdb_puts (target_debug_print_regcache_p (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -630,9 +630,9 @@ debug_target::insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *ar
   int result
     = this->beneath ()->insert_breakpoint (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->insert_breakpoint (", this->beneath ()->shortname ());
-  target_debug_print_gdbarch_p (arg0);
+  gdb_puts (target_debug_print_gdbarch_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_bp_target_info_p (arg1);
+  gdb_puts (target_debug_print_bp_target_info_p (arg1), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -658,11 +658,11 @@ debug_target::remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *ar
   int result
     = this->beneath ()->remove_breakpoint (arg0, arg1, arg2);
   gdb_printf (gdb_stdlog, "<- %s->remove_breakpoint (", this->beneath ()->shortname ());
-  target_debug_print_gdbarch_p (arg0);
+  gdb_puts (target_debug_print_gdbarch_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_bp_target_info_p (arg1);
+  gdb_puts (target_debug_print_bp_target_info_p (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_remove_bp_reason (arg2);
+  gdb_puts (target_debug_print_remove_bp_reason (arg2), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -788,11 +788,11 @@ debug_target::can_use_hw_breakpoint (enum bptype arg0, int arg1, int arg2)
   int result
     = this->beneath ()->can_use_hw_breakpoint (arg0, arg1, arg2);
   gdb_printf (gdb_stdlog, "<- %s->can_use_hw_breakpoint (", this->beneath ()->shortname ());
-  target_debug_print_bptype (arg0);
+  gdb_puts (target_debug_print_bptype (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg1);
+  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg2);
+  gdb_puts (target_debug_print_int (arg2), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -843,9 +843,9 @@ debug_target::insert_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info
   int result
     = this->beneath ()->insert_hw_breakpoint (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->insert_hw_breakpoint (", this->beneath ()->shortname ());
-  target_debug_print_gdbarch_p (arg0);
+  gdb_puts (target_debug_print_gdbarch_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_bp_target_info_p (arg1);
+  gdb_puts (target_debug_print_bp_target_info_p (arg1), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -871,9 +871,9 @@ debug_target::remove_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info
   int result
     = this->beneath ()->remove_hw_breakpoint (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->remove_hw_breakpoint (", this->beneath ()->shortname ());
-  target_debug_print_gdbarch_p (arg0);
+  gdb_puts (target_debug_print_gdbarch_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_bp_target_info_p (arg1);
+  gdb_puts (target_debug_print_bp_target_info_p (arg1), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -899,13 +899,13 @@ debug_target::remove_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_typ
   int result
     = this->beneath ()->remove_watchpoint (arg0, arg1, arg2, arg3);
   gdb_printf (gdb_stdlog, "<- %s->remove_watchpoint (", this->beneath ()->shortname ());
-  target_debug_print_CORE_ADDR (arg0);
+  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg1);
+  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_target_hw_bp_type (arg2);
+  gdb_puts (target_debug_print_target_hw_bp_type (arg2), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_expression_p (arg3);
+  gdb_puts (target_debug_print_expression_p (arg3), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -931,13 +931,13 @@ debug_target::insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_typ
   int result
     = this->beneath ()->insert_watchpoint (arg0, arg1, arg2, arg3);
   gdb_printf (gdb_stdlog, "<- %s->insert_watchpoint (", this->beneath ()->shortname ());
-  target_debug_print_CORE_ADDR (arg0);
+  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg1);
+  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_target_hw_bp_type (arg2);
+  gdb_puts (target_debug_print_target_hw_bp_type (arg2), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_expression_p (arg3);
+  gdb_puts (target_debug_print_expression_p (arg3), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -963,11 +963,11 @@ debug_target::insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum targe
   int result
     = this->beneath ()->insert_mask_watchpoint (arg0, arg1, arg2);
   gdb_printf (gdb_stdlog, "<- %s->insert_mask_watchpoint (", this->beneath ()->shortname ());
-  target_debug_print_CORE_ADDR (arg0);
+  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_CORE_ADDR (arg1);
+  gdb_puts (target_debug_print_CORE_ADDR (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_target_hw_bp_type (arg2);
+  gdb_puts (target_debug_print_target_hw_bp_type (arg2), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -993,11 +993,11 @@ debug_target::remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum targe
   int result
     = this->beneath ()->remove_mask_watchpoint (arg0, arg1, arg2);
   gdb_printf (gdb_stdlog, "<- %s->remove_mask_watchpoint (", this->beneath ()->shortname ());
-  target_debug_print_CORE_ADDR (arg0);
+  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_CORE_ADDR (arg1);
+  gdb_puts (target_debug_print_CORE_ADDR (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_target_hw_bp_type (arg2);
+  gdb_puts (target_debug_print_target_hw_bp_type (arg2), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1073,7 +1073,7 @@ debug_target::stopped_data_address (CORE_ADDR *arg0)
   bool result
     = this->beneath ()->stopped_data_address (arg0);
   gdb_printf (gdb_stdlog, "<- %s->stopped_data_address (", this->beneath ()->shortname ());
-  target_debug_print_CORE_ADDR_p (arg0);
+  gdb_puts (target_debug_print_CORE_ADDR_p (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_bool (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1099,11 +1099,11 @@ debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int
   bool result
     = this->beneath ()->watchpoint_addr_within_range (arg0, arg1, arg2);
   gdb_printf (gdb_stdlog, "<- %s->watchpoint_addr_within_range (", this->beneath ()->shortname ());
-  target_debug_print_CORE_ADDR (arg0);
+  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_CORE_ADDR (arg1);
+  gdb_puts (target_debug_print_CORE_ADDR (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg2);
+  gdb_puts (target_debug_print_int (arg2), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_bool (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1129,9 +1129,9 @@ debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1)
   int result
     = this->beneath ()->region_ok_for_hw_watchpoint (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->region_ok_for_hw_watchpoint (", this->beneath ()->shortname ());
-  target_debug_print_CORE_ADDR (arg0);
+  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg1);
+  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1157,13 +1157,13 @@ debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2
   bool result
     = this->beneath ()->can_accel_watchpoint_condition (arg0, arg1, arg2, arg3);
   gdb_printf (gdb_stdlog, "<- %s->can_accel_watchpoint_condition (", this->beneath ()->shortname ());
-  target_debug_print_CORE_ADDR (arg0);
+  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg1);
+  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg2);
+  gdb_puts (target_debug_print_int (arg2), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_expression_p (arg3);
+  gdb_puts (target_debug_print_expression_p (arg3), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_bool (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1189,9 +1189,9 @@ debug_target::masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1)
   int result
     = this->beneath ()->masked_watch_num_registers (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->masked_watch_num_registers (", this->beneath ()->shortname ());
-  target_debug_print_CORE_ADDR (arg0);
+  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_CORE_ADDR (arg1);
+  gdb_puts (target_debug_print_CORE_ADDR (arg1), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1366,9 +1366,9 @@ debug_target::terminal_info (const char *arg0, int arg1)
   gdb_printf (gdb_stdlog, "-> %s->terminal_info (...)\n", this->beneath ()->shortname ());
   this->beneath ()->terminal_info (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->terminal_info (", this->beneath ()->shortname ());
-  target_debug_print_const_char_p (arg0);
+  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg1);
+  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -1411,9 +1411,9 @@ debug_target::load (const char *arg0, int arg1)
   gdb_printf (gdb_stdlog, "-> %s->load (...)\n", this->beneath ()->shortname ());
   this->beneath ()->load (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->load (", this->beneath ()->shortname ());
-  target_debug_print_const_char_p (arg0);
+  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg1);
+  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -1436,7 +1436,7 @@ debug_target::insert_fork_catchpoint (int arg0)
   int result
     = this->beneath ()->insert_fork_catchpoint (arg0);
   gdb_printf (gdb_stdlog, "<- %s->insert_fork_catchpoint (", this->beneath ()->shortname ());
-  target_debug_print_int (arg0);
+  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1462,7 +1462,7 @@ debug_target::remove_fork_catchpoint (int arg0)
   int result
     = this->beneath ()->remove_fork_catchpoint (arg0);
   gdb_printf (gdb_stdlog, "<- %s->remove_fork_catchpoint (", this->beneath ()->shortname ());
-  target_debug_print_int (arg0);
+  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1488,7 +1488,7 @@ debug_target::insert_vfork_catchpoint (int arg0)
   int result
     = this->beneath ()->insert_vfork_catchpoint (arg0);
   gdb_printf (gdb_stdlog, "<- %s->insert_vfork_catchpoint (", this->beneath ()->shortname ());
-  target_debug_print_int (arg0);
+  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1514,7 +1514,7 @@ debug_target::remove_vfork_catchpoint (int arg0)
   int result
     = this->beneath ()->remove_vfork_catchpoint (arg0);
   gdb_printf (gdb_stdlog, "<- %s->remove_vfork_catchpoint (", this->beneath ()->shortname ());
-  target_debug_print_int (arg0);
+  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1539,15 +1539,15 @@ debug_target::follow_fork (inferior *arg0, ptid_t arg1, target_waitkind arg2, bo
   gdb_printf (gdb_stdlog, "-> %s->follow_fork (...)\n", this->beneath ()->shortname ());
   this->beneath ()->follow_fork (arg0, arg1, arg2, arg3, arg4);
   gdb_printf (gdb_stdlog, "<- %s->follow_fork (", this->beneath ()->shortname ());
-  target_debug_print_inferior_p (arg0);
+  gdb_puts (target_debug_print_inferior_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_ptid_t (arg1);
+  gdb_puts (target_debug_print_ptid_t (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_target_waitkind (arg2);
+  gdb_puts (target_debug_print_target_waitkind (arg2), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_bool (arg3);
+  gdb_puts (target_debug_print_bool (arg3), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_bool (arg4);
+  gdb_puts (target_debug_print_bool (arg4), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -1569,7 +1569,7 @@ debug_target::follow_clone (ptid_t arg0)
   gdb_printf (gdb_stdlog, "-> %s->follow_clone (...)\n", this->beneath ()->shortname ());
   this->beneath ()->follow_clone (arg0);
   gdb_printf (gdb_stdlog, "<- %s->follow_clone (", this->beneath ()->shortname ());
-  target_debug_print_ptid_t (arg0);
+  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -1592,7 +1592,7 @@ debug_target::insert_exec_catchpoint (int arg0)
   int result
     = this->beneath ()->insert_exec_catchpoint (arg0);
   gdb_printf (gdb_stdlog, "<- %s->insert_exec_catchpoint (", this->beneath ()->shortname ());
-  target_debug_print_int (arg0);
+  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1618,7 +1618,7 @@ debug_target::remove_exec_catchpoint (int arg0)
   int result
     = this->beneath ()->remove_exec_catchpoint (arg0);
   gdb_printf (gdb_stdlog, "<- %s->remove_exec_catchpoint (", this->beneath ()->shortname ());
-  target_debug_print_int (arg0);
+  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1642,11 +1642,11 @@ debug_target::follow_exec (inferior *arg0, ptid_t arg1, const char *arg2)
   gdb_printf (gdb_stdlog, "-> %s->follow_exec (...)\n", this->beneath ()->shortname ());
   this->beneath ()->follow_exec (arg0, arg1, arg2);
   gdb_printf (gdb_stdlog, "<- %s->follow_exec (", this->beneath ()->shortname ());
-  target_debug_print_inferior_p (arg0);
+  gdb_puts (target_debug_print_inferior_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_ptid_t (arg1);
+  gdb_puts (target_debug_print_ptid_t (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_const_char_p (arg2);
+  gdb_puts (target_debug_print_const_char_p (arg2), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -1669,13 +1669,13 @@ debug_target::set_syscall_catchpoint (int arg0, bool arg1, int arg2, gdb::array_
   int result
     = this->beneath ()->set_syscall_catchpoint (arg0, arg1, arg2, arg3);
   gdb_printf (gdb_stdlog, "<- %s->set_syscall_catchpoint (", this->beneath ()->shortname ());
-  target_debug_print_int (arg0);
+  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_bool (arg1);
+  gdb_puts (target_debug_print_bool (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg2);
+  gdb_puts (target_debug_print_int (arg2), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_gdb_array_view_const_int (arg3);
+  gdb_puts (target_debug_print_gdb_array_view_const_int (arg3), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1720,7 +1720,7 @@ debug_target::pass_signals (gdb::array_view<const unsigned char> arg0)
   gdb_printf (gdb_stdlog, "-> %s->pass_signals (...)\n", this->beneath ()->shortname ());
   this->beneath ()->pass_signals (arg0);
   gdb_printf (gdb_stdlog, "<- %s->pass_signals (", this->beneath ()->shortname ());
-  target_debug_print_signals (arg0);
+  gdb_puts (target_debug_print_signals (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -1741,7 +1741,7 @@ debug_target::program_signals (gdb::array_view<const unsigned char> arg0)
   gdb_printf (gdb_stdlog, "-> %s->program_signals (...)\n", this->beneath ()->shortname ());
   this->beneath ()->program_signals (arg0);
   gdb_printf (gdb_stdlog, "<- %s->program_signals (", this->beneath ()->shortname ());
-  target_debug_print_signals (arg0);
+  gdb_puts (target_debug_print_signals (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -1764,7 +1764,7 @@ debug_target::thread_alive (ptid_t arg0)
   bool result
     = this->beneath ()->thread_alive (arg0);
   gdb_printf (gdb_stdlog, "<- %s->thread_alive (", this->beneath ()->shortname ());
-  target_debug_print_ptid_t (arg0);
+  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_bool (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1810,7 +1810,7 @@ debug_target::pid_to_str (ptid_t arg0)
   std::string result
     = this->beneath ()->pid_to_str (arg0);
   gdb_printf (gdb_stdlog, "<- %s->pid_to_str (", this->beneath ()->shortname ());
-  target_debug_print_ptid_t (arg0);
+  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_std_string (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1836,7 +1836,7 @@ debug_target::extra_thread_info (thread_info *arg0)
   const char * result
     = this->beneath ()->extra_thread_info (arg0);
   gdb_printf (gdb_stdlog, "<- %s->extra_thread_info (", this->beneath ()->shortname ());
-  target_debug_print_thread_info_p (arg0);
+  gdb_puts (target_debug_print_thread_info_p (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_const_char_p (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1862,7 +1862,7 @@ debug_target::thread_name (thread_info *arg0)
   const char * result
     = this->beneath ()->thread_name (arg0);
   gdb_printf (gdb_stdlog, "<- %s->thread_name (", this->beneath ()->shortname ());
-  target_debug_print_thread_info_p (arg0);
+  gdb_puts (target_debug_print_thread_info_p (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_const_char_p (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1888,11 +1888,11 @@ debug_target::thread_handle_to_thread_info (const gdb_byte *arg0, int arg1, infe
   thread_info * result
     = this->beneath ()->thread_handle_to_thread_info (arg0, arg1, arg2);
   gdb_printf (gdb_stdlog, "<- %s->thread_handle_to_thread_info (", this->beneath ()->shortname ());
-  target_debug_print_const_gdb_byte_p (arg0);
+  gdb_puts (target_debug_print_const_gdb_byte_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg1);
+  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_inferior_p (arg2);
+  gdb_puts (target_debug_print_inferior_p (arg2), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_thread_info_p (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1918,7 +1918,7 @@ debug_target::thread_info_to_thread_handle (struct thread_info *arg0)
   gdb::array_view<const_gdb_byte> result
     = this->beneath ()->thread_info_to_thread_handle (arg0);
   gdb_printf (gdb_stdlog, "<- %s->thread_info_to_thread_handle (", this->beneath ()->shortname ());
-  target_debug_print_thread_info_p (arg0);
+  gdb_puts (target_debug_print_thread_info_p (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_gdb_array_view_const_gdb_byte (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -1942,7 +1942,7 @@ debug_target::stop (ptid_t arg0)
   gdb_printf (gdb_stdlog, "-> %s->stop (...)\n", this->beneath ()->shortname ());
   this->beneath ()->stop (arg0);
   gdb_printf (gdb_stdlog, "<- %s->stop (", this->beneath ()->shortname ());
-  target_debug_print_ptid_t (arg0);
+  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -2005,9 +2005,9 @@ debug_target::rcmd (const char *arg0, struct ui_file *arg1)
   gdb_printf (gdb_stdlog, "-> %s->rcmd (...)\n", this->beneath ()->shortname ());
   this->beneath ()->rcmd (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->rcmd (", this->beneath ()->shortname ());
-  target_debug_print_const_char_p (arg0);
+  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_ui_file_p (arg1);
+  gdb_puts (target_debug_print_ui_file_p (arg1), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -2030,7 +2030,7 @@ debug_target::pid_to_exec_file (int arg0)
   const char * result
     = this->beneath ()->pid_to_exec_file (arg0);
   gdb_printf (gdb_stdlog, "<- %s->pid_to_exec_file (", this->beneath ()->shortname ());
-  target_debug_print_int (arg0);
+  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_const_char_p (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -2054,7 +2054,7 @@ debug_target::log_command (const char *arg0)
   gdb_printf (gdb_stdlog, "-> %s->log_command (...)\n", this->beneath ()->shortname ());
   this->beneath ()->log_command (arg0);
   gdb_printf (gdb_stdlog, "<- %s->log_command (", this->beneath ()->shortname ());
-  target_debug_print_const_char_p (arg0);
+  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -2201,7 +2201,7 @@ debug_target::async (bool arg0)
   gdb_printf (gdb_stdlog, "-> %s->async (...)\n", this->beneath ()->shortname ());
   this->beneath ()->async (arg0);
   gdb_printf (gdb_stdlog, "<- %s->async (", this->beneath ()->shortname ());
-  target_debug_print_bool (arg0);
+  gdb_puts (target_debug_print_bool (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -2272,7 +2272,7 @@ debug_target::thread_events (int arg0)
   gdb_printf (gdb_stdlog, "-> %s->thread_events (...)\n", this->beneath ()->shortname ());
   this->beneath ()->thread_events (arg0);
   gdb_printf (gdb_stdlog, "<- %s->thread_events (", this->beneath ()->shortname ());
-  target_debug_print_int (arg0);
+  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -2295,7 +2295,7 @@ debug_target::supports_set_thread_options (gdb_thread_options arg0)
   bool result
     = this->beneath ()->supports_set_thread_options (arg0);
   gdb_printf (gdb_stdlog, "<- %s->supports_set_thread_options (", this->beneath ()->shortname ());
-  target_debug_print_gdb_thread_options (arg0);
+  gdb_puts (target_debug_print_gdb_thread_options (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_bool (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -2371,9 +2371,9 @@ debug_target::find_memory_regions (find_memory_region_ftype arg0, void *arg1)
   int result
     = this->beneath ()->find_memory_regions (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->find_memory_regions (", this->beneath ()->shortname ());
-  target_debug_print_find_memory_region_ftype (arg0);
+  gdb_puts (target_debug_print_find_memory_region_ftype (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_void_p (arg1);
+  gdb_puts (target_debug_print_void_p (arg1), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -2399,9 +2399,9 @@ debug_target::make_corefile_notes (bfd *arg0, int *arg1)
   gdb::unique_xmalloc_ptr<char> result
     = this->beneath ()->make_corefile_notes (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->make_corefile_notes (", this->beneath ()->shortname ());
-  target_debug_print_bfd_p (arg0);
+  gdb_puts (target_debug_print_bfd_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int_p (arg1);
+  gdb_puts (target_debug_print_int_p (arg1), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_gdb_unique_xmalloc_ptr_char (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -2427,9 +2427,9 @@ debug_target::get_bookmark (const char *arg0, int arg1)
   gdb_byte * result
     = this->beneath ()->get_bookmark (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->get_bookmark (", this->beneath ()->shortname ());
-  target_debug_print_const_char_p (arg0);
+  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg1);
+  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_gdb_byte_p (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -2454,9 +2454,9 @@ debug_target::goto_bookmark (const gdb_byte *arg0, int arg1)
   gdb_printf (gdb_stdlog, "-> %s->goto_bookmark (...)\n", this->beneath ()->shortname ());
   this->beneath ()->goto_bookmark (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->goto_bookmark (", this->beneath ()->shortname ());
-  target_debug_print_const_gdb_byte_p (arg0);
+  gdb_puts (target_debug_print_const_gdb_byte_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg1);
+  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -2479,11 +2479,11 @@ debug_target::get_thread_local_address (ptid_t arg0, CORE_ADDR arg1, CORE_ADDR a
   CORE_ADDR result
     = this->beneath ()->get_thread_local_address (arg0, arg1, arg2);
   gdb_printf (gdb_stdlog, "<- %s->get_thread_local_address (", this->beneath ()->shortname ());
-  target_debug_print_ptid_t (arg0);
+  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_CORE_ADDR (arg1);
+  gdb_puts (target_debug_print_CORE_ADDR (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_CORE_ADDR (arg2);
+  gdb_puts (target_debug_print_CORE_ADDR (arg2), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_CORE_ADDR (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -2509,19 +2509,19 @@ debug_target::xfer_partial (enum target_object arg0, const char *arg1, gdb_byte
   enum target_xfer_status result
     = this->beneath ()->xfer_partial (arg0, arg1, arg2, arg3, arg4, arg5, arg6);
   gdb_printf (gdb_stdlog, "<- %s->xfer_partial (", this->beneath ()->shortname ());
-  target_debug_print_target_object (arg0);
+  gdb_puts (target_debug_print_target_object (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_const_char_p (arg1);
+  gdb_puts (target_debug_print_const_char_p (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_gdb_byte_p (arg2);
+  gdb_puts (target_debug_print_gdb_byte_p (arg2), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_const_gdb_byte_p (arg3);
+  gdb_puts (target_debug_print_const_gdb_byte_p (arg3), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_ULONGEST (arg4);
+  gdb_puts (target_debug_print_ULONGEST (arg4), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_ULONGEST (arg5);
+  gdb_puts (target_debug_print_ULONGEST (arg5), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_ULONGEST_p (arg6);
+  gdb_puts (target_debug_print_ULONGEST_p (arg6), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_target_xfer_status (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -2596,9 +2596,9 @@ debug_target::flash_erase (ULONGEST arg0, LONGEST arg1)
   gdb_printf (gdb_stdlog, "-> %s->flash_erase (...)\n", this->beneath ()->shortname ());
   this->beneath ()->flash_erase (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->flash_erase (", this->beneath ()->shortname ());
-  target_debug_print_ULONGEST (arg0);
+  gdb_puts (target_debug_print_ULONGEST (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_LONGEST (arg1);
+  gdb_puts (target_debug_print_LONGEST (arg1), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -2667,9 +2667,9 @@ debug_target::get_ada_task_ptid (long arg0, ULONGEST arg1)
   ptid_t result
     = this->beneath ()->get_ada_task_ptid (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->get_ada_task_ptid (", this->beneath ()->shortname ());
-  target_debug_print_long (arg0);
+  gdb_puts (target_debug_print_long (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_ULONGEST (arg1);
+  gdb_puts (target_debug_print_ULONGEST (arg1), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_ptid_t (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -2695,13 +2695,13 @@ debug_target::auxv_parse (const gdb_byte **arg0, const gdb_byte *arg1, CORE_ADDR
   int result
     = this->beneath ()->auxv_parse (arg0, arg1, arg2, arg3);
   gdb_printf (gdb_stdlog, "<- %s->auxv_parse (", this->beneath ()->shortname ());
-  target_debug_print_const_gdb_byte_pp (arg0);
+  gdb_puts (target_debug_print_const_gdb_byte_pp (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_const_gdb_byte_p (arg1);
+  gdb_puts (target_debug_print_const_gdb_byte_p (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_CORE_ADDR_p (arg2);
+  gdb_puts (target_debug_print_CORE_ADDR_p (arg2), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_CORE_ADDR_p (arg3);
+  gdb_puts (target_debug_print_CORE_ADDR_p (arg3), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -2727,15 +2727,15 @@ debug_target::search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2
   int result
     = this->beneath ()->search_memory (arg0, arg1, arg2, arg3, arg4);
   gdb_printf (gdb_stdlog, "<- %s->search_memory (", this->beneath ()->shortname ());
-  target_debug_print_CORE_ADDR (arg0);
+  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_ULONGEST (arg1);
+  gdb_puts (target_debug_print_ULONGEST (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_const_gdb_byte_p (arg2);
+  gdb_puts (target_debug_print_const_gdb_byte_p (arg2), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_ULONGEST (arg3);
+  gdb_puts (target_debug_print_ULONGEST (arg3), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_CORE_ADDR_p (arg4);
+  gdb_puts (target_debug_print_CORE_ADDR_p (arg4), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -2959,7 +2959,7 @@ debug_target::dumpcore (const char *arg0)
   gdb_printf (gdb_stdlog, "-> %s->dumpcore (...)\n", this->beneath ()->shortname ());
   this->beneath ()->dumpcore (arg0);
   gdb_printf (gdb_stdlog, "<- %s->dumpcore (", this->beneath ()->shortname ());
-  target_debug_print_const_char_p (arg0);
+  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -3007,7 +3007,7 @@ debug_target::thread_architecture (ptid_t arg0)
   struct gdbarch * result
     = this->beneath ()->thread_architecture (arg0);
   gdb_printf (gdb_stdlog, "<- %s->thread_architecture (", this->beneath ()->shortname ());
-  target_debug_print_ptid_t (arg0);
+  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_gdbarch_p (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -3078,7 +3078,7 @@ debug_target::download_tracepoint (struct bp_location *arg0)
   gdb_printf (gdb_stdlog, "-> %s->download_tracepoint (...)\n", this->beneath ()->shortname ());
   this->beneath ()->download_tracepoint (arg0);
   gdb_printf (gdb_stdlog, "<- %s->download_tracepoint (", this->beneath ()->shortname ());
-  target_debug_print_bp_location_p (arg0);
+  gdb_puts (target_debug_print_bp_location_p (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -3125,7 +3125,7 @@ debug_target::download_trace_state_variable (const trace_state_variable &arg0)
   gdb_printf (gdb_stdlog, "-> %s->download_trace_state_variable (...)\n", this->beneath ()->shortname ());
   this->beneath ()->download_trace_state_variable (arg0);
   gdb_printf (gdb_stdlog, "<- %s->download_trace_state_variable (", this->beneath ()->shortname ());
-  target_debug_print_const_trace_state_variable_r (arg0);
+  gdb_puts (target_debug_print_const_trace_state_variable_r (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -3147,7 +3147,7 @@ debug_target::enable_tracepoint (struct bp_location *arg0)
   gdb_printf (gdb_stdlog, "-> %s->enable_tracepoint (...)\n", this->beneath ()->shortname ());
   this->beneath ()->enable_tracepoint (arg0);
   gdb_printf (gdb_stdlog, "<- %s->enable_tracepoint (", this->beneath ()->shortname ());
-  target_debug_print_bp_location_p (arg0);
+  gdb_puts (target_debug_print_bp_location_p (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -3169,7 +3169,7 @@ debug_target::disable_tracepoint (struct bp_location *arg0)
   gdb_printf (gdb_stdlog, "-> %s->disable_tracepoint (...)\n", this->beneath ()->shortname ());
   this->beneath ()->disable_tracepoint (arg0);
   gdb_printf (gdb_stdlog, "<- %s->disable_tracepoint (", this->beneath ()->shortname ());
-  target_debug_print_bp_location_p (arg0);
+  gdb_puts (target_debug_print_bp_location_p (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -3234,7 +3234,7 @@ debug_target::get_trace_status (struct trace_status *arg0)
   int result
     = this->beneath ()->get_trace_status (arg0);
   gdb_printf (gdb_stdlog, "<- %s->get_trace_status (", this->beneath ()->shortname ());
-  target_debug_print_trace_status_p (arg0);
+  gdb_puts (target_debug_print_trace_status_p (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -3259,9 +3259,9 @@ debug_target::get_tracepoint_status (tracepoint *arg0, struct uploaded_tp *arg1)
   gdb_printf (gdb_stdlog, "-> %s->get_tracepoint_status (...)\n", this->beneath ()->shortname ());
   this->beneath ()->get_tracepoint_status (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->get_tracepoint_status (", this->beneath ()->shortname ());
-  target_debug_print_tracepoint_p (arg0);
+  gdb_puts (target_debug_print_tracepoint_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_uploaded_tp_p (arg1);
+  gdb_puts (target_debug_print_uploaded_tp_p (arg1), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -3305,15 +3305,15 @@ debug_target::trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2, C
   int result
     = this->beneath ()->trace_find (arg0, arg1, arg2, arg3, arg4);
   gdb_printf (gdb_stdlog, "<- %s->trace_find (", this->beneath ()->shortname ());
-  target_debug_print_trace_find_type (arg0);
+  gdb_puts (target_debug_print_trace_find_type (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg1);
+  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_CORE_ADDR (arg2);
+  gdb_puts (target_debug_print_CORE_ADDR (arg2), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_CORE_ADDR (arg3);
+  gdb_puts (target_debug_print_CORE_ADDR (arg3), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int_p (arg4);
+  gdb_puts (target_debug_print_int_p (arg4), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -3339,9 +3339,9 @@ debug_target::get_trace_state_variable_value (int arg0, LONGEST *arg1)
   bool result
     = this->beneath ()->get_trace_state_variable_value (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->get_trace_state_variable_value (", this->beneath ()->shortname ());
-  target_debug_print_int (arg0);
+  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_LONGEST_p (arg1);
+  gdb_puts (target_debug_print_LONGEST_p (arg1), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_bool (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -3367,7 +3367,7 @@ debug_target::save_trace_data (const char *arg0)
   int result
     = this->beneath ()->save_trace_data (arg0);
   gdb_printf (gdb_stdlog, "<- %s->save_trace_data (", this->beneath ()->shortname ());
-  target_debug_print_const_char_p (arg0);
+  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -3393,7 +3393,7 @@ debug_target::upload_tracepoints (struct uploaded_tp **arg0)
   int result
     = this->beneath ()->upload_tracepoints (arg0);
   gdb_printf (gdb_stdlog, "<- %s->upload_tracepoints (", this->beneath ()->shortname ());
-  target_debug_print_uploaded_tp_pp (arg0);
+  gdb_puts (target_debug_print_uploaded_tp_pp (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -3419,7 +3419,7 @@ debug_target::upload_trace_state_variables (struct uploaded_tsv **arg0)
   int result
     = this->beneath ()->upload_trace_state_variables (arg0);
   gdb_printf (gdb_stdlog, "<- %s->upload_trace_state_variables (", this->beneath ()->shortname ());
-  target_debug_print_uploaded_tsv_pp (arg0);
+  gdb_puts (target_debug_print_uploaded_tsv_pp (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -3445,11 +3445,11 @@ debug_target::get_raw_trace_data (gdb_byte *arg0, ULONGEST arg1, LONGEST arg2)
   LONGEST result
     = this->beneath ()->get_raw_trace_data (arg0, arg1, arg2);
   gdb_printf (gdb_stdlog, "<- %s->get_raw_trace_data (", this->beneath ()->shortname ());
-  target_debug_print_gdb_byte_p (arg0);
+  gdb_puts (target_debug_print_gdb_byte_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_ULONGEST (arg1);
+  gdb_puts (target_debug_print_ULONGEST (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_LONGEST (arg2);
+  gdb_puts (target_debug_print_LONGEST (arg2), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_LONGEST (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -3498,7 +3498,7 @@ debug_target::set_disconnected_tracing (int arg0)
   gdb_printf (gdb_stdlog, "-> %s->set_disconnected_tracing (...)\n", this->beneath ()->shortname ());
   this->beneath ()->set_disconnected_tracing (arg0);
   gdb_printf (gdb_stdlog, "<- %s->set_disconnected_tracing (", this->beneath ()->shortname ());
-  target_debug_print_int (arg0);
+  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -3519,7 +3519,7 @@ debug_target::set_circular_trace_buffer (int arg0)
   gdb_printf (gdb_stdlog, "-> %s->set_circular_trace_buffer (...)\n", this->beneath ()->shortname ());
   this->beneath ()->set_circular_trace_buffer (arg0);
   gdb_printf (gdb_stdlog, "<- %s->set_circular_trace_buffer (", this->beneath ()->shortname ());
-  target_debug_print_int (arg0);
+  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -3540,7 +3540,7 @@ debug_target::set_trace_buffer_size (LONGEST arg0)
   gdb_printf (gdb_stdlog, "-> %s->set_trace_buffer_size (...)\n", this->beneath ()->shortname ());
   this->beneath ()->set_trace_buffer_size (arg0);
   gdb_printf (gdb_stdlog, "<- %s->set_trace_buffer_size (", this->beneath ()->shortname ());
-  target_debug_print_LONGEST (arg0);
+  gdb_puts (target_debug_print_LONGEST (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -3563,11 +3563,11 @@ debug_target::set_trace_notes (const char *arg0, const char *arg1, const char *a
   bool result
     = this->beneath ()->set_trace_notes (arg0, arg1, arg2);
   gdb_printf (gdb_stdlog, "<- %s->set_trace_notes (", this->beneath ()->shortname ());
-  target_debug_print_const_char_p (arg0);
+  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_const_char_p (arg1);
+  gdb_puts (target_debug_print_const_char_p (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_const_char_p (arg2);
+  gdb_puts (target_debug_print_const_char_p (arg2), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_bool (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -3593,7 +3593,7 @@ debug_target::core_of_thread (ptid_t arg0)
   int result
     = this->beneath ()->core_of_thread (arg0);
   gdb_printf (gdb_stdlog, "<- %s->core_of_thread (", this->beneath ()->shortname ());
-  target_debug_print_ptid_t (arg0);
+  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -3619,11 +3619,11 @@ debug_target::verify_memory (const gdb_byte *arg0, CORE_ADDR arg1, ULONGEST arg2
   int result
     = this->beneath ()->verify_memory (arg0, arg1, arg2);
   gdb_printf (gdb_stdlog, "<- %s->verify_memory (", this->beneath ()->shortname ());
-  target_debug_print_const_gdb_byte_p (arg0);
+  gdb_puts (target_debug_print_const_gdb_byte_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_CORE_ADDR (arg1);
+  gdb_puts (target_debug_print_CORE_ADDR (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_ULONGEST (arg2);
+  gdb_puts (target_debug_print_ULONGEST (arg2), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_int (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -3649,9 +3649,9 @@ debug_target::get_tib_address (ptid_t arg0, CORE_ADDR *arg1)
   bool result
     = this->beneath ()->get_tib_address (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->get_tib_address (", this->beneath ()->shortname ());
-  target_debug_print_ptid_t (arg0);
+  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_CORE_ADDR_p (arg1);
+  gdb_puts (target_debug_print_CORE_ADDR_p (arg1), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_bool (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -3697,9 +3697,9 @@ debug_target::static_tracepoint_marker_at (CORE_ADDR arg0, static_tracepoint_mar
   bool result
     = this->beneath ()->static_tracepoint_marker_at (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->static_tracepoint_marker_at (", this->beneath ()->shortname ());
-  target_debug_print_CORE_ADDR (arg0);
+  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_static_tracepoint_marker_p (arg1);
+  gdb_puts (target_debug_print_static_tracepoint_marker_p (arg1), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_bool (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -3725,7 +3725,7 @@ debug_target::static_tracepoint_markers_by_strid (const char *arg0)
   std::vector<static_tracepoint_marker> result
     = this->beneath ()->static_tracepoint_markers_by_strid (arg0);
   gdb_printf (gdb_stdlog, "<- %s->static_tracepoint_markers_by_strid (", this->beneath ()->shortname ());
-  target_debug_print_const_char_p (arg0);
+  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_std_vector_static_tracepoint_marker (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -3776,7 +3776,7 @@ debug_target::use_agent (bool arg0)
   bool result
     = this->beneath ()->use_agent (arg0);
   gdb_printf (gdb_stdlog, "<- %s->use_agent (", this->beneath ()->shortname ());
-  target_debug_print_bool (arg0);
+  gdb_puts (target_debug_print_bool (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_bool (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -3827,9 +3827,9 @@ debug_target::enable_btrace (thread_info *arg0, const struct btrace_config *arg1
   struct btrace_target_info * result
     = this->beneath ()->enable_btrace (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->enable_btrace (", this->beneath ()->shortname ());
-  target_debug_print_thread_info_p (arg0);
+  gdb_puts (target_debug_print_thread_info_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_const_btrace_config_p (arg1);
+  gdb_puts (target_debug_print_const_btrace_config_p (arg1), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_btrace_target_info_p (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -3854,7 +3854,7 @@ debug_target::disable_btrace (struct btrace_target_info *arg0)
   gdb_printf (gdb_stdlog, "-> %s->disable_btrace (...)\n", this->beneath ()->shortname ());
   this->beneath ()->disable_btrace (arg0);
   gdb_printf (gdb_stdlog, "<- %s->disable_btrace (", this->beneath ()->shortname ());
-  target_debug_print_btrace_target_info_p (arg0);
+  gdb_puts (target_debug_print_btrace_target_info_p (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -3876,7 +3876,7 @@ debug_target::teardown_btrace (struct btrace_target_info *arg0)
   gdb_printf (gdb_stdlog, "-> %s->teardown_btrace (...)\n", this->beneath ()->shortname ());
   this->beneath ()->teardown_btrace (arg0);
   gdb_printf (gdb_stdlog, "<- %s->teardown_btrace (", this->beneath ()->shortname ());
-  target_debug_print_btrace_target_info_p (arg0);
+  gdb_puts (target_debug_print_btrace_target_info_p (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -3899,11 +3899,11 @@ debug_target::read_btrace (struct btrace_data *arg0, struct btrace_target_info *
   enum btrace_error result
     = this->beneath ()->read_btrace (arg0, arg1, arg2);
   gdb_printf (gdb_stdlog, "<- %s->read_btrace (", this->beneath ()->shortname ());
-  target_debug_print_btrace_data_p (arg0);
+  gdb_puts (target_debug_print_btrace_data_p (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_btrace_target_info_p (arg1);
+  gdb_puts (target_debug_print_btrace_target_info_p (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_btrace_read_type (arg2);
+  gdb_puts (target_debug_print_btrace_read_type (arg2), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_btrace_error (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -3929,7 +3929,7 @@ debug_target::btrace_conf (const struct btrace_target_info *arg0)
   const struct btrace_config * result
     = this->beneath ()->btrace_conf (arg0);
   gdb_printf (gdb_stdlog, "<- %s->btrace_conf (", this->beneath ()->shortname ());
-  target_debug_print_const_btrace_target_info_p (arg0);
+  gdb_puts (target_debug_print_const_btrace_target_info_p (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_const_btrace_config_p (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -3955,7 +3955,7 @@ debug_target::record_method (ptid_t arg0)
   enum record_method result
     = this->beneath ()->record_method (arg0);
   gdb_printf (gdb_stdlog, "<- %s->record_method (", this->beneath ()->shortname ());
-  target_debug_print_ptid_t (arg0);
+  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_record_method (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -4020,7 +4020,7 @@ debug_target::save_record (const char *arg0)
   gdb_printf (gdb_stdlog, "-> %s->save_record (...)\n", this->beneath ()->shortname ());
   this->beneath ()->save_record (arg0);
   gdb_printf (gdb_stdlog, "<- %s->save_record (", this->beneath ()->shortname ());
-  target_debug_print_const_char_p (arg0);
+  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -4089,7 +4089,7 @@ debug_target::record_is_replaying (ptid_t arg0)
   bool result
     = this->beneath ()->record_is_replaying (arg0);
   gdb_printf (gdb_stdlog, "<- %s->record_is_replaying (", this->beneath ()->shortname ());
-  target_debug_print_ptid_t (arg0);
+  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_bool (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -4115,9 +4115,9 @@ debug_target::record_will_replay (ptid_t arg0, int arg1)
   bool result
     = this->beneath ()->record_will_replay (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->record_will_replay (", this->beneath ()->shortname ());
-  target_debug_print_ptid_t (arg0);
+  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg1);
+  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_bool (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -4204,7 +4204,7 @@ debug_target::goto_record (ULONGEST arg0)
   gdb_printf (gdb_stdlog, "-> %s->goto_record (...)\n", this->beneath ()->shortname ());
   this->beneath ()->goto_record (arg0);
   gdb_printf (gdb_stdlog, "<- %s->goto_record (", this->beneath ()->shortname ());
-  target_debug_print_ULONGEST (arg0);
+  gdb_puts (target_debug_print_ULONGEST (arg0), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -4226,9 +4226,9 @@ debug_target::insn_history (int arg0, gdb_disassembly_flags arg1)
   gdb_printf (gdb_stdlog, "-> %s->insn_history (...)\n", this->beneath ()->shortname ());
   this->beneath ()->insn_history (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->insn_history (", this->beneath ()->shortname ());
-  target_debug_print_int (arg0);
+  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_gdb_disassembly_flags (arg1);
+  gdb_puts (target_debug_print_gdb_disassembly_flags (arg1), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -4250,11 +4250,11 @@ debug_target::insn_history_from (ULONGEST arg0, int arg1, gdb_disassembly_flags
   gdb_printf (gdb_stdlog, "-> %s->insn_history_from (...)\n", this->beneath ()->shortname ());
   this->beneath ()->insn_history_from (arg0, arg1, arg2);
   gdb_printf (gdb_stdlog, "<- %s->insn_history_from (", this->beneath ()->shortname ());
-  target_debug_print_ULONGEST (arg0);
+  gdb_puts (target_debug_print_ULONGEST (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg1);
+  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_gdb_disassembly_flags (arg2);
+  gdb_puts (target_debug_print_gdb_disassembly_flags (arg2), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -4276,11 +4276,11 @@ debug_target::insn_history_range (ULONGEST arg0, ULONGEST arg1, gdb_disassembly_
   gdb_printf (gdb_stdlog, "-> %s->insn_history_range (...)\n", this->beneath ()->shortname ());
   this->beneath ()->insn_history_range (arg0, arg1, arg2);
   gdb_printf (gdb_stdlog, "<- %s->insn_history_range (", this->beneath ()->shortname ());
-  target_debug_print_ULONGEST (arg0);
+  gdb_puts (target_debug_print_ULONGEST (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_ULONGEST (arg1);
+  gdb_puts (target_debug_print_ULONGEST (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_gdb_disassembly_flags (arg2);
+  gdb_puts (target_debug_print_gdb_disassembly_flags (arg2), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -4302,9 +4302,9 @@ debug_target::call_history (int arg0, record_print_flags arg1)
   gdb_printf (gdb_stdlog, "-> %s->call_history (...)\n", this->beneath ()->shortname ());
   this->beneath ()->call_history (arg0, arg1);
   gdb_printf (gdb_stdlog, "<- %s->call_history (", this->beneath ()->shortname ());
-  target_debug_print_int (arg0);
+  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_record_print_flags (arg1);
+  gdb_puts (target_debug_print_record_print_flags (arg1), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -4326,11 +4326,11 @@ debug_target::call_history_from (ULONGEST arg0, int arg1, record_print_flags arg
   gdb_printf (gdb_stdlog, "-> %s->call_history_from (...)\n", this->beneath ()->shortname ());
   this->beneath ()->call_history_from (arg0, arg1, arg2);
   gdb_printf (gdb_stdlog, "<- %s->call_history_from (", this->beneath ()->shortname ());
-  target_debug_print_ULONGEST (arg0);
+  gdb_puts (target_debug_print_ULONGEST (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg1);
+  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_record_print_flags (arg2);
+  gdb_puts (target_debug_print_record_print_flags (arg2), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -4352,11 +4352,11 @@ debug_target::call_history_range (ULONGEST arg0, ULONGEST arg1, record_print_fla
   gdb_printf (gdb_stdlog, "-> %s->call_history_range (...)\n", this->beneath ()->shortname ());
   this->beneath ()->call_history_range (arg0, arg1, arg2);
   gdb_printf (gdb_stdlog, "<- %s->call_history_range (", this->beneath ()->shortname ());
-  target_debug_print_ULONGEST (arg0);
+  gdb_puts (target_debug_print_ULONGEST (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_ULONGEST (arg1);
+  gdb_puts (target_debug_print_ULONGEST (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_record_print_flags (arg2);
+  gdb_puts (target_debug_print_record_print_flags (arg2), gdb_stdlog);
   gdb_puts (")\n", gdb_stdlog);
 }
 
@@ -4519,13 +4519,13 @@ debug_target::fetch_memtags (CORE_ADDR arg0, size_t arg1, gdb::byte_vector &arg2
   bool result
     = this->beneath ()->fetch_memtags (arg0, arg1, arg2, arg3);
   gdb_printf (gdb_stdlog, "<- %s->fetch_memtags (", this->beneath ()->shortname ());
-  target_debug_print_CORE_ADDR (arg0);
+  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_size_t (arg1);
+  gdb_puts (target_debug_print_size_t (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_gdb_byte_vector_r (arg2);
+  gdb_puts (target_debug_print_gdb_byte_vector_r (arg2), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg3);
+  gdb_puts (target_debug_print_int (arg3), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_bool (result);
   gdb_puts ("\n", gdb_stdlog);
@@ -4551,13 +4551,13 @@ debug_target::store_memtags (CORE_ADDR arg0, size_t arg1, const gdb::byte_vector
   bool result
     = this->beneath ()->store_memtags (arg0, arg1, arg2, arg3);
   gdb_printf (gdb_stdlog, "<- %s->store_memtags (", this->beneath ()->shortname ());
-  target_debug_print_CORE_ADDR (arg0);
+  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_size_t (arg1);
+  gdb_puts (target_debug_print_size_t (arg1), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_const_gdb_byte_vector_r (arg2);
+  gdb_puts (target_debug_print_const_gdb_byte_vector_r (arg2), gdb_stdlog);
   gdb_puts (", ", gdb_stdlog);
-  target_debug_print_int (arg3);
+  gdb_puts (target_debug_print_int (arg3), gdb_stdlog);
   gdb_puts (") = ", gdb_stdlog);
   target_debug_print_bool (result);
   gdb_puts ("\n", gdb_stdlog);
diff --git a/gdb/utils.c b/gdb/utils.c
index 6a77f6be713a..04f2d909cd29 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1838,6 +1838,12 @@ gdb_puts (const char *linebuffer, struct ui_file *stream)
   stream->puts (linebuffer);
 }
 
+void
+gdb_puts (const std::string &s, ui_file *stream)
+{
+  gdb_puts (s.c_str (), stream);
+}
+
 /* See utils.h.  */
 
 void
diff --git a/gdb/utils.h b/gdb/utils.h
index 96350890a975..f0189c7d723d 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -205,6 +205,8 @@ extern void set_screen_width_and_height (int width, int height);
 
 extern void gdb_puts (const char *, struct ui_file *);
 
+extern void gdb_puts (const std::string &s, ui_file *stream);
+
 extern void gdb_putc (int c, struct ui_file *);
 
 extern void gdb_putc (int c);

base-commit: ebb8507cee4edcb6b355a04159a4d4822f756e1c
-- 
2.44.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 2/4] gdb: make debug_target use one-liners
  2024-04-19 19:46 [PATCH v2 1/4] gdb: make target debug functions return std::string Simon Marchi
@ 2024-04-19 19:46 ` Simon Marchi
  2024-04-19 19:46 ` [PATCH v2 3/4] gdb: make regcache::debug_print_register return a string Simon Marchi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Simon Marchi @ 2024-04-19 19:46 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi, Tom Tromey

From: Simon Marchi <simon.marchi@efficios.com>

Turn the debug prints in debug_target's method to be one liners.  For
instance, change this:

    gdb_printf (gdb_stdlog, "<- %s->wait (", this->beneath ()->shortname ());
    gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
    gdb_puts (", ", gdb_stdlog);
    gdb_puts (target_debug_print_target_waitstatus_p (arg1), gdb_stdlog);
    gdb_puts (", ", gdb_stdlog);
    gdb_puts (target_debug_print_target_wait_flags (arg2), gdb_stdlog);
    gdb_puts (") = ", gdb_stdlog);
    target_debug_print_ptid_t (result);
    gdb_puts ("\n", gdb_stdlog);

into this:

    gdb_printf (gdb_stdlog,
               "<- %s->wait (%s, %s, %s) = %s\n",
               this->beneath ()->shortname (),
               target_debug_print_ptid_t (arg0).c_str (),
               target_debug_print_target_waitstatus_p (arg1).c_str (),
               target_debug_print_target_wait_flags (arg2).c_str (),
               target_debug_print_ptid_t (result).c_str ());

This makes it possible for a subsequent patch to turn this gdb_printf
call into a `target_debug_printf` call.

Change-Id: I808202438972fac1bba2f8ccb63e66a4fcef20c9
Approved-By: Tom Tromey <tom@tromey.com>
---
 gdb/make-target-delegates.py |   44 +-
 gdb/target-debug.h           |    4 +-
 gdb/target-delegates.c       | 1651 +++++++++++++++++-----------------
 3 files changed, 835 insertions(+), 864 deletions(-)

diff --git a/gdb/make-target-delegates.py b/gdb/make-target-delegates.py
index 051efce94dab..f6f2bf004ff5 100755
--- a/gdb/make-target-delegates.py
+++ b/gdb/make-target-delegates.py
@@ -290,28 +290,34 @@ def write_debugmethod(
     print(", ".join(names), file=f, end="")
     print(");", file=f)
 
-    # Now print the arguments.
-    print(
-        '  gdb_printf (gdb_stdlog, "<- %s->'
-        + name
-        + ' (", this->beneath ()->shortname ());',
-        file=f,
+    # Generate the debug printf call.
+    args_fmt = ", ".join(["%s"] * len(argtypes))
+    args = "".join(
+        [
+            (",\n\t      {printer} (arg{i}).c_str ()").format(
+                printer=munge_type(t), i=i
+            )
+            for i, t in enumerate(argtypes)
+        ]
     )
-    for i in range(len(argtypes)):
-        if i > 0:
-            print('  gdb_puts (", ", gdb_stdlog);', file=f)
-        printer = munge_type(argtypes[i])
-        print(
-            "  gdb_puts (" + printer + " (" + names[i] + "), gdb_stdlog);",
-            file=f,
-        )
+
     if return_type != "void":
-        print('  gdb_puts (") = ", gdb_stdlog);', file=f)
-        printer = munge_type(return_type)
-        print("  " + printer + " (result);", file=f)
-        print('  gdb_puts ("\\n", gdb_stdlog);', file=f)
+        ret_fmt = " = %s"
+        ret = ",\n\t      {printer} (result).c_str ()".format(
+            printer=munge_type(return_type)
+        )
     else:
-        print('  gdb_puts (")\\n", gdb_stdlog);', file=f)
+        ret_fmt = ""
+        ret = ""
+
+    print(
+        (
+            "  gdb_printf (gdb_stdlog,\n"
+            '\t      "<- %s->{name} ({args_fmt}){ret_fmt}\\n",\n'
+            "\t      this->beneath ()->shortname (){args}{ret});"
+        ).format(name=name, args_fmt=args_fmt, args=args, ret_fmt=ret_fmt, ret=ret),
+        file=f,
+    )
 
     if return_type != "void":
         print("  return result;", file=f)
diff --git a/gdb/target-debug.h b/gdb/target-debug.h
index efe695e07690..b5eb338069a8 100644
--- a/gdb/target-debug.h
+++ b/gdb/target-debug.h
@@ -308,7 +308,7 @@ target_debug_print_target_waitstatus_p (struct target_waitstatus *status)
 
 /* Functions that are used via TARGET_DEBUG_PRINTER.  */
 
-static const char *
+static std::string
 target_debug_print_step (int step)
 { return step ? "step" : "continue"; }
 
@@ -331,7 +331,7 @@ target_debug_print_signals (gdb::array_view<const unsigned char> sigs)
   return s;
 }
 
-static const char *
+static std::string
 target_debug_print_size_t (size_t size)
 {
   return pulongest (size);
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index 1f5de689894f..b45b445c2c40 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -394,9 +394,10 @@ debug_target::post_attach (int arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->post_attach (...)\n", this->beneath ()->shortname ());
   this->beneath ()->post_attach (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->post_attach (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->post_attach (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (arg0).c_str ());
 }
 
 void
@@ -415,11 +416,11 @@ debug_target::detach (inferior *arg0, int arg1)
 {
   gdb_printf (gdb_stdlog, "-> %s->detach (...)\n", this->beneath ()->shortname ());
   this->beneath ()->detach (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->detach (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_inferior_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->detach (%s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_inferior_p (arg0).c_str (),
+	      target_debug_print_int (arg1).c_str ());
 }
 
 void
@@ -439,11 +440,11 @@ debug_target::disconnect (const char *arg0, int arg1)
 {
   gdb_printf (gdb_stdlog, "-> %s->disconnect (...)\n", this->beneath ()->shortname ());
   this->beneath ()->disconnect (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->disconnect (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->disconnect (%s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_char_p (arg0).c_str (),
+	      target_debug_print_int (arg1).c_str ());
 }
 
 void
@@ -463,13 +464,12 @@ debug_target::resume (ptid_t arg0, int arg1, enum gdb_signal arg2)
 {
   gdb_printf (gdb_stdlog, "-> %s->resume (...)\n", this->beneath ()->shortname ());
   this->beneath ()->resume (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog, "<- %s->resume (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_step (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_gdb_signal (arg2), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->resume (%s, %s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ptid_t (arg0).c_str (),
+	      target_debug_print_step (arg1).c_str (),
+	      target_debug_print_gdb_signal (arg2).c_str ());
 }
 
 void
@@ -488,8 +488,9 @@ debug_target::commit_resumed ()
 {
   gdb_printf (gdb_stdlog, "-> %s->commit_resumed (...)\n", this->beneath ()->shortname ());
   this->beneath ()->commit_resumed ();
-  gdb_printf (gdb_stdlog, "<- %s->commit_resumed (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->commit_resumed ()\n",
+	      this->beneath ()->shortname ());
 }
 
 ptid_t
@@ -510,15 +511,13 @@ debug_target::wait (ptid_t arg0, struct target_waitstatus *arg1, target_wait_fla
   gdb_printf (gdb_stdlog, "-> %s->wait (...)\n", this->beneath ()->shortname ());
   ptid_t result
     = this->beneath ()->wait (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog, "<- %s->wait (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_target_waitstatus_p (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_target_wait_flags (arg2), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_ptid_t (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->wait (%s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ptid_t (arg0).c_str (),
+	      target_debug_print_target_waitstatus_p (arg1).c_str (),
+	      target_debug_print_target_wait_flags (arg2).c_str (),
+	      target_debug_print_ptid_t (result).c_str ());
   return result;
 }
 
@@ -538,11 +537,11 @@ debug_target::fetch_registers (struct regcache *arg0, int arg1)
 {
   gdb_printf (gdb_stdlog, "-> %s->fetch_registers (...)\n", this->beneath ()->shortname ());
   this->beneath ()->fetch_registers (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->fetch_registers (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_regcache_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->fetch_registers (%s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_regcache_p (arg0).c_str (),
+	      target_debug_print_int (arg1).c_str ());
 }
 
 void
@@ -562,11 +561,11 @@ debug_target::store_registers (struct regcache *arg0, int arg1)
 {
   gdb_printf (gdb_stdlog, "-> %s->store_registers (...)\n", this->beneath ()->shortname ());
   this->beneath ()->store_registers (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->store_registers (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_regcache_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->store_registers (%s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_regcache_p (arg0).c_str (),
+	      target_debug_print_int (arg1).c_str ());
 }
 
 void
@@ -586,9 +585,10 @@ debug_target::prepare_to_store (struct regcache *arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->prepare_to_store (...)\n", this->beneath ()->shortname ());
   this->beneath ()->prepare_to_store (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->prepare_to_store (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_regcache_p (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->prepare_to_store (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_regcache_p (arg0).c_str ());
 }
 
 void
@@ -607,8 +607,9 @@ debug_target::files_info ()
 {
   gdb_printf (gdb_stdlog, "-> %s->files_info (...)\n", this->beneath ()->shortname ());
   this->beneath ()->files_info ();
-  gdb_printf (gdb_stdlog, "<- %s->files_info (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->files_info ()\n",
+	      this->beneath ()->shortname ());
 }
 
 int
@@ -629,13 +630,12 @@ debug_target::insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *ar
   gdb_printf (gdb_stdlog, "-> %s->insert_breakpoint (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->insert_breakpoint (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->insert_breakpoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_gdbarch_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_bp_target_info_p (arg1), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->insert_breakpoint (%s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_gdbarch_p (arg0).c_str (),
+	      target_debug_print_bp_target_info_p (arg1).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -657,15 +657,13 @@ debug_target::remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *ar
   gdb_printf (gdb_stdlog, "-> %s->remove_breakpoint (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->remove_breakpoint (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog, "<- %s->remove_breakpoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_gdbarch_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_bp_target_info_p (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_remove_bp_reason (arg2), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->remove_breakpoint (%s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_gdbarch_p (arg0).c_str (),
+	      target_debug_print_bp_target_info_p (arg1).c_str (),
+	      target_debug_print_remove_bp_reason (arg2).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -687,10 +685,10 @@ debug_target::stopped_by_sw_breakpoint ()
   gdb_printf (gdb_stdlog, "-> %s->stopped_by_sw_breakpoint (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->stopped_by_sw_breakpoint ();
-  gdb_printf (gdb_stdlog, "<- %s->stopped_by_sw_breakpoint (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->stopped_by_sw_breakpoint () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -712,10 +710,10 @@ debug_target::supports_stopped_by_sw_breakpoint ()
   gdb_printf (gdb_stdlog, "-> %s->supports_stopped_by_sw_breakpoint (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_stopped_by_sw_breakpoint ();
-  gdb_printf (gdb_stdlog, "<- %s->supports_stopped_by_sw_breakpoint (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->supports_stopped_by_sw_breakpoint () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -737,10 +735,10 @@ debug_target::stopped_by_hw_breakpoint ()
   gdb_printf (gdb_stdlog, "-> %s->stopped_by_hw_breakpoint (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->stopped_by_hw_breakpoint ();
-  gdb_printf (gdb_stdlog, "<- %s->stopped_by_hw_breakpoint (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->stopped_by_hw_breakpoint () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -762,10 +760,10 @@ debug_target::supports_stopped_by_hw_breakpoint ()
   gdb_printf (gdb_stdlog, "-> %s->supports_stopped_by_hw_breakpoint (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_stopped_by_hw_breakpoint ();
-  gdb_printf (gdb_stdlog, "<- %s->supports_stopped_by_hw_breakpoint (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->supports_stopped_by_hw_breakpoint () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -787,15 +785,13 @@ debug_target::can_use_hw_breakpoint (enum bptype arg0, int arg1, int arg2)
   gdb_printf (gdb_stdlog, "-> %s->can_use_hw_breakpoint (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->can_use_hw_breakpoint (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog, "<- %s->can_use_hw_breakpoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_bptype (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg2), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->can_use_hw_breakpoint (%s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bptype (arg0).c_str (),
+	      target_debug_print_int (arg1).c_str (),
+	      target_debug_print_int (arg2).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -817,10 +813,10 @@ debug_target::ranged_break_num_registers ()
   gdb_printf (gdb_stdlog, "-> %s->ranged_break_num_registers (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->ranged_break_num_registers ();
-  gdb_printf (gdb_stdlog, "<- %s->ranged_break_num_registers (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->ranged_break_num_registers () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -842,13 +838,12 @@ debug_target::insert_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info
   gdb_printf (gdb_stdlog, "-> %s->insert_hw_breakpoint (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->insert_hw_breakpoint (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->insert_hw_breakpoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_gdbarch_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_bp_target_info_p (arg1), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->insert_hw_breakpoint (%s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_gdbarch_p (arg0).c_str (),
+	      target_debug_print_bp_target_info_p (arg1).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -870,13 +865,12 @@ debug_target::remove_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info
   gdb_printf (gdb_stdlog, "-> %s->remove_hw_breakpoint (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->remove_hw_breakpoint (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->remove_hw_breakpoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_gdbarch_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_bp_target_info_p (arg1), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->remove_hw_breakpoint (%s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_gdbarch_p (arg0).c_str (),
+	      target_debug_print_bp_target_info_p (arg1).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -898,17 +892,14 @@ debug_target::remove_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_typ
   gdb_printf (gdb_stdlog, "-> %s->remove_watchpoint (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->remove_watchpoint (arg0, arg1, arg2, arg3);
-  gdb_printf (gdb_stdlog, "<- %s->remove_watchpoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_target_hw_bp_type (arg2), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_expression_p (arg3), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->remove_watchpoint (%s, %s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_CORE_ADDR (arg0).c_str (),
+	      target_debug_print_int (arg1).c_str (),
+	      target_debug_print_target_hw_bp_type (arg2).c_str (),
+	      target_debug_print_expression_p (arg3).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -930,17 +921,14 @@ debug_target::insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_typ
   gdb_printf (gdb_stdlog, "-> %s->insert_watchpoint (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->insert_watchpoint (arg0, arg1, arg2, arg3);
-  gdb_printf (gdb_stdlog, "<- %s->insert_watchpoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_target_hw_bp_type (arg2), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_expression_p (arg3), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->insert_watchpoint (%s, %s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_CORE_ADDR (arg0).c_str (),
+	      target_debug_print_int (arg1).c_str (),
+	      target_debug_print_target_hw_bp_type (arg2).c_str (),
+	      target_debug_print_expression_p (arg3).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -962,15 +950,13 @@ debug_target::insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum targe
   gdb_printf (gdb_stdlog, "-> %s->insert_mask_watchpoint (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->insert_mask_watchpoint (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog, "<- %s->insert_mask_watchpoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_CORE_ADDR (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_target_hw_bp_type (arg2), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->insert_mask_watchpoint (%s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_CORE_ADDR (arg0).c_str (),
+	      target_debug_print_CORE_ADDR (arg1).c_str (),
+	      target_debug_print_target_hw_bp_type (arg2).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -992,15 +978,13 @@ debug_target::remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum targe
   gdb_printf (gdb_stdlog, "-> %s->remove_mask_watchpoint (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->remove_mask_watchpoint (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog, "<- %s->remove_mask_watchpoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_CORE_ADDR (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_target_hw_bp_type (arg2), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->remove_mask_watchpoint (%s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_CORE_ADDR (arg0).c_str (),
+	      target_debug_print_CORE_ADDR (arg1).c_str (),
+	      target_debug_print_target_hw_bp_type (arg2).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -1022,10 +1006,10 @@ debug_target::stopped_by_watchpoint ()
   gdb_printf (gdb_stdlog, "-> %s->stopped_by_watchpoint (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->stopped_by_watchpoint ();
-  gdb_printf (gdb_stdlog, "<- %s->stopped_by_watchpoint (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->stopped_by_watchpoint () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -1047,10 +1031,10 @@ debug_target::have_steppable_watchpoint ()
   gdb_printf (gdb_stdlog, "-> %s->have_steppable_watchpoint (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->have_steppable_watchpoint ();
-  gdb_printf (gdb_stdlog, "<- %s->have_steppable_watchpoint (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->have_steppable_watchpoint () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -1072,11 +1056,11 @@ debug_target::stopped_data_address (CORE_ADDR *arg0)
   gdb_printf (gdb_stdlog, "-> %s->stopped_data_address (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->stopped_data_address (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->stopped_data_address (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_CORE_ADDR_p (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->stopped_data_address (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_CORE_ADDR_p (arg0).c_str (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -1098,15 +1082,13 @@ debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int
   gdb_printf (gdb_stdlog, "-> %s->watchpoint_addr_within_range (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->watchpoint_addr_within_range (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog, "<- %s->watchpoint_addr_within_range (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_CORE_ADDR (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg2), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->watchpoint_addr_within_range (%s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_CORE_ADDR (arg0).c_str (),
+	      target_debug_print_CORE_ADDR (arg1).c_str (),
+	      target_debug_print_int (arg2).c_str (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -1128,13 +1110,12 @@ debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1)
   gdb_printf (gdb_stdlog, "-> %s->region_ok_for_hw_watchpoint (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->region_ok_for_hw_watchpoint (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->region_ok_for_hw_watchpoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->region_ok_for_hw_watchpoint (%s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_CORE_ADDR (arg0).c_str (),
+	      target_debug_print_int (arg1).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -1156,17 +1137,14 @@ debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2
   gdb_printf (gdb_stdlog, "-> %s->can_accel_watchpoint_condition (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->can_accel_watchpoint_condition (arg0, arg1, arg2, arg3);
-  gdb_printf (gdb_stdlog, "<- %s->can_accel_watchpoint_condition (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg2), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_expression_p (arg3), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->can_accel_watchpoint_condition (%s, %s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_CORE_ADDR (arg0).c_str (),
+	      target_debug_print_int (arg1).c_str (),
+	      target_debug_print_int (arg2).c_str (),
+	      target_debug_print_expression_p (arg3).c_str (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -1188,13 +1166,12 @@ debug_target::masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1)
   gdb_printf (gdb_stdlog, "-> %s->masked_watch_num_registers (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->masked_watch_num_registers (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->masked_watch_num_registers (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_CORE_ADDR (arg1), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->masked_watch_num_registers (%s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_CORE_ADDR (arg0).c_str (),
+	      target_debug_print_CORE_ADDR (arg1).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -1216,10 +1193,10 @@ debug_target::can_do_single_step ()
   gdb_printf (gdb_stdlog, "-> %s->can_do_single_step (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->can_do_single_step ();
-  gdb_printf (gdb_stdlog, "<- %s->can_do_single_step (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->can_do_single_step () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -1241,10 +1218,10 @@ debug_target::supports_terminal_ours ()
   gdb_printf (gdb_stdlog, "-> %s->supports_terminal_ours (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_terminal_ours ();
-  gdb_printf (gdb_stdlog, "<- %s->supports_terminal_ours (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->supports_terminal_ours () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -1264,8 +1241,9 @@ debug_target::terminal_init ()
 {
   gdb_printf (gdb_stdlog, "-> %s->terminal_init (...)\n", this->beneath ()->shortname ());
   this->beneath ()->terminal_init ();
-  gdb_printf (gdb_stdlog, "<- %s->terminal_init (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->terminal_init ()\n",
+	      this->beneath ()->shortname ());
 }
 
 void
@@ -1284,8 +1262,9 @@ debug_target::terminal_inferior ()
 {
   gdb_printf (gdb_stdlog, "-> %s->terminal_inferior (...)\n", this->beneath ()->shortname ());
   this->beneath ()->terminal_inferior ();
-  gdb_printf (gdb_stdlog, "<- %s->terminal_inferior (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->terminal_inferior ()\n",
+	      this->beneath ()->shortname ());
 }
 
 void
@@ -1304,8 +1283,9 @@ debug_target::terminal_save_inferior ()
 {
   gdb_printf (gdb_stdlog, "-> %s->terminal_save_inferior (...)\n", this->beneath ()->shortname ());
   this->beneath ()->terminal_save_inferior ();
-  gdb_printf (gdb_stdlog, "<- %s->terminal_save_inferior (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->terminal_save_inferior ()\n",
+	      this->beneath ()->shortname ());
 }
 
 void
@@ -1324,8 +1304,9 @@ debug_target::terminal_ours_for_output ()
 {
   gdb_printf (gdb_stdlog, "-> %s->terminal_ours_for_output (...)\n", this->beneath ()->shortname ());
   this->beneath ()->terminal_ours_for_output ();
-  gdb_printf (gdb_stdlog, "<- %s->terminal_ours_for_output (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->terminal_ours_for_output ()\n",
+	      this->beneath ()->shortname ());
 }
 
 void
@@ -1344,8 +1325,9 @@ debug_target::terminal_ours ()
 {
   gdb_printf (gdb_stdlog, "-> %s->terminal_ours (...)\n", this->beneath ()->shortname ());
   this->beneath ()->terminal_ours ();
-  gdb_printf (gdb_stdlog, "<- %s->terminal_ours (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->terminal_ours ()\n",
+	      this->beneath ()->shortname ());
 }
 
 void
@@ -1365,11 +1347,11 @@ debug_target::terminal_info (const char *arg0, int arg1)
 {
   gdb_printf (gdb_stdlog, "-> %s->terminal_info (...)\n", this->beneath ()->shortname ());
   this->beneath ()->terminal_info (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->terminal_info (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->terminal_info (%s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_char_p (arg0).c_str (),
+	      target_debug_print_int (arg1).c_str ());
 }
 
 void
@@ -1389,8 +1371,9 @@ debug_target::kill ()
 {
   gdb_printf (gdb_stdlog, "-> %s->kill (...)\n", this->beneath ()->shortname ());
   this->beneath ()->kill ();
-  gdb_printf (gdb_stdlog, "<- %s->kill (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->kill ()\n",
+	      this->beneath ()->shortname ());
 }
 
 void
@@ -1410,11 +1393,11 @@ debug_target::load (const char *arg0, int arg1)
 {
   gdb_printf (gdb_stdlog, "-> %s->load (...)\n", this->beneath ()->shortname ());
   this->beneath ()->load (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->load (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->load (%s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_char_p (arg0).c_str (),
+	      target_debug_print_int (arg1).c_str ());
 }
 
 int
@@ -1435,11 +1418,11 @@ debug_target::insert_fork_catchpoint (int arg0)
   gdb_printf (gdb_stdlog, "-> %s->insert_fork_catchpoint (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->insert_fork_catchpoint (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->insert_fork_catchpoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->insert_fork_catchpoint (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (arg0).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -1461,11 +1444,11 @@ debug_target::remove_fork_catchpoint (int arg0)
   gdb_printf (gdb_stdlog, "-> %s->remove_fork_catchpoint (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->remove_fork_catchpoint (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->remove_fork_catchpoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->remove_fork_catchpoint (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (arg0).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -1487,11 +1470,11 @@ debug_target::insert_vfork_catchpoint (int arg0)
   gdb_printf (gdb_stdlog, "-> %s->insert_vfork_catchpoint (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->insert_vfork_catchpoint (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->insert_vfork_catchpoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->insert_vfork_catchpoint (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (arg0).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -1513,11 +1496,11 @@ debug_target::remove_vfork_catchpoint (int arg0)
   gdb_printf (gdb_stdlog, "-> %s->remove_vfork_catchpoint (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->remove_vfork_catchpoint (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->remove_vfork_catchpoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->remove_vfork_catchpoint (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (arg0).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -1538,17 +1521,14 @@ debug_target::follow_fork (inferior *arg0, ptid_t arg1, target_waitkind arg2, bo
 {
   gdb_printf (gdb_stdlog, "-> %s->follow_fork (...)\n", this->beneath ()->shortname ());
   this->beneath ()->follow_fork (arg0, arg1, arg2, arg3, arg4);
-  gdb_printf (gdb_stdlog, "<- %s->follow_fork (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_inferior_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_ptid_t (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_target_waitkind (arg2), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_bool (arg3), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_bool (arg4), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->follow_fork (%s, %s, %s, %s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_inferior_p (arg0).c_str (),
+	      target_debug_print_ptid_t (arg1).c_str (),
+	      target_debug_print_target_waitkind (arg2).c_str (),
+	      target_debug_print_bool (arg3).c_str (),
+	      target_debug_print_bool (arg4).c_str ());
 }
 
 void
@@ -1568,9 +1548,10 @@ debug_target::follow_clone (ptid_t arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->follow_clone (...)\n", this->beneath ()->shortname ());
   this->beneath ()->follow_clone (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->follow_clone (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->follow_clone (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ptid_t (arg0).c_str ());
 }
 
 int
@@ -1591,11 +1572,11 @@ debug_target::insert_exec_catchpoint (int arg0)
   gdb_printf (gdb_stdlog, "-> %s->insert_exec_catchpoint (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->insert_exec_catchpoint (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->insert_exec_catchpoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->insert_exec_catchpoint (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (arg0).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -1617,11 +1598,11 @@ debug_target::remove_exec_catchpoint (int arg0)
   gdb_printf (gdb_stdlog, "-> %s->remove_exec_catchpoint (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->remove_exec_catchpoint (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->remove_exec_catchpoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->remove_exec_catchpoint (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (arg0).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -1641,13 +1622,12 @@ debug_target::follow_exec (inferior *arg0, ptid_t arg1, const char *arg2)
 {
   gdb_printf (gdb_stdlog, "-> %s->follow_exec (...)\n", this->beneath ()->shortname ());
   this->beneath ()->follow_exec (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog, "<- %s->follow_exec (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_inferior_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_ptid_t (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_const_char_p (arg2), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->follow_exec (%s, %s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_inferior_p (arg0).c_str (),
+	      target_debug_print_ptid_t (arg1).c_str (),
+	      target_debug_print_const_char_p (arg2).c_str ());
 }
 
 int
@@ -1668,17 +1648,14 @@ debug_target::set_syscall_catchpoint (int arg0, bool arg1, int arg2, gdb::array_
   gdb_printf (gdb_stdlog, "-> %s->set_syscall_catchpoint (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->set_syscall_catchpoint (arg0, arg1, arg2, arg3);
-  gdb_printf (gdb_stdlog, "<- %s->set_syscall_catchpoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_bool (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg2), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_gdb_array_view_const_int (arg3), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->set_syscall_catchpoint (%s, %s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (arg0).c_str (),
+	      target_debug_print_bool (arg1).c_str (),
+	      target_debug_print_int (arg2).c_str (),
+	      target_debug_print_gdb_array_view_const_int (arg3).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -1699,8 +1676,9 @@ debug_target::mourn_inferior ()
 {
   gdb_printf (gdb_stdlog, "-> %s->mourn_inferior (...)\n", this->beneath ()->shortname ());
   this->beneath ()->mourn_inferior ();
-  gdb_printf (gdb_stdlog, "<- %s->mourn_inferior (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->mourn_inferior ()\n",
+	      this->beneath ()->shortname ());
 }
 
 void
@@ -1719,9 +1697,10 @@ debug_target::pass_signals (gdb::array_view<const unsigned char> arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->pass_signals (...)\n", this->beneath ()->shortname ());
   this->beneath ()->pass_signals (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->pass_signals (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_signals (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->pass_signals (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_signals (arg0).c_str ());
 }
 
 void
@@ -1740,9 +1719,10 @@ debug_target::program_signals (gdb::array_view<const unsigned char> arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->program_signals (...)\n", this->beneath ()->shortname ());
   this->beneath ()->program_signals (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->program_signals (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_signals (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->program_signals (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_signals (arg0).c_str ());
 }
 
 bool
@@ -1763,11 +1743,11 @@ debug_target::thread_alive (ptid_t arg0)
   gdb_printf (gdb_stdlog, "-> %s->thread_alive (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->thread_alive (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->thread_alive (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->thread_alive (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ptid_t (arg0).c_str (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -1787,8 +1767,9 @@ debug_target::update_thread_list ()
 {
   gdb_printf (gdb_stdlog, "-> %s->update_thread_list (...)\n", this->beneath ()->shortname ());
   this->beneath ()->update_thread_list ();
-  gdb_printf (gdb_stdlog, "<- %s->update_thread_list (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->update_thread_list ()\n",
+	      this->beneath ()->shortname ());
 }
 
 std::string
@@ -1809,11 +1790,11 @@ debug_target::pid_to_str (ptid_t arg0)
   gdb_printf (gdb_stdlog, "-> %s->pid_to_str (...)\n", this->beneath ()->shortname ());
   std::string result
     = this->beneath ()->pid_to_str (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->pid_to_str (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_std_string (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->pid_to_str (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ptid_t (arg0).c_str (),
+	      target_debug_print_std_string (result).c_str ());
   return result;
 }
 
@@ -1835,11 +1816,11 @@ debug_target::extra_thread_info (thread_info *arg0)
   gdb_printf (gdb_stdlog, "-> %s->extra_thread_info (...)\n", this->beneath ()->shortname ());
   const char * result
     = this->beneath ()->extra_thread_info (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->extra_thread_info (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_thread_info_p (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_const_char_p (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->extra_thread_info (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_thread_info_p (arg0).c_str (),
+	      target_debug_print_const_char_p (result).c_str ());
   return result;
 }
 
@@ -1861,11 +1842,11 @@ debug_target::thread_name (thread_info *arg0)
   gdb_printf (gdb_stdlog, "-> %s->thread_name (...)\n", this->beneath ()->shortname ());
   const char * result
     = this->beneath ()->thread_name (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->thread_name (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_thread_info_p (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_const_char_p (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->thread_name (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_thread_info_p (arg0).c_str (),
+	      target_debug_print_const_char_p (result).c_str ());
   return result;
 }
 
@@ -1887,15 +1868,13 @@ debug_target::thread_handle_to_thread_info (const gdb_byte *arg0, int arg1, infe
   gdb_printf (gdb_stdlog, "-> %s->thread_handle_to_thread_info (...)\n", this->beneath ()->shortname ());
   thread_info * result
     = this->beneath ()->thread_handle_to_thread_info (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog, "<- %s->thread_handle_to_thread_info (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_const_gdb_byte_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_inferior_p (arg2), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_thread_info_p (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->thread_handle_to_thread_info (%s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_gdb_byte_p (arg0).c_str (),
+	      target_debug_print_int (arg1).c_str (),
+	      target_debug_print_inferior_p (arg2).c_str (),
+	      target_debug_print_thread_info_p (result).c_str ());
   return result;
 }
 
@@ -1917,11 +1896,11 @@ debug_target::thread_info_to_thread_handle (struct thread_info *arg0)
   gdb_printf (gdb_stdlog, "-> %s->thread_info_to_thread_handle (...)\n", this->beneath ()->shortname ());
   gdb::array_view<const_gdb_byte> result
     = this->beneath ()->thread_info_to_thread_handle (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->thread_info_to_thread_handle (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_thread_info_p (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_gdb_array_view_const_gdb_byte (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->thread_info_to_thread_handle (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_thread_info_p (arg0).c_str (),
+	      target_debug_print_gdb_array_view_const_gdb_byte (result).c_str ());
   return result;
 }
 
@@ -1941,9 +1920,10 @@ debug_target::stop (ptid_t arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->stop (...)\n", this->beneath ()->shortname ());
   this->beneath ()->stop (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->stop (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->stop (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ptid_t (arg0).c_str ());
 }
 
 void
@@ -1962,8 +1942,9 @@ debug_target::interrupt ()
 {
   gdb_printf (gdb_stdlog, "-> %s->interrupt (...)\n", this->beneath ()->shortname ());
   this->beneath ()->interrupt ();
-  gdb_printf (gdb_stdlog, "<- %s->interrupt (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->interrupt ()\n",
+	      this->beneath ()->shortname ());
 }
 
 void
@@ -1983,8 +1964,9 @@ debug_target::pass_ctrlc ()
 {
   gdb_printf (gdb_stdlog, "-> %s->pass_ctrlc (...)\n", this->beneath ()->shortname ());
   this->beneath ()->pass_ctrlc ();
-  gdb_printf (gdb_stdlog, "<- %s->pass_ctrlc (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->pass_ctrlc ()\n",
+	      this->beneath ()->shortname ());
 }
 
 void
@@ -2004,11 +1986,11 @@ debug_target::rcmd (const char *arg0, struct ui_file *arg1)
 {
   gdb_printf (gdb_stdlog, "-> %s->rcmd (...)\n", this->beneath ()->shortname ());
   this->beneath ()->rcmd (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->rcmd (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_ui_file_p (arg1), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->rcmd (%s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_char_p (arg0).c_str (),
+	      target_debug_print_ui_file_p (arg1).c_str ());
 }
 
 const char *
@@ -2029,11 +2011,11 @@ debug_target::pid_to_exec_file (int arg0)
   gdb_printf (gdb_stdlog, "-> %s->pid_to_exec_file (...)\n", this->beneath ()->shortname ());
   const char * result
     = this->beneath ()->pid_to_exec_file (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->pid_to_exec_file (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_const_char_p (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->pid_to_exec_file (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (arg0).c_str (),
+	      target_debug_print_const_char_p (result).c_str ());
   return result;
 }
 
@@ -2053,9 +2035,10 @@ debug_target::log_command (const char *arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->log_command (...)\n", this->beneath ()->shortname ());
   this->beneath ()->log_command (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->log_command (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->log_command (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_char_p (arg0).c_str ());
 }
 
 const std::vector<target_section> *
@@ -2076,10 +2059,10 @@ debug_target::get_section_table ()
   gdb_printf (gdb_stdlog, "-> %s->get_section_table (...)\n", this->beneath ()->shortname ());
   const std::vector<target_section> * result
     = this->beneath ()->get_section_table ();
-  gdb_printf (gdb_stdlog, "<- %s->get_section_table (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_const_std_vector_target_section_p (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->get_section_table () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_std_vector_target_section_p (result).c_str ());
   return result;
 }
 
@@ -2101,10 +2084,10 @@ debug_target::get_thread_control_capabilities ()
   gdb_printf (gdb_stdlog, "-> %s->get_thread_control_capabilities (...)\n", this->beneath ()->shortname ());
   thread_control_capabilities result
     = this->beneath ()->get_thread_control_capabilities ();
-  gdb_printf (gdb_stdlog, "<- %s->get_thread_control_capabilities (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_thread_control_capabilities (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->get_thread_control_capabilities () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_thread_control_capabilities (result).c_str ());
   return result;
 }
 
@@ -2126,10 +2109,10 @@ debug_target::attach_no_wait ()
   gdb_printf (gdb_stdlog, "-> %s->attach_no_wait (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->attach_no_wait ();
-  gdb_printf (gdb_stdlog, "<- %s->attach_no_wait (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->attach_no_wait () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -2151,10 +2134,10 @@ debug_target::can_async_p ()
   gdb_printf (gdb_stdlog, "-> %s->can_async_p (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->can_async_p ();
-  gdb_printf (gdb_stdlog, "<- %s->can_async_p (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->can_async_p () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -2176,10 +2159,10 @@ debug_target::is_async_p ()
   gdb_printf (gdb_stdlog, "-> %s->is_async_p (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->is_async_p ();
-  gdb_printf (gdb_stdlog, "<- %s->is_async_p (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->is_async_p () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -2200,9 +2183,10 @@ debug_target::async (bool arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->async (...)\n", this->beneath ()->shortname ());
   this->beneath ()->async (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->async (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_bool (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->async (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (arg0).c_str ());
 }
 
 int
@@ -2223,10 +2207,10 @@ debug_target::async_wait_fd ()
   gdb_printf (gdb_stdlog, "-> %s->async_wait_fd (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->async_wait_fd ();
-  gdb_printf (gdb_stdlog, "<- %s->async_wait_fd (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->async_wait_fd () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -2248,10 +2232,10 @@ debug_target::has_pending_events ()
   gdb_printf (gdb_stdlog, "-> %s->has_pending_events (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->has_pending_events ();
-  gdb_printf (gdb_stdlog, "<- %s->has_pending_events (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->has_pending_events () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -2271,9 +2255,10 @@ debug_target::thread_events (int arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->thread_events (...)\n", this->beneath ()->shortname ());
   this->beneath ()->thread_events (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->thread_events (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->thread_events (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (arg0).c_str ());
 }
 
 bool
@@ -2294,11 +2279,11 @@ debug_target::supports_set_thread_options (gdb_thread_options arg0)
   gdb_printf (gdb_stdlog, "-> %s->supports_set_thread_options (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_set_thread_options (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->supports_set_thread_options (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_gdb_thread_options (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->supports_set_thread_options (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_gdb_thread_options (arg0).c_str (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -2320,10 +2305,10 @@ debug_target::supports_non_stop ()
   gdb_printf (gdb_stdlog, "-> %s->supports_non_stop (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_non_stop ();
-  gdb_printf (gdb_stdlog, "<- %s->supports_non_stop (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->supports_non_stop () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -2345,10 +2330,10 @@ debug_target::always_non_stop_p ()
   gdb_printf (gdb_stdlog, "-> %s->always_non_stop_p (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->always_non_stop_p ();
-  gdb_printf (gdb_stdlog, "<- %s->always_non_stop_p (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->always_non_stop_p () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -2370,13 +2355,12 @@ debug_target::find_memory_regions (find_memory_region_ftype arg0, void *arg1)
   gdb_printf (gdb_stdlog, "-> %s->find_memory_regions (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->find_memory_regions (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->find_memory_regions (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_find_memory_region_ftype (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_void_p (arg1), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->find_memory_regions (%s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_find_memory_region_ftype (arg0).c_str (),
+	      target_debug_print_void_p (arg1).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -2398,13 +2382,12 @@ debug_target::make_corefile_notes (bfd *arg0, int *arg1)
   gdb_printf (gdb_stdlog, "-> %s->make_corefile_notes (...)\n", this->beneath ()->shortname ());
   gdb::unique_xmalloc_ptr<char> result
     = this->beneath ()->make_corefile_notes (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->make_corefile_notes (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_bfd_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int_p (arg1), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_gdb_unique_xmalloc_ptr_char (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->make_corefile_notes (%s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bfd_p (arg0).c_str (),
+	      target_debug_print_int_p (arg1).c_str (),
+	      target_debug_print_gdb_unique_xmalloc_ptr_char (result).c_str ());
   return result;
 }
 
@@ -2426,13 +2409,12 @@ debug_target::get_bookmark (const char *arg0, int arg1)
   gdb_printf (gdb_stdlog, "-> %s->get_bookmark (...)\n", this->beneath ()->shortname ());
   gdb_byte * result
     = this->beneath ()->get_bookmark (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->get_bookmark (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_gdb_byte_p (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->get_bookmark (%s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_char_p (arg0).c_str (),
+	      target_debug_print_int (arg1).c_str (),
+	      target_debug_print_gdb_byte_p (result).c_str ());
   return result;
 }
 
@@ -2453,11 +2435,11 @@ debug_target::goto_bookmark (const gdb_byte *arg0, int arg1)
 {
   gdb_printf (gdb_stdlog, "-> %s->goto_bookmark (...)\n", this->beneath ()->shortname ());
   this->beneath ()->goto_bookmark (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->goto_bookmark (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_const_gdb_byte_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->goto_bookmark (%s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_gdb_byte_p (arg0).c_str (),
+	      target_debug_print_int (arg1).c_str ());
 }
 
 CORE_ADDR
@@ -2478,15 +2460,13 @@ debug_target::get_thread_local_address (ptid_t arg0, CORE_ADDR arg1, CORE_ADDR a
   gdb_printf (gdb_stdlog, "-> %s->get_thread_local_address (...)\n", this->beneath ()->shortname ());
   CORE_ADDR result
     = this->beneath ()->get_thread_local_address (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog, "<- %s->get_thread_local_address (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_CORE_ADDR (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_CORE_ADDR (arg2), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_CORE_ADDR (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->get_thread_local_address (%s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ptid_t (arg0).c_str (),
+	      target_debug_print_CORE_ADDR (arg1).c_str (),
+	      target_debug_print_CORE_ADDR (arg2).c_str (),
+	      target_debug_print_CORE_ADDR (result).c_str ());
   return result;
 }
 
@@ -2508,23 +2488,17 @@ debug_target::xfer_partial (enum target_object arg0, const char *arg1, gdb_byte
   gdb_printf (gdb_stdlog, "-> %s->xfer_partial (...)\n", this->beneath ()->shortname ());
   enum target_xfer_status result
     = this->beneath ()->xfer_partial (arg0, arg1, arg2, arg3, arg4, arg5, arg6);
-  gdb_printf (gdb_stdlog, "<- %s->xfer_partial (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_target_object (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_const_char_p (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_gdb_byte_p (arg2), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_const_gdb_byte_p (arg3), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_ULONGEST (arg4), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_ULONGEST (arg5), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_ULONGEST_p (arg6), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_target_xfer_status (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->xfer_partial (%s, %s, %s, %s, %s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_target_object (arg0).c_str (),
+	      target_debug_print_const_char_p (arg1).c_str (),
+	      target_debug_print_gdb_byte_p (arg2).c_str (),
+	      target_debug_print_const_gdb_byte_p (arg3).c_str (),
+	      target_debug_print_ULONGEST (arg4).c_str (),
+	      target_debug_print_ULONGEST (arg5).c_str (),
+	      target_debug_print_ULONGEST_p (arg6).c_str (),
+	      target_debug_print_target_xfer_status (result).c_str ());
   return result;
 }
 
@@ -2546,10 +2520,10 @@ debug_target::get_memory_xfer_limit ()
   gdb_printf (gdb_stdlog, "-> %s->get_memory_xfer_limit (...)\n", this->beneath ()->shortname ());
   ULONGEST result
     = this->beneath ()->get_memory_xfer_limit ();
-  gdb_printf (gdb_stdlog, "<- %s->get_memory_xfer_limit (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_ULONGEST (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->get_memory_xfer_limit () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ULONGEST (result).c_str ());
   return result;
 }
 
@@ -2571,10 +2545,10 @@ debug_target::memory_map ()
   gdb_printf (gdb_stdlog, "-> %s->memory_map (...)\n", this->beneath ()->shortname ());
   std::vector<mem_region> result
     = this->beneath ()->memory_map ();
-  gdb_printf (gdb_stdlog, "<- %s->memory_map (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_std_vector_mem_region (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->memory_map () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_std_vector_mem_region (result).c_str ());
   return result;
 }
 
@@ -2595,11 +2569,11 @@ debug_target::flash_erase (ULONGEST arg0, LONGEST arg1)
 {
   gdb_printf (gdb_stdlog, "-> %s->flash_erase (...)\n", this->beneath ()->shortname ());
   this->beneath ()->flash_erase (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->flash_erase (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ULONGEST (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_LONGEST (arg1), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->flash_erase (%s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ULONGEST (arg0).c_str (),
+	      target_debug_print_LONGEST (arg1).c_str ());
 }
 
 void
@@ -2619,8 +2593,9 @@ debug_target::flash_done ()
 {
   gdb_printf (gdb_stdlog, "-> %s->flash_done (...)\n", this->beneath ()->shortname ());
   this->beneath ()->flash_done ();
-  gdb_printf (gdb_stdlog, "<- %s->flash_done (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->flash_done ()\n",
+	      this->beneath ()->shortname ());
 }
 
 const struct target_desc *
@@ -2641,10 +2616,10 @@ debug_target::read_description ()
   gdb_printf (gdb_stdlog, "-> %s->read_description (...)\n", this->beneath ()->shortname ());
   const struct target_desc * result
     = this->beneath ()->read_description ();
-  gdb_printf (gdb_stdlog, "<- %s->read_description (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_const_target_desc_p (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->read_description () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_target_desc_p (result).c_str ());
   return result;
 }
 
@@ -2666,13 +2641,12 @@ debug_target::get_ada_task_ptid (long arg0, ULONGEST arg1)
   gdb_printf (gdb_stdlog, "-> %s->get_ada_task_ptid (...)\n", this->beneath ()->shortname ());
   ptid_t result
     = this->beneath ()->get_ada_task_ptid (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->get_ada_task_ptid (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_long (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_ULONGEST (arg1), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_ptid_t (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->get_ada_task_ptid (%s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_long (arg0).c_str (),
+	      target_debug_print_ULONGEST (arg1).c_str (),
+	      target_debug_print_ptid_t (result).c_str ());
   return result;
 }
 
@@ -2694,17 +2668,14 @@ debug_target::auxv_parse (const gdb_byte **arg0, const gdb_byte *arg1, CORE_ADDR
   gdb_printf (gdb_stdlog, "-> %s->auxv_parse (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->auxv_parse (arg0, arg1, arg2, arg3);
-  gdb_printf (gdb_stdlog, "<- %s->auxv_parse (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_const_gdb_byte_pp (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_const_gdb_byte_p (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_CORE_ADDR_p (arg2), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_CORE_ADDR_p (arg3), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->auxv_parse (%s, %s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_gdb_byte_pp (arg0).c_str (),
+	      target_debug_print_const_gdb_byte_p (arg1).c_str (),
+	      target_debug_print_CORE_ADDR_p (arg2).c_str (),
+	      target_debug_print_CORE_ADDR_p (arg3).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -2726,19 +2697,15 @@ debug_target::search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2
   gdb_printf (gdb_stdlog, "-> %s->search_memory (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->search_memory (arg0, arg1, arg2, arg3, arg4);
-  gdb_printf (gdb_stdlog, "<- %s->search_memory (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_ULONGEST (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_const_gdb_byte_p (arg2), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_ULONGEST (arg3), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_CORE_ADDR_p (arg4), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->search_memory (%s, %s, %s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_CORE_ADDR (arg0).c_str (),
+	      target_debug_print_ULONGEST (arg1).c_str (),
+	      target_debug_print_const_gdb_byte_p (arg2).c_str (),
+	      target_debug_print_ULONGEST (arg3).c_str (),
+	      target_debug_print_CORE_ADDR_p (arg4).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -2760,10 +2727,10 @@ debug_target::can_execute_reverse ()
   gdb_printf (gdb_stdlog, "-> %s->can_execute_reverse (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->can_execute_reverse ();
-  gdb_printf (gdb_stdlog, "<- %s->can_execute_reverse (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->can_execute_reverse () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -2785,10 +2752,10 @@ debug_target::execution_direction ()
   gdb_printf (gdb_stdlog, "-> %s->execution_direction (...)\n", this->beneath ()->shortname ());
   enum exec_direction_kind result
     = this->beneath ()->execution_direction ();
-  gdb_printf (gdb_stdlog, "<- %s->execution_direction (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_exec_direction_kind (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->execution_direction () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_exec_direction_kind (result).c_str ());
   return result;
 }
 
@@ -2810,10 +2777,10 @@ debug_target::supports_multi_process ()
   gdb_printf (gdb_stdlog, "-> %s->supports_multi_process (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_multi_process ();
-  gdb_printf (gdb_stdlog, "<- %s->supports_multi_process (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->supports_multi_process () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -2835,10 +2802,10 @@ debug_target::supports_enable_disable_tracepoint ()
   gdb_printf (gdb_stdlog, "-> %s->supports_enable_disable_tracepoint (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_enable_disable_tracepoint ();
-  gdb_printf (gdb_stdlog, "<- %s->supports_enable_disable_tracepoint (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->supports_enable_disable_tracepoint () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -2860,10 +2827,10 @@ debug_target::supports_disable_randomization ()
   gdb_printf (gdb_stdlog, "-> %s->supports_disable_randomization (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_disable_randomization ();
-  gdb_printf (gdb_stdlog, "<- %s->supports_disable_randomization (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->supports_disable_randomization () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -2885,10 +2852,10 @@ debug_target::supports_string_tracing ()
   gdb_printf (gdb_stdlog, "-> %s->supports_string_tracing (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_string_tracing ();
-  gdb_printf (gdb_stdlog, "<- %s->supports_string_tracing (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->supports_string_tracing () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -2910,10 +2877,10 @@ debug_target::supports_evaluation_of_breakpoint_conditions ()
   gdb_printf (gdb_stdlog, "-> %s->supports_evaluation_of_breakpoint_conditions (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_evaluation_of_breakpoint_conditions ();
-  gdb_printf (gdb_stdlog, "<- %s->supports_evaluation_of_breakpoint_conditions (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->supports_evaluation_of_breakpoint_conditions () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -2935,10 +2902,10 @@ debug_target::supports_dumpcore ()
   gdb_printf (gdb_stdlog, "-> %s->supports_dumpcore (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_dumpcore ();
-  gdb_printf (gdb_stdlog, "<- %s->supports_dumpcore (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->supports_dumpcore () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -2958,9 +2925,10 @@ debug_target::dumpcore (const char *arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->dumpcore (...)\n", this->beneath ()->shortname ());
   this->beneath ()->dumpcore (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->dumpcore (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->dumpcore (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_char_p (arg0).c_str ());
 }
 
 bool
@@ -2981,10 +2949,10 @@ debug_target::can_run_breakpoint_commands ()
   gdb_printf (gdb_stdlog, "-> %s->can_run_breakpoint_commands (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->can_run_breakpoint_commands ();
-  gdb_printf (gdb_stdlog, "<- %s->can_run_breakpoint_commands (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->can_run_breakpoint_commands () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -3006,11 +2974,11 @@ debug_target::thread_architecture (ptid_t arg0)
   gdb_printf (gdb_stdlog, "-> %s->thread_architecture (...)\n", this->beneath ()->shortname ());
   struct gdbarch * result
     = this->beneath ()->thread_architecture (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->thread_architecture (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_gdbarch_p (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->thread_architecture (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ptid_t (arg0).c_str (),
+	      target_debug_print_gdbarch_p (result).c_str ());
   return result;
 }
 
@@ -3032,10 +3000,10 @@ debug_target::filesystem_is_local ()
   gdb_printf (gdb_stdlog, "-> %s->filesystem_is_local (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->filesystem_is_local ();
-  gdb_printf (gdb_stdlog, "<- %s->filesystem_is_local (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->filesystem_is_local () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -3056,8 +3024,9 @@ debug_target::trace_init ()
 {
   gdb_printf (gdb_stdlog, "-> %s->trace_init (...)\n", this->beneath ()->shortname ());
   this->beneath ()->trace_init ();
-  gdb_printf (gdb_stdlog, "<- %s->trace_init (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->trace_init ()\n",
+	      this->beneath ()->shortname ());
 }
 
 void
@@ -3077,9 +3046,10 @@ debug_target::download_tracepoint (struct bp_location *arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->download_tracepoint (...)\n", this->beneath ()->shortname ());
   this->beneath ()->download_tracepoint (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->download_tracepoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_bp_location_p (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->download_tracepoint (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bp_location_p (arg0).c_str ());
 }
 
 bool
@@ -3100,10 +3070,10 @@ debug_target::can_download_tracepoint ()
   gdb_printf (gdb_stdlog, "-> %s->can_download_tracepoint (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->can_download_tracepoint ();
-  gdb_printf (gdb_stdlog, "<- %s->can_download_tracepoint (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->can_download_tracepoint () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -3124,9 +3094,10 @@ debug_target::download_trace_state_variable (const trace_state_variable &arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->download_trace_state_variable (...)\n", this->beneath ()->shortname ());
   this->beneath ()->download_trace_state_variable (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->download_trace_state_variable (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_const_trace_state_variable_r (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->download_trace_state_variable (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_trace_state_variable_r (arg0).c_str ());
 }
 
 void
@@ -3146,9 +3117,10 @@ debug_target::enable_tracepoint (struct bp_location *arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->enable_tracepoint (...)\n", this->beneath ()->shortname ());
   this->beneath ()->enable_tracepoint (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->enable_tracepoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_bp_location_p (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->enable_tracepoint (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bp_location_p (arg0).c_str ());
 }
 
 void
@@ -3168,9 +3140,10 @@ debug_target::disable_tracepoint (struct bp_location *arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->disable_tracepoint (...)\n", this->beneath ()->shortname ());
   this->beneath ()->disable_tracepoint (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->disable_tracepoint (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_bp_location_p (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->disable_tracepoint (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bp_location_p (arg0).c_str ());
 }
 
 void
@@ -3190,8 +3163,9 @@ debug_target::trace_set_readonly_regions ()
 {
   gdb_printf (gdb_stdlog, "-> %s->trace_set_readonly_regions (...)\n", this->beneath ()->shortname ());
   this->beneath ()->trace_set_readonly_regions ();
-  gdb_printf (gdb_stdlog, "<- %s->trace_set_readonly_regions (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->trace_set_readonly_regions ()\n",
+	      this->beneath ()->shortname ());
 }
 
 void
@@ -3211,8 +3185,9 @@ debug_target::trace_start ()
 {
   gdb_printf (gdb_stdlog, "-> %s->trace_start (...)\n", this->beneath ()->shortname ());
   this->beneath ()->trace_start ();
-  gdb_printf (gdb_stdlog, "<- %s->trace_start (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->trace_start ()\n",
+	      this->beneath ()->shortname ());
 }
 
 int
@@ -3233,11 +3208,11 @@ debug_target::get_trace_status (struct trace_status *arg0)
   gdb_printf (gdb_stdlog, "-> %s->get_trace_status (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->get_trace_status (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->get_trace_status (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_trace_status_p (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->get_trace_status (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_trace_status_p (arg0).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -3258,11 +3233,11 @@ debug_target::get_tracepoint_status (tracepoint *arg0, struct uploaded_tp *arg1)
 {
   gdb_printf (gdb_stdlog, "-> %s->get_tracepoint_status (...)\n", this->beneath ()->shortname ());
   this->beneath ()->get_tracepoint_status (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->get_tracepoint_status (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_tracepoint_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_uploaded_tp_p (arg1), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->get_tracepoint_status (%s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_tracepoint_p (arg0).c_str (),
+	      target_debug_print_uploaded_tp_p (arg1).c_str ());
 }
 
 void
@@ -3282,8 +3257,9 @@ debug_target::trace_stop ()
 {
   gdb_printf (gdb_stdlog, "-> %s->trace_stop (...)\n", this->beneath ()->shortname ());
   this->beneath ()->trace_stop ();
-  gdb_printf (gdb_stdlog, "<- %s->trace_stop (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->trace_stop ()\n",
+	      this->beneath ()->shortname ());
 }
 
 int
@@ -3304,19 +3280,15 @@ debug_target::trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2, C
   gdb_printf (gdb_stdlog, "-> %s->trace_find (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->trace_find (arg0, arg1, arg2, arg3, arg4);
-  gdb_printf (gdb_stdlog, "<- %s->trace_find (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_trace_find_type (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_CORE_ADDR (arg2), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_CORE_ADDR (arg3), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int_p (arg4), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->trace_find (%s, %s, %s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_trace_find_type (arg0).c_str (),
+	      target_debug_print_int (arg1).c_str (),
+	      target_debug_print_CORE_ADDR (arg2).c_str (),
+	      target_debug_print_CORE_ADDR (arg3).c_str (),
+	      target_debug_print_int_p (arg4).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -3338,13 +3310,12 @@ debug_target::get_trace_state_variable_value (int arg0, LONGEST *arg1)
   gdb_printf (gdb_stdlog, "-> %s->get_trace_state_variable_value (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->get_trace_state_variable_value (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->get_trace_state_variable_value (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_LONGEST_p (arg1), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->get_trace_state_variable_value (%s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (arg0).c_str (),
+	      target_debug_print_LONGEST_p (arg1).c_str (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -3366,11 +3337,11 @@ debug_target::save_trace_data (const char *arg0)
   gdb_printf (gdb_stdlog, "-> %s->save_trace_data (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->save_trace_data (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->save_trace_data (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->save_trace_data (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_char_p (arg0).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -3392,11 +3363,11 @@ debug_target::upload_tracepoints (struct uploaded_tp **arg0)
   gdb_printf (gdb_stdlog, "-> %s->upload_tracepoints (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->upload_tracepoints (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->upload_tracepoints (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_uploaded_tp_pp (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->upload_tracepoints (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_uploaded_tp_pp (arg0).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -3418,11 +3389,11 @@ debug_target::upload_trace_state_variables (struct uploaded_tsv **arg0)
   gdb_printf (gdb_stdlog, "-> %s->upload_trace_state_variables (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->upload_trace_state_variables (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->upload_trace_state_variables (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_uploaded_tsv_pp (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->upload_trace_state_variables (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_uploaded_tsv_pp (arg0).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -3444,15 +3415,13 @@ debug_target::get_raw_trace_data (gdb_byte *arg0, ULONGEST arg1, LONGEST arg2)
   gdb_printf (gdb_stdlog, "-> %s->get_raw_trace_data (...)\n", this->beneath ()->shortname ());
   LONGEST result
     = this->beneath ()->get_raw_trace_data (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog, "<- %s->get_raw_trace_data (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_gdb_byte_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_ULONGEST (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_LONGEST (arg2), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_LONGEST (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->get_raw_trace_data (%s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_gdb_byte_p (arg0).c_str (),
+	      target_debug_print_ULONGEST (arg1).c_str (),
+	      target_debug_print_LONGEST (arg2).c_str (),
+	      target_debug_print_LONGEST (result).c_str ());
   return result;
 }
 
@@ -3474,10 +3443,10 @@ debug_target::get_min_fast_tracepoint_insn_len ()
   gdb_printf (gdb_stdlog, "-> %s->get_min_fast_tracepoint_insn_len (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->get_min_fast_tracepoint_insn_len ();
-  gdb_printf (gdb_stdlog, "<- %s->get_min_fast_tracepoint_insn_len (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->get_min_fast_tracepoint_insn_len () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -3497,9 +3466,10 @@ debug_target::set_disconnected_tracing (int arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->set_disconnected_tracing (...)\n", this->beneath ()->shortname ());
   this->beneath ()->set_disconnected_tracing (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->set_disconnected_tracing (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->set_disconnected_tracing (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (arg0).c_str ());
 }
 
 void
@@ -3518,9 +3488,10 @@ debug_target::set_circular_trace_buffer (int arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->set_circular_trace_buffer (...)\n", this->beneath ()->shortname ());
   this->beneath ()->set_circular_trace_buffer (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->set_circular_trace_buffer (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->set_circular_trace_buffer (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (arg0).c_str ());
 }
 
 void
@@ -3539,9 +3510,10 @@ debug_target::set_trace_buffer_size (LONGEST arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->set_trace_buffer_size (...)\n", this->beneath ()->shortname ());
   this->beneath ()->set_trace_buffer_size (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->set_trace_buffer_size (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_LONGEST (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->set_trace_buffer_size (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_LONGEST (arg0).c_str ());
 }
 
 bool
@@ -3562,15 +3534,13 @@ debug_target::set_trace_notes (const char *arg0, const char *arg1, const char *a
   gdb_printf (gdb_stdlog, "-> %s->set_trace_notes (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->set_trace_notes (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog, "<- %s->set_trace_notes (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_const_char_p (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_const_char_p (arg2), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->set_trace_notes (%s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_char_p (arg0).c_str (),
+	      target_debug_print_const_char_p (arg1).c_str (),
+	      target_debug_print_const_char_p (arg2).c_str (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -3592,11 +3562,11 @@ debug_target::core_of_thread (ptid_t arg0)
   gdb_printf (gdb_stdlog, "-> %s->core_of_thread (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->core_of_thread (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->core_of_thread (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->core_of_thread (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ptid_t (arg0).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -3618,15 +3588,13 @@ debug_target::verify_memory (const gdb_byte *arg0, CORE_ADDR arg1, ULONGEST arg2
   gdb_printf (gdb_stdlog, "-> %s->verify_memory (...)\n", this->beneath ()->shortname ());
   int result
     = this->beneath ()->verify_memory (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog, "<- %s->verify_memory (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_const_gdb_byte_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_CORE_ADDR (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_ULONGEST (arg2), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_int (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->verify_memory (%s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_gdb_byte_p (arg0).c_str (),
+	      target_debug_print_CORE_ADDR (arg1).c_str (),
+	      target_debug_print_ULONGEST (arg2).c_str (),
+	      target_debug_print_int (result).c_str ());
   return result;
 }
 
@@ -3648,13 +3616,12 @@ debug_target::get_tib_address (ptid_t arg0, CORE_ADDR *arg1)
   gdb_printf (gdb_stdlog, "-> %s->get_tib_address (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->get_tib_address (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->get_tib_address (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_CORE_ADDR_p (arg1), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->get_tib_address (%s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ptid_t (arg0).c_str (),
+	      target_debug_print_CORE_ADDR_p (arg1).c_str (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -3674,8 +3641,9 @@ debug_target::set_permissions ()
 {
   gdb_printf (gdb_stdlog, "-> %s->set_permissions (...)\n", this->beneath ()->shortname ());
   this->beneath ()->set_permissions ();
-  gdb_printf (gdb_stdlog, "<- %s->set_permissions (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->set_permissions ()\n",
+	      this->beneath ()->shortname ());
 }
 
 bool
@@ -3696,13 +3664,12 @@ debug_target::static_tracepoint_marker_at (CORE_ADDR arg0, static_tracepoint_mar
   gdb_printf (gdb_stdlog, "-> %s->static_tracepoint_marker_at (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->static_tracepoint_marker_at (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->static_tracepoint_marker_at (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_static_tracepoint_marker_p (arg1), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->static_tracepoint_marker_at (%s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_CORE_ADDR (arg0).c_str (),
+	      target_debug_print_static_tracepoint_marker_p (arg1).c_str (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -3724,11 +3691,11 @@ debug_target::static_tracepoint_markers_by_strid (const char *arg0)
   gdb_printf (gdb_stdlog, "-> %s->static_tracepoint_markers_by_strid (...)\n", this->beneath ()->shortname ());
   std::vector<static_tracepoint_marker> result
     = this->beneath ()->static_tracepoint_markers_by_strid (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->static_tracepoint_markers_by_strid (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_std_vector_static_tracepoint_marker (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->static_tracepoint_markers_by_strid (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_char_p (arg0).c_str (),
+	      target_debug_print_std_vector_static_tracepoint_marker (result).c_str ());
   return result;
 }
 
@@ -3750,10 +3717,10 @@ debug_target::traceframe_info ()
   gdb_printf (gdb_stdlog, "-> %s->traceframe_info (...)\n", this->beneath ()->shortname ());
   traceframe_info_up result
     = this->beneath ()->traceframe_info ();
-  gdb_printf (gdb_stdlog, "<- %s->traceframe_info (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_traceframe_info_up (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->traceframe_info () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_traceframe_info_up (result).c_str ());
   return result;
 }
 
@@ -3775,11 +3742,11 @@ debug_target::use_agent (bool arg0)
   gdb_printf (gdb_stdlog, "-> %s->use_agent (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->use_agent (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->use_agent (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_bool (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->use_agent (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (arg0).c_str (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -3801,10 +3768,10 @@ debug_target::can_use_agent ()
   gdb_printf (gdb_stdlog, "-> %s->can_use_agent (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->can_use_agent ();
-  gdb_printf (gdb_stdlog, "<- %s->can_use_agent (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->can_use_agent () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -3826,13 +3793,12 @@ debug_target::enable_btrace (thread_info *arg0, const struct btrace_config *arg1
   gdb_printf (gdb_stdlog, "-> %s->enable_btrace (...)\n", this->beneath ()->shortname ());
   struct btrace_target_info * result
     = this->beneath ()->enable_btrace (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->enable_btrace (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_thread_info_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_const_btrace_config_p (arg1), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_btrace_target_info_p (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->enable_btrace (%s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_thread_info_p (arg0).c_str (),
+	      target_debug_print_const_btrace_config_p (arg1).c_str (),
+	      target_debug_print_btrace_target_info_p (result).c_str ());
   return result;
 }
 
@@ -3853,9 +3819,10 @@ debug_target::disable_btrace (struct btrace_target_info *arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->disable_btrace (...)\n", this->beneath ()->shortname ());
   this->beneath ()->disable_btrace (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->disable_btrace (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_btrace_target_info_p (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->disable_btrace (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_btrace_target_info_p (arg0).c_str ());
 }
 
 void
@@ -3875,9 +3842,10 @@ debug_target::teardown_btrace (struct btrace_target_info *arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->teardown_btrace (...)\n", this->beneath ()->shortname ());
   this->beneath ()->teardown_btrace (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->teardown_btrace (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_btrace_target_info_p (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->teardown_btrace (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_btrace_target_info_p (arg0).c_str ());
 }
 
 enum btrace_error
@@ -3898,15 +3866,13 @@ debug_target::read_btrace (struct btrace_data *arg0, struct btrace_target_info *
   gdb_printf (gdb_stdlog, "-> %s->read_btrace (...)\n", this->beneath ()->shortname ());
   enum btrace_error result
     = this->beneath ()->read_btrace (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog, "<- %s->read_btrace (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_btrace_data_p (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_btrace_target_info_p (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_btrace_read_type (arg2), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_btrace_error (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->read_btrace (%s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_btrace_data_p (arg0).c_str (),
+	      target_debug_print_btrace_target_info_p (arg1).c_str (),
+	      target_debug_print_btrace_read_type (arg2).c_str (),
+	      target_debug_print_btrace_error (result).c_str ());
   return result;
 }
 
@@ -3928,11 +3894,11 @@ debug_target::btrace_conf (const struct btrace_target_info *arg0)
   gdb_printf (gdb_stdlog, "-> %s->btrace_conf (...)\n", this->beneath ()->shortname ());
   const struct btrace_config * result
     = this->beneath ()->btrace_conf (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->btrace_conf (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_const_btrace_target_info_p (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_const_btrace_config_p (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->btrace_conf (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_btrace_target_info_p (arg0).c_str (),
+	      target_debug_print_const_btrace_config_p (result).c_str ());
   return result;
 }
 
@@ -3954,11 +3920,11 @@ debug_target::record_method (ptid_t arg0)
   gdb_printf (gdb_stdlog, "-> %s->record_method (...)\n", this->beneath ()->shortname ());
   enum record_method result
     = this->beneath ()->record_method (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->record_method (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_record_method (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->record_method (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ptid_t (arg0).c_str (),
+	      target_debug_print_record_method (result).c_str ());
   return result;
 }
 
@@ -3978,8 +3944,9 @@ debug_target::stop_recording ()
 {
   gdb_printf (gdb_stdlog, "-> %s->stop_recording (...)\n", this->beneath ()->shortname ());
   this->beneath ()->stop_recording ();
-  gdb_printf (gdb_stdlog, "<- %s->stop_recording (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->stop_recording ()\n",
+	      this->beneath ()->shortname ());
 }
 
 void
@@ -3998,8 +3965,9 @@ debug_target::info_record ()
 {
   gdb_printf (gdb_stdlog, "-> %s->info_record (...)\n", this->beneath ()->shortname ());
   this->beneath ()->info_record ();
-  gdb_printf (gdb_stdlog, "<- %s->info_record (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->info_record ()\n",
+	      this->beneath ()->shortname ());
 }
 
 void
@@ -4019,9 +3987,10 @@ debug_target::save_record (const char *arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->save_record (...)\n", this->beneath ()->shortname ());
   this->beneath ()->save_record (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->save_record (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_const_char_p (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->save_record (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_char_p (arg0).c_str ());
 }
 
 bool
@@ -4042,10 +4011,10 @@ debug_target::supports_delete_record ()
   gdb_printf (gdb_stdlog, "-> %s->supports_delete_record (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_delete_record ();
-  gdb_printf (gdb_stdlog, "<- %s->supports_delete_record (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->supports_delete_record () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -4066,8 +4035,9 @@ debug_target::delete_record ()
 {
   gdb_printf (gdb_stdlog, "-> %s->delete_record (...)\n", this->beneath ()->shortname ());
   this->beneath ()->delete_record ();
-  gdb_printf (gdb_stdlog, "<- %s->delete_record (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->delete_record ()\n",
+	      this->beneath ()->shortname ());
 }
 
 bool
@@ -4088,11 +4058,11 @@ debug_target::record_is_replaying (ptid_t arg0)
   gdb_printf (gdb_stdlog, "-> %s->record_is_replaying (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->record_is_replaying (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->record_is_replaying (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->record_is_replaying (%s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ptid_t (arg0).c_str (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -4114,13 +4084,12 @@ debug_target::record_will_replay (ptid_t arg0, int arg1)
   gdb_printf (gdb_stdlog, "-> %s->record_will_replay (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->record_will_replay (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->record_will_replay (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ptid_t (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->record_will_replay (%s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ptid_t (arg0).c_str (),
+	      target_debug_print_int (arg1).c_str (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -4140,8 +4109,9 @@ debug_target::record_stop_replaying ()
 {
   gdb_printf (gdb_stdlog, "-> %s->record_stop_replaying (...)\n", this->beneath ()->shortname ());
   this->beneath ()->record_stop_replaying ();
-  gdb_printf (gdb_stdlog, "<- %s->record_stop_replaying (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->record_stop_replaying ()\n",
+	      this->beneath ()->shortname ());
 }
 
 void
@@ -4161,8 +4131,9 @@ debug_target::goto_record_begin ()
 {
   gdb_printf (gdb_stdlog, "-> %s->goto_record_begin (...)\n", this->beneath ()->shortname ());
   this->beneath ()->goto_record_begin ();
-  gdb_printf (gdb_stdlog, "<- %s->goto_record_begin (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->goto_record_begin ()\n",
+	      this->beneath ()->shortname ());
 }
 
 void
@@ -4182,8 +4153,9 @@ debug_target::goto_record_end ()
 {
   gdb_printf (gdb_stdlog, "-> %s->goto_record_end (...)\n", this->beneath ()->shortname ());
   this->beneath ()->goto_record_end ();
-  gdb_printf (gdb_stdlog, "<- %s->goto_record_end (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->goto_record_end ()\n",
+	      this->beneath ()->shortname ());
 }
 
 void
@@ -4203,9 +4175,10 @@ debug_target::goto_record (ULONGEST arg0)
 {
   gdb_printf (gdb_stdlog, "-> %s->goto_record (...)\n", this->beneath ()->shortname ());
   this->beneath ()->goto_record (arg0);
-  gdb_printf (gdb_stdlog, "<- %s->goto_record (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ULONGEST (arg0), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->goto_record (%s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ULONGEST (arg0).c_str ());
 }
 
 void
@@ -4225,11 +4198,11 @@ debug_target::insn_history (int arg0, gdb_disassembly_flags arg1)
 {
   gdb_printf (gdb_stdlog, "-> %s->insn_history (...)\n", this->beneath ()->shortname ());
   this->beneath ()->insn_history (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->insn_history (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_gdb_disassembly_flags (arg1), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->insn_history (%s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (arg0).c_str (),
+	      target_debug_print_gdb_disassembly_flags (arg1).c_str ());
 }
 
 void
@@ -4249,13 +4222,12 @@ debug_target::insn_history_from (ULONGEST arg0, int arg1, gdb_disassembly_flags
 {
   gdb_printf (gdb_stdlog, "-> %s->insn_history_from (...)\n", this->beneath ()->shortname ());
   this->beneath ()->insn_history_from (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog, "<- %s->insn_history_from (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ULONGEST (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_gdb_disassembly_flags (arg2), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->insn_history_from (%s, %s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ULONGEST (arg0).c_str (),
+	      target_debug_print_int (arg1).c_str (),
+	      target_debug_print_gdb_disassembly_flags (arg2).c_str ());
 }
 
 void
@@ -4275,13 +4247,12 @@ debug_target::insn_history_range (ULONGEST arg0, ULONGEST arg1, gdb_disassembly_
 {
   gdb_printf (gdb_stdlog, "-> %s->insn_history_range (...)\n", this->beneath ()->shortname ());
   this->beneath ()->insn_history_range (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog, "<- %s->insn_history_range (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ULONGEST (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_ULONGEST (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_gdb_disassembly_flags (arg2), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->insn_history_range (%s, %s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ULONGEST (arg0).c_str (),
+	      target_debug_print_ULONGEST (arg1).c_str (),
+	      target_debug_print_gdb_disassembly_flags (arg2).c_str ());
 }
 
 void
@@ -4301,11 +4272,11 @@ debug_target::call_history (int arg0, record_print_flags arg1)
 {
   gdb_printf (gdb_stdlog, "-> %s->call_history (...)\n", this->beneath ()->shortname ());
   this->beneath ()->call_history (arg0, arg1);
-  gdb_printf (gdb_stdlog, "<- %s->call_history (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_int (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_record_print_flags (arg1), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->call_history (%s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_int (arg0).c_str (),
+	      target_debug_print_record_print_flags (arg1).c_str ());
 }
 
 void
@@ -4325,13 +4296,12 @@ debug_target::call_history_from (ULONGEST arg0, int arg1, record_print_flags arg
 {
   gdb_printf (gdb_stdlog, "-> %s->call_history_from (...)\n", this->beneath ()->shortname ());
   this->beneath ()->call_history_from (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog, "<- %s->call_history_from (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ULONGEST (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_record_print_flags (arg2), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->call_history_from (%s, %s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ULONGEST (arg0).c_str (),
+	      target_debug_print_int (arg1).c_str (),
+	      target_debug_print_record_print_flags (arg2).c_str ());
 }
 
 void
@@ -4351,13 +4321,12 @@ debug_target::call_history_range (ULONGEST arg0, ULONGEST arg1, record_print_fla
 {
   gdb_printf (gdb_stdlog, "-> %s->call_history_range (...)\n", this->beneath ()->shortname ());
   this->beneath ()->call_history_range (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog, "<- %s->call_history_range (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_ULONGEST (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_ULONGEST (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_record_print_flags (arg2), gdb_stdlog);
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->call_history_range (%s, %s, %s)\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_ULONGEST (arg0).c_str (),
+	      target_debug_print_ULONGEST (arg1).c_str (),
+	      target_debug_print_record_print_flags (arg2).c_str ());
 }
 
 bool
@@ -4378,10 +4347,10 @@ debug_target::augmented_libraries_svr4_read ()
   gdb_printf (gdb_stdlog, "-> %s->augmented_libraries_svr4_read (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->augmented_libraries_svr4_read ();
-  gdb_printf (gdb_stdlog, "<- %s->augmented_libraries_svr4_read (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->augmented_libraries_svr4_read () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -4403,10 +4372,10 @@ debug_target::get_unwinder ()
   gdb_printf (gdb_stdlog, "-> %s->get_unwinder (...)\n", this->beneath ()->shortname ());
   const struct frame_unwind * result
     = this->beneath ()->get_unwinder ();
-  gdb_printf (gdb_stdlog, "<- %s->get_unwinder (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_const_frame_unwind_p (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->get_unwinder () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_frame_unwind_p (result).c_str ());
   return result;
 }
 
@@ -4428,10 +4397,10 @@ debug_target::get_tailcall_unwinder ()
   gdb_printf (gdb_stdlog, "-> %s->get_tailcall_unwinder (...)\n", this->beneath ()->shortname ());
   const struct frame_unwind * result
     = this->beneath ()->get_tailcall_unwinder ();
-  gdb_printf (gdb_stdlog, "<- %s->get_tailcall_unwinder (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_const_frame_unwind_p (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->get_tailcall_unwinder () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_const_frame_unwind_p (result).c_str ());
   return result;
 }
 
@@ -4451,8 +4420,9 @@ debug_target::prepare_to_generate_core ()
 {
   gdb_printf (gdb_stdlog, "-> %s->prepare_to_generate_core (...)\n", this->beneath ()->shortname ());
   this->beneath ()->prepare_to_generate_core ();
-  gdb_printf (gdb_stdlog, "<- %s->prepare_to_generate_core (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->prepare_to_generate_core ()\n",
+	      this->beneath ()->shortname ());
 }
 
 void
@@ -4471,8 +4441,9 @@ debug_target::done_generating_core ()
 {
   gdb_printf (gdb_stdlog, "-> %s->done_generating_core (...)\n", this->beneath ()->shortname ());
   this->beneath ()->done_generating_core ();
-  gdb_printf (gdb_stdlog, "<- %s->done_generating_core (", this->beneath ()->shortname ());
-  gdb_puts (")\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->done_generating_core ()\n",
+	      this->beneath ()->shortname ());
 }
 
 bool
@@ -4493,10 +4464,10 @@ debug_target::supports_memory_tagging ()
   gdb_printf (gdb_stdlog, "-> %s->supports_memory_tagging (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_memory_tagging ();
-  gdb_printf (gdb_stdlog, "<- %s->supports_memory_tagging (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->supports_memory_tagging () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -4518,17 +4489,14 @@ debug_target::fetch_memtags (CORE_ADDR arg0, size_t arg1, gdb::byte_vector &arg2
   gdb_printf (gdb_stdlog, "-> %s->fetch_memtags (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->fetch_memtags (arg0, arg1, arg2, arg3);
-  gdb_printf (gdb_stdlog, "<- %s->fetch_memtags (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_size_t (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_gdb_byte_vector_r (arg2), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg3), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->fetch_memtags (%s, %s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_CORE_ADDR (arg0).c_str (),
+	      target_debug_print_size_t (arg1).c_str (),
+	      target_debug_print_gdb_byte_vector_r (arg2).c_str (),
+	      target_debug_print_int (arg3).c_str (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -4550,17 +4518,14 @@ debug_target::store_memtags (CORE_ADDR arg0, size_t arg1, const gdb::byte_vector
   gdb_printf (gdb_stdlog, "-> %s->store_memtags (...)\n", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->store_memtags (arg0, arg1, arg2, arg3);
-  gdb_printf (gdb_stdlog, "<- %s->store_memtags (", this->beneath ()->shortname ());
-  gdb_puts (target_debug_print_CORE_ADDR (arg0), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_size_t (arg1), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_const_gdb_byte_vector_r (arg2), gdb_stdlog);
-  gdb_puts (", ", gdb_stdlog);
-  gdb_puts (target_debug_print_int (arg3), gdb_stdlog);
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_bool (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->store_memtags (%s, %s, %s, %s) = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_CORE_ADDR (arg0).c_str (),
+	      target_debug_print_size_t (arg1).c_str (),
+	      target_debug_print_const_gdb_byte_vector_r (arg2).c_str (),
+	      target_debug_print_int (arg3).c_str (),
+	      target_debug_print_bool (result).c_str ());
   return result;
 }
 
@@ -4610,9 +4575,9 @@ debug_target::fetch_x86_xsave_layout ()
   gdb_printf (gdb_stdlog, "-> %s->fetch_x86_xsave_layout (...)\n", this->beneath ()->shortname ());
   x86_xsave_layout result
     = this->beneath ()->fetch_x86_xsave_layout ();
-  gdb_printf (gdb_stdlog, "<- %s->fetch_x86_xsave_layout (", this->beneath ()->shortname ());
-  gdb_puts (") = ", gdb_stdlog);
-  target_debug_print_x86_xsave_layout (result);
-  gdb_puts ("\n", gdb_stdlog);
+  gdb_printf (gdb_stdlog,
+	      "<- %s->fetch_x86_xsave_layout () = %s\n",
+	      this->beneath ()->shortname (),
+	      target_debug_print_x86_xsave_layout (result).c_str ());
   return result;
 }
-- 
2.44.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 3/4] gdb: make regcache::debug_print_register return a string
  2024-04-19 19:46 [PATCH v2 1/4] gdb: make target debug functions return std::string Simon Marchi
  2024-04-19 19:46 ` [PATCH v2 2/4] gdb: make debug_target use one-liners Simon Marchi
@ 2024-04-19 19:46 ` Simon Marchi
  2024-04-19 20:23   ` Tom Tromey
  2024-04-19 19:46 ` [PATCH v2 4/4] gdb: add target_debug_printf and target_debug_printf_nofunc Simon Marchi
  2024-04-19 20:22 ` [PATCH v2 1/4] gdb: make target debug functions return std::string Tom Tromey
  3 siblings, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2024-04-19 19:46 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

From: Simon Marchi <simon.marchi@efficios.com>

Rename the method to `register_debug_string`.

This makes it easier to introduce `target_debug_printf` in a subsequent
patch.

Change-Id: I5bb2d49476d17940d503e66f40762e3f1e3baabc
---
 gdb/regcache.c | 28 +++++++++++++++-------------
 gdb/regcache.h |  5 ++---
 gdb/target.c   |  8 ++++----
 3 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/gdb/regcache.c b/gdb/regcache.c
index b7abbe99f3cc..c35a8138a39a 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -1463,36 +1463,38 @@ reg_buffer::num_raw_registers () const
   return gdbarch_num_regs (arch ());
 }
 
-void
-regcache::debug_print_register (const char *func,  int regno)
+std::string
+regcache::register_debug_string (int regno)
 {
   struct gdbarch *gdbarch = arch ();
+  std::string s;
 
-  gdb_printf (gdb_stdlog, "%s ", func);
   if (regno >= 0 && regno < gdbarch_num_regs (gdbarch)
       && gdbarch_register_name (gdbarch, regno)[0] != '\0')
-    gdb_printf (gdb_stdlog, "(%s)",
-		gdbarch_register_name (gdbarch, regno));
+    string_appendf (s, "register %s:", gdbarch_register_name (gdbarch, regno));
   else
-    gdb_printf (gdb_stdlog, "(%d)", regno);
+    string_appendf (s, "register %d:", regno);
+
   if (regno >= 0 && regno < gdbarch_num_regs (gdbarch))
     {
-      enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
       gdb::array_view<gdb_byte> buf = register_buffer (regno);
 
-      gdb_printf (gdb_stdlog, " = ");
+      string_appendf (s, " = ");
+
       for (gdb_byte byte : buf)
-	gdb_printf (gdb_stdlog, "%02x", byte);
+	string_appendf (s, "%02x", byte);
 
       if (buf.size () <= sizeof (LONGEST))
 	{
-	  ULONGEST val = extract_unsigned_integer (buf, byte_order);
+	  ULONGEST val
+	    = extract_unsigned_integer (buf, gdbarch_byte_order (gdbarch));
 
-	  gdb_printf (gdb_stdlog, " %s %s",
-		      core_addr_to_string_nz (val), plongest (val));
+	  string_appendf (s, " %s %s",
+			  core_addr_to_string_nz (val), plongest (val));
 	}
     }
-  gdb_printf (gdb_stdlog, "\n");
+
+    return s;
 }
 
 /* Implement 'maint flush register-cache' command.  */
diff --git a/gdb/regcache.h b/gdb/regcache.h
index 9ba6c79ab0d5..1d049fe7ae8d 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -454,9 +454,8 @@ class regcache : public detached_regcache
     this->m_ptid = ptid;
   }
 
-/* Dump the contents of a register from the register cache to the target
-   debug.  */
-  void debug_print_register (const char *func, int regno);
+  /* Return a string with the contents of a register, suitable for debug output.  */
+  std::string register_debug_string (int regno);
 
 protected:
   regcache (inferior *inf_for_target_calls, gdbarch *gdbarch);
diff --git a/gdb/target.c b/gdb/target.c
index 5c3c1a57dbd2..0a836d1e146e 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -3895,7 +3895,8 @@ target_fetch_registers (struct regcache *regcache, int regno)
 {
   current_inferior ()->top_target ()->fetch_registers (regcache, regno);
   if (targetdebug)
-    regcache->debug_print_register ("target_fetch_registers", regno);
+    gdb_printf (gdb_stdlog, "target_fetch_registers: %s",
+		regcache->register_debug_string (regno).c_str ());
 }
 
 void
@@ -3906,9 +3907,8 @@ target_store_registers (struct regcache *regcache, int regno)
 
   current_inferior ()->top_target ()->store_registers (regcache, regno);
   if (targetdebug)
-    {
-      regcache->debug_print_register ("target_store_registers", regno);
-    }
+    gdb_printf (gdb_stdlog, "target_store_registers: %s",
+		regcache->register_debug_string (regno).c_str ());
 }
 
 int
-- 
2.44.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 4/4] gdb: add target_debug_printf and target_debug_printf_nofunc
  2024-04-19 19:46 [PATCH v2 1/4] gdb: make target debug functions return std::string Simon Marchi
  2024-04-19 19:46 ` [PATCH v2 2/4] gdb: make debug_target use one-liners Simon Marchi
  2024-04-19 19:46 ` [PATCH v2 3/4] gdb: make regcache::debug_print_register return a string Simon Marchi
@ 2024-04-19 19:46 ` Simon Marchi
  2024-04-19 20:22 ` [PATCH v2 1/4] gdb: make target debug functions return std::string Tom Tromey
  3 siblings, 0 replies; 7+ messages in thread
From: Simon Marchi @ 2024-04-19 19:46 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi, Tom Tromey

From: Simon Marchi <simon.marchi@efficios.com>

Add the `target_debug_printf` and `target_debug_printf_nofunc` macros
and use them when outputting debug messages depending on `targetdebug`.
I opted for `target_debug_printf_nofunc` to follow the current style
where the function name is already printed, along with the arguments.

Modify the debug printfs in the `debug_target` methods (generated by
`make-target-delegates.py`) to use `target_debug_printf_nofunc` as well.

This makes the "target" debug prints integrate nicely with the other
debug prints that use the "new" debug print system:

    [infrun] proceed: enter
      [infrun] follow_fork: enter
        [target] -> multi-thread->record_will_replay (...)
        [target] <- multi-thread->record_will_replay (-1, 0) = false
        [target] -> multi-thread->supports_multi_process (...)
        [target] <- multi-thread->supports_multi_process () = true
      [infrun] follow_fork: exit
      ...

Change-Id: Ide3c8c1b8a30e6d4c353a29cba911c7192de29ac
Approved-By: Tom Tromey <tom@tromey.com>
---
 gdb/make-target-delegates.py |  11 +-
 gdb/target-delegates.c       | 840 ++++++++++++++---------------------
 gdb/target.c                 | 129 +++---
 3 files changed, 390 insertions(+), 590 deletions(-)

diff --git a/gdb/make-target-delegates.py b/gdb/make-target-delegates.py
index f6f2bf004ff5..bfcf7faab7ae 100755
--- a/gdb/make-target-delegates.py
+++ b/gdb/make-target-delegates.py
@@ -274,9 +274,7 @@ def write_debugmethod(
     debugname = "debug_target::" + name
     names = write_function_header(f, False, debugname, return_type, argtypes)
     print(
-        '  gdb_printf (gdb_stdlog, "-> %s->'
-        + name
-        + ' (...)\\n", this->beneath ()->shortname ());',
+        f'  target_debug_printf_nofunc ("-> %s->{name} (...)", this->beneath ()->shortname ());',
         file=f,
     )
 
@@ -311,11 +309,8 @@ def write_debugmethod(
         ret = ""
 
     print(
-        (
-            "  gdb_printf (gdb_stdlog,\n"
-            '\t      "<- %s->{name} ({args_fmt}){ret_fmt}\\n",\n'
-            "\t      this->beneath ()->shortname (){args}{ret});"
-        ).format(name=name, args_fmt=args_fmt, args=args, ret_fmt=ret_fmt, ret=ret),
+        f'  target_debug_printf_nofunc ("<- %s->{name} ({args_fmt}){ret_fmt}",\n'
+        f"\t      this->beneath ()->shortname (){args}{ret});",
         file=f,
     )
 
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index b45b445c2c40..af6be0884a1b 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -392,10 +392,9 @@ dummy_target::post_attach (int arg0)
 void
 debug_target::post_attach (int arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->post_attach (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->post_attach (...)", this->beneath ()->shortname ());
   this->beneath ()->post_attach (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->post_attach (%s)\n",
+  target_debug_printf_nofunc ("<- %s->post_attach (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (arg0).c_str ());
 }
@@ -414,10 +413,9 @@ dummy_target::detach (inferior *arg0, int arg1)
 void
 debug_target::detach (inferior *arg0, int arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->detach (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->detach (...)", this->beneath ()->shortname ());
   this->beneath ()->detach (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->detach (%s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->detach (%s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_inferior_p (arg0).c_str (),
 	      target_debug_print_int (arg1).c_str ());
@@ -438,10 +436,9 @@ dummy_target::disconnect (const char *arg0, int arg1)
 void
 debug_target::disconnect (const char *arg0, int arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->disconnect (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->disconnect (...)", this->beneath ()->shortname ());
   this->beneath ()->disconnect (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->disconnect (%s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->disconnect (%s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_char_p (arg0).c_str (),
 	      target_debug_print_int (arg1).c_str ());
@@ -462,10 +459,9 @@ dummy_target::resume (ptid_t arg0, int arg1, enum gdb_signal arg2)
 void
 debug_target::resume (ptid_t arg0, int arg1, enum gdb_signal arg2)
 {
-  gdb_printf (gdb_stdlog, "-> %s->resume (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->resume (...)", this->beneath ()->shortname ());
   this->beneath ()->resume (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->resume (%s, %s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->resume (%s, %s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ptid_t (arg0).c_str (),
 	      target_debug_print_step (arg1).c_str (),
@@ -486,10 +482,9 @@ dummy_target::commit_resumed ()
 void
 debug_target::commit_resumed ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->commit_resumed (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->commit_resumed (...)", this->beneath ()->shortname ());
   this->beneath ()->commit_resumed ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->commit_resumed ()\n",
+  target_debug_printf_nofunc ("<- %s->commit_resumed ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -508,11 +503,10 @@ dummy_target::wait (ptid_t arg0, struct target_waitstatus *arg1, target_wait_fla
 ptid_t
 debug_target::wait (ptid_t arg0, struct target_waitstatus *arg1, target_wait_flags arg2)
 {
-  gdb_printf (gdb_stdlog, "-> %s->wait (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->wait (...)", this->beneath ()->shortname ());
   ptid_t result
     = this->beneath ()->wait (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->wait (%s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->wait (%s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ptid_t (arg0).c_str (),
 	      target_debug_print_target_waitstatus_p (arg1).c_str (),
@@ -535,10 +529,9 @@ dummy_target::fetch_registers (struct regcache *arg0, int arg1)
 void
 debug_target::fetch_registers (struct regcache *arg0, int arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->fetch_registers (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->fetch_registers (...)", this->beneath ()->shortname ());
   this->beneath ()->fetch_registers (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->fetch_registers (%s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->fetch_registers (%s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_regcache_p (arg0).c_str (),
 	      target_debug_print_int (arg1).c_str ());
@@ -559,10 +552,9 @@ dummy_target::store_registers (struct regcache *arg0, int arg1)
 void
 debug_target::store_registers (struct regcache *arg0, int arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->store_registers (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->store_registers (...)", this->beneath ()->shortname ());
   this->beneath ()->store_registers (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->store_registers (%s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->store_registers (%s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_regcache_p (arg0).c_str (),
 	      target_debug_print_int (arg1).c_str ());
@@ -583,10 +575,9 @@ dummy_target::prepare_to_store (struct regcache *arg0)
 void
 debug_target::prepare_to_store (struct regcache *arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->prepare_to_store (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->prepare_to_store (...)", this->beneath ()->shortname ());
   this->beneath ()->prepare_to_store (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->prepare_to_store (%s)\n",
+  target_debug_printf_nofunc ("<- %s->prepare_to_store (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_regcache_p (arg0).c_str ());
 }
@@ -605,10 +596,9 @@ dummy_target::files_info ()
 void
 debug_target::files_info ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->files_info (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->files_info (...)", this->beneath ()->shortname ());
   this->beneath ()->files_info ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->files_info ()\n",
+  target_debug_printf_nofunc ("<- %s->files_info ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -627,11 +617,10 @@ dummy_target::insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *ar
 int
 debug_target::insert_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->insert_breakpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->insert_breakpoint (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->insert_breakpoint (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->insert_breakpoint (%s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->insert_breakpoint (%s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_gdbarch_p (arg0).c_str (),
 	      target_debug_print_bp_target_info_p (arg1).c_str (),
@@ -654,11 +643,10 @@ dummy_target::remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *ar
 int
 debug_target::remove_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1, enum remove_bp_reason arg2)
 {
-  gdb_printf (gdb_stdlog, "-> %s->remove_breakpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->remove_breakpoint (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->remove_breakpoint (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->remove_breakpoint (%s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->remove_breakpoint (%s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_gdbarch_p (arg0).c_str (),
 	      target_debug_print_bp_target_info_p (arg1).c_str (),
@@ -682,11 +670,10 @@ dummy_target::stopped_by_sw_breakpoint ()
 bool
 debug_target::stopped_by_sw_breakpoint ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->stopped_by_sw_breakpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->stopped_by_sw_breakpoint (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->stopped_by_sw_breakpoint ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->stopped_by_sw_breakpoint () = %s\n",
+  target_debug_printf_nofunc ("<- %s->stopped_by_sw_breakpoint () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -707,11 +694,10 @@ dummy_target::supports_stopped_by_sw_breakpoint ()
 bool
 debug_target::supports_stopped_by_sw_breakpoint ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->supports_stopped_by_sw_breakpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->supports_stopped_by_sw_breakpoint (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_stopped_by_sw_breakpoint ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->supports_stopped_by_sw_breakpoint () = %s\n",
+  target_debug_printf_nofunc ("<- %s->supports_stopped_by_sw_breakpoint () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -732,11 +718,10 @@ dummy_target::stopped_by_hw_breakpoint ()
 bool
 debug_target::stopped_by_hw_breakpoint ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->stopped_by_hw_breakpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->stopped_by_hw_breakpoint (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->stopped_by_hw_breakpoint ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->stopped_by_hw_breakpoint () = %s\n",
+  target_debug_printf_nofunc ("<- %s->stopped_by_hw_breakpoint () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -757,11 +742,10 @@ dummy_target::supports_stopped_by_hw_breakpoint ()
 bool
 debug_target::supports_stopped_by_hw_breakpoint ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->supports_stopped_by_hw_breakpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->supports_stopped_by_hw_breakpoint (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_stopped_by_hw_breakpoint ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->supports_stopped_by_hw_breakpoint () = %s\n",
+  target_debug_printf_nofunc ("<- %s->supports_stopped_by_hw_breakpoint () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -782,11 +766,10 @@ dummy_target::can_use_hw_breakpoint (enum bptype arg0, int arg1, int arg2)
 int
 debug_target::can_use_hw_breakpoint (enum bptype arg0, int arg1, int arg2)
 {
-  gdb_printf (gdb_stdlog, "-> %s->can_use_hw_breakpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->can_use_hw_breakpoint (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->can_use_hw_breakpoint (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->can_use_hw_breakpoint (%s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->can_use_hw_breakpoint (%s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bptype (arg0).c_str (),
 	      target_debug_print_int (arg1).c_str (),
@@ -810,11 +793,10 @@ dummy_target::ranged_break_num_registers ()
 int
 debug_target::ranged_break_num_registers ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->ranged_break_num_registers (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->ranged_break_num_registers (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->ranged_break_num_registers ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->ranged_break_num_registers () = %s\n",
+  target_debug_printf_nofunc ("<- %s->ranged_break_num_registers () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (result).c_str ());
   return result;
@@ -835,11 +817,10 @@ dummy_target::insert_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info
 int
 debug_target::insert_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->insert_hw_breakpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->insert_hw_breakpoint (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->insert_hw_breakpoint (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->insert_hw_breakpoint (%s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->insert_hw_breakpoint (%s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_gdbarch_p (arg0).c_str (),
 	      target_debug_print_bp_target_info_p (arg1).c_str (),
@@ -862,11 +843,10 @@ dummy_target::remove_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info
 int
 debug_target::remove_hw_breakpoint (struct gdbarch *arg0, struct bp_target_info *arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->remove_hw_breakpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->remove_hw_breakpoint (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->remove_hw_breakpoint (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->remove_hw_breakpoint (%s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->remove_hw_breakpoint (%s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_gdbarch_p (arg0).c_str (),
 	      target_debug_print_bp_target_info_p (arg1).c_str (),
@@ -889,11 +869,10 @@ dummy_target::remove_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_typ
 int
 debug_target::remove_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3)
 {
-  gdb_printf (gdb_stdlog, "-> %s->remove_watchpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->remove_watchpoint (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->remove_watchpoint (arg0, arg1, arg2, arg3);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->remove_watchpoint (%s, %s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->remove_watchpoint (%s, %s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_CORE_ADDR (arg0).c_str (),
 	      target_debug_print_int (arg1).c_str (),
@@ -918,11 +897,10 @@ dummy_target::insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_typ
 int
 debug_target::insert_watchpoint (CORE_ADDR arg0, int arg1, enum target_hw_bp_type arg2, struct expression *arg3)
 {
-  gdb_printf (gdb_stdlog, "-> %s->insert_watchpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->insert_watchpoint (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->insert_watchpoint (arg0, arg1, arg2, arg3);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->insert_watchpoint (%s, %s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->insert_watchpoint (%s, %s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_CORE_ADDR (arg0).c_str (),
 	      target_debug_print_int (arg1).c_str (),
@@ -947,11 +925,10 @@ dummy_target::insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum targe
 int
 debug_target::insert_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2)
 {
-  gdb_printf (gdb_stdlog, "-> %s->insert_mask_watchpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->insert_mask_watchpoint (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->insert_mask_watchpoint (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->insert_mask_watchpoint (%s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->insert_mask_watchpoint (%s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_CORE_ADDR (arg0).c_str (),
 	      target_debug_print_CORE_ADDR (arg1).c_str (),
@@ -975,11 +952,10 @@ dummy_target::remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum targe
 int
 debug_target::remove_mask_watchpoint (CORE_ADDR arg0, CORE_ADDR arg1, enum target_hw_bp_type arg2)
 {
-  gdb_printf (gdb_stdlog, "-> %s->remove_mask_watchpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->remove_mask_watchpoint (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->remove_mask_watchpoint (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->remove_mask_watchpoint (%s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->remove_mask_watchpoint (%s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_CORE_ADDR (arg0).c_str (),
 	      target_debug_print_CORE_ADDR (arg1).c_str (),
@@ -1003,11 +979,10 @@ dummy_target::stopped_by_watchpoint ()
 bool
 debug_target::stopped_by_watchpoint ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->stopped_by_watchpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->stopped_by_watchpoint (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->stopped_by_watchpoint ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->stopped_by_watchpoint () = %s\n",
+  target_debug_printf_nofunc ("<- %s->stopped_by_watchpoint () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -1028,11 +1003,10 @@ dummy_target::have_steppable_watchpoint ()
 bool
 debug_target::have_steppable_watchpoint ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->have_steppable_watchpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->have_steppable_watchpoint (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->have_steppable_watchpoint ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->have_steppable_watchpoint () = %s\n",
+  target_debug_printf_nofunc ("<- %s->have_steppable_watchpoint () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -1053,11 +1027,10 @@ dummy_target::stopped_data_address (CORE_ADDR *arg0)
 bool
 debug_target::stopped_data_address (CORE_ADDR *arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->stopped_data_address (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->stopped_data_address (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->stopped_data_address (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->stopped_data_address (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->stopped_data_address (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_CORE_ADDR_p (arg0).c_str (),
 	      target_debug_print_bool (result).c_str ());
@@ -1079,11 +1052,10 @@ dummy_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int
 bool
 debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2)
 {
-  gdb_printf (gdb_stdlog, "-> %s->watchpoint_addr_within_range (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->watchpoint_addr_within_range (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->watchpoint_addr_within_range (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->watchpoint_addr_within_range (%s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->watchpoint_addr_within_range (%s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_CORE_ADDR (arg0).c_str (),
 	      target_debug_print_CORE_ADDR (arg1).c_str (),
@@ -1107,11 +1079,10 @@ dummy_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1)
 int
 debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->region_ok_for_hw_watchpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->region_ok_for_hw_watchpoint (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->region_ok_for_hw_watchpoint (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->region_ok_for_hw_watchpoint (%s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->region_ok_for_hw_watchpoint (%s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_CORE_ADDR (arg0).c_str (),
 	      target_debug_print_int (arg1).c_str (),
@@ -1134,11 +1105,10 @@ dummy_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2
 bool
 debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3)
 {
-  gdb_printf (gdb_stdlog, "-> %s->can_accel_watchpoint_condition (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->can_accel_watchpoint_condition (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->can_accel_watchpoint_condition (arg0, arg1, arg2, arg3);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->can_accel_watchpoint_condition (%s, %s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->can_accel_watchpoint_condition (%s, %s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_CORE_ADDR (arg0).c_str (),
 	      target_debug_print_int (arg1).c_str (),
@@ -1163,11 +1133,10 @@ dummy_target::masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1)
 int
 debug_target::masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->masked_watch_num_registers (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->masked_watch_num_registers (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->masked_watch_num_registers (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->masked_watch_num_registers (%s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->masked_watch_num_registers (%s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_CORE_ADDR (arg0).c_str (),
 	      target_debug_print_CORE_ADDR (arg1).c_str (),
@@ -1190,11 +1159,10 @@ dummy_target::can_do_single_step ()
 int
 debug_target::can_do_single_step ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->can_do_single_step (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->can_do_single_step (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->can_do_single_step ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->can_do_single_step () = %s\n",
+  target_debug_printf_nofunc ("<- %s->can_do_single_step () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (result).c_str ());
   return result;
@@ -1215,11 +1183,10 @@ dummy_target::supports_terminal_ours ()
 bool
 debug_target::supports_terminal_ours ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->supports_terminal_ours (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->supports_terminal_ours (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_terminal_ours ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->supports_terminal_ours () = %s\n",
+  target_debug_printf_nofunc ("<- %s->supports_terminal_ours () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -1239,10 +1206,9 @@ dummy_target::terminal_init ()
 void
 debug_target::terminal_init ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->terminal_init (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->terminal_init (...)", this->beneath ()->shortname ());
   this->beneath ()->terminal_init ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->terminal_init ()\n",
+  target_debug_printf_nofunc ("<- %s->terminal_init ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -1260,10 +1226,9 @@ dummy_target::terminal_inferior ()
 void
 debug_target::terminal_inferior ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->terminal_inferior (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->terminal_inferior (...)", this->beneath ()->shortname ());
   this->beneath ()->terminal_inferior ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->terminal_inferior ()\n",
+  target_debug_printf_nofunc ("<- %s->terminal_inferior ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -1281,10 +1246,9 @@ dummy_target::terminal_save_inferior ()
 void
 debug_target::terminal_save_inferior ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->terminal_save_inferior (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->terminal_save_inferior (...)", this->beneath ()->shortname ());
   this->beneath ()->terminal_save_inferior ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->terminal_save_inferior ()\n",
+  target_debug_printf_nofunc ("<- %s->terminal_save_inferior ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -1302,10 +1266,9 @@ dummy_target::terminal_ours_for_output ()
 void
 debug_target::terminal_ours_for_output ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->terminal_ours_for_output (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->terminal_ours_for_output (...)", this->beneath ()->shortname ());
   this->beneath ()->terminal_ours_for_output ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->terminal_ours_for_output ()\n",
+  target_debug_printf_nofunc ("<- %s->terminal_ours_for_output ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -1323,10 +1286,9 @@ dummy_target::terminal_ours ()
 void
 debug_target::terminal_ours ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->terminal_ours (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->terminal_ours (...)", this->beneath ()->shortname ());
   this->beneath ()->terminal_ours ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->terminal_ours ()\n",
+  target_debug_printf_nofunc ("<- %s->terminal_ours ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -1345,10 +1307,9 @@ dummy_target::terminal_info (const char *arg0, int arg1)
 void
 debug_target::terminal_info (const char *arg0, int arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->terminal_info (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->terminal_info (...)", this->beneath ()->shortname ());
   this->beneath ()->terminal_info (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->terminal_info (%s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->terminal_info (%s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_char_p (arg0).c_str (),
 	      target_debug_print_int (arg1).c_str ());
@@ -1369,10 +1330,9 @@ dummy_target::kill ()
 void
 debug_target::kill ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->kill (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->kill (...)", this->beneath ()->shortname ());
   this->beneath ()->kill ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->kill ()\n",
+  target_debug_printf_nofunc ("<- %s->kill ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -1391,10 +1351,9 @@ dummy_target::load (const char *arg0, int arg1)
 void
 debug_target::load (const char *arg0, int arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->load (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->load (...)", this->beneath ()->shortname ());
   this->beneath ()->load (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->load (%s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->load (%s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_char_p (arg0).c_str (),
 	      target_debug_print_int (arg1).c_str ());
@@ -1415,11 +1374,10 @@ dummy_target::insert_fork_catchpoint (int arg0)
 int
 debug_target::insert_fork_catchpoint (int arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->insert_fork_catchpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->insert_fork_catchpoint (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->insert_fork_catchpoint (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->insert_fork_catchpoint (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->insert_fork_catchpoint (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (arg0).c_str (),
 	      target_debug_print_int (result).c_str ());
@@ -1441,11 +1399,10 @@ dummy_target::remove_fork_catchpoint (int arg0)
 int
 debug_target::remove_fork_catchpoint (int arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->remove_fork_catchpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->remove_fork_catchpoint (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->remove_fork_catchpoint (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->remove_fork_catchpoint (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->remove_fork_catchpoint (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (arg0).c_str (),
 	      target_debug_print_int (result).c_str ());
@@ -1467,11 +1424,10 @@ dummy_target::insert_vfork_catchpoint (int arg0)
 int
 debug_target::insert_vfork_catchpoint (int arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->insert_vfork_catchpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->insert_vfork_catchpoint (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->insert_vfork_catchpoint (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->insert_vfork_catchpoint (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->insert_vfork_catchpoint (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (arg0).c_str (),
 	      target_debug_print_int (result).c_str ());
@@ -1493,11 +1449,10 @@ dummy_target::remove_vfork_catchpoint (int arg0)
 int
 debug_target::remove_vfork_catchpoint (int arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->remove_vfork_catchpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->remove_vfork_catchpoint (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->remove_vfork_catchpoint (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->remove_vfork_catchpoint (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->remove_vfork_catchpoint (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (arg0).c_str (),
 	      target_debug_print_int (result).c_str ());
@@ -1519,10 +1474,9 @@ dummy_target::follow_fork (inferior *arg0, ptid_t arg1, target_waitkind arg2, bo
 void
 debug_target::follow_fork (inferior *arg0, ptid_t arg1, target_waitkind arg2, bool arg3, bool arg4)
 {
-  gdb_printf (gdb_stdlog, "-> %s->follow_fork (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->follow_fork (...)", this->beneath ()->shortname ());
   this->beneath ()->follow_fork (arg0, arg1, arg2, arg3, arg4);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->follow_fork (%s, %s, %s, %s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->follow_fork (%s, %s, %s, %s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_inferior_p (arg0).c_str (),
 	      target_debug_print_ptid_t (arg1).c_str (),
@@ -1546,10 +1500,9 @@ dummy_target::follow_clone (ptid_t arg0)
 void
 debug_target::follow_clone (ptid_t arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->follow_clone (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->follow_clone (...)", this->beneath ()->shortname ());
   this->beneath ()->follow_clone (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->follow_clone (%s)\n",
+  target_debug_printf_nofunc ("<- %s->follow_clone (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ptid_t (arg0).c_str ());
 }
@@ -1569,11 +1522,10 @@ dummy_target::insert_exec_catchpoint (int arg0)
 int
 debug_target::insert_exec_catchpoint (int arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->insert_exec_catchpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->insert_exec_catchpoint (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->insert_exec_catchpoint (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->insert_exec_catchpoint (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->insert_exec_catchpoint (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (arg0).c_str (),
 	      target_debug_print_int (result).c_str ());
@@ -1595,11 +1547,10 @@ dummy_target::remove_exec_catchpoint (int arg0)
 int
 debug_target::remove_exec_catchpoint (int arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->remove_exec_catchpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->remove_exec_catchpoint (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->remove_exec_catchpoint (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->remove_exec_catchpoint (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->remove_exec_catchpoint (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (arg0).c_str (),
 	      target_debug_print_int (result).c_str ());
@@ -1620,10 +1571,9 @@ dummy_target::follow_exec (inferior *arg0, ptid_t arg1, const char *arg2)
 void
 debug_target::follow_exec (inferior *arg0, ptid_t arg1, const char *arg2)
 {
-  gdb_printf (gdb_stdlog, "-> %s->follow_exec (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->follow_exec (...)", this->beneath ()->shortname ());
   this->beneath ()->follow_exec (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->follow_exec (%s, %s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->follow_exec (%s, %s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_inferior_p (arg0).c_str (),
 	      target_debug_print_ptid_t (arg1).c_str (),
@@ -1645,11 +1595,10 @@ dummy_target::set_syscall_catchpoint (int arg0, bool arg1, int arg2, gdb::array_
 int
 debug_target::set_syscall_catchpoint (int arg0, bool arg1, int arg2, gdb::array_view<const int> arg3)
 {
-  gdb_printf (gdb_stdlog, "-> %s->set_syscall_catchpoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->set_syscall_catchpoint (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->set_syscall_catchpoint (arg0, arg1, arg2, arg3);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->set_syscall_catchpoint (%s, %s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->set_syscall_catchpoint (%s, %s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (arg0).c_str (),
 	      target_debug_print_bool (arg1).c_str (),
@@ -1674,10 +1623,9 @@ dummy_target::mourn_inferior ()
 void
 debug_target::mourn_inferior ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->mourn_inferior (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->mourn_inferior (...)", this->beneath ()->shortname ());
   this->beneath ()->mourn_inferior ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->mourn_inferior ()\n",
+  target_debug_printf_nofunc ("<- %s->mourn_inferior ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -1695,10 +1643,9 @@ dummy_target::pass_signals (gdb::array_view<const unsigned char> arg0)
 void
 debug_target::pass_signals (gdb::array_view<const unsigned char> arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->pass_signals (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->pass_signals (...)", this->beneath ()->shortname ());
   this->beneath ()->pass_signals (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->pass_signals (%s)\n",
+  target_debug_printf_nofunc ("<- %s->pass_signals (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_signals (arg0).c_str ());
 }
@@ -1717,10 +1664,9 @@ dummy_target::program_signals (gdb::array_view<const unsigned char> arg0)
 void
 debug_target::program_signals (gdb::array_view<const unsigned char> arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->program_signals (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->program_signals (...)", this->beneath ()->shortname ());
   this->beneath ()->program_signals (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->program_signals (%s)\n",
+  target_debug_printf_nofunc ("<- %s->program_signals (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_signals (arg0).c_str ());
 }
@@ -1740,11 +1686,10 @@ dummy_target::thread_alive (ptid_t arg0)
 bool
 debug_target::thread_alive (ptid_t arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->thread_alive (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->thread_alive (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->thread_alive (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->thread_alive (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->thread_alive (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ptid_t (arg0).c_str (),
 	      target_debug_print_bool (result).c_str ());
@@ -1765,10 +1710,9 @@ dummy_target::update_thread_list ()
 void
 debug_target::update_thread_list ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->update_thread_list (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->update_thread_list (...)", this->beneath ()->shortname ());
   this->beneath ()->update_thread_list ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->update_thread_list ()\n",
+  target_debug_printf_nofunc ("<- %s->update_thread_list ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -1787,11 +1731,10 @@ dummy_target::pid_to_str (ptid_t arg0)
 std::string
 debug_target::pid_to_str (ptid_t arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->pid_to_str (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->pid_to_str (...)", this->beneath ()->shortname ());
   std::string result
     = this->beneath ()->pid_to_str (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->pid_to_str (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->pid_to_str (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ptid_t (arg0).c_str (),
 	      target_debug_print_std_string (result).c_str ());
@@ -1813,11 +1756,10 @@ dummy_target::extra_thread_info (thread_info *arg0)
 const char *
 debug_target::extra_thread_info (thread_info *arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->extra_thread_info (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->extra_thread_info (...)", this->beneath ()->shortname ());
   const char * result
     = this->beneath ()->extra_thread_info (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->extra_thread_info (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->extra_thread_info (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_thread_info_p (arg0).c_str (),
 	      target_debug_print_const_char_p (result).c_str ());
@@ -1839,11 +1781,10 @@ dummy_target::thread_name (thread_info *arg0)
 const char *
 debug_target::thread_name (thread_info *arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->thread_name (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->thread_name (...)", this->beneath ()->shortname ());
   const char * result
     = this->beneath ()->thread_name (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->thread_name (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->thread_name (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_thread_info_p (arg0).c_str (),
 	      target_debug_print_const_char_p (result).c_str ());
@@ -1865,11 +1806,10 @@ dummy_target::thread_handle_to_thread_info (const gdb_byte *arg0, int arg1, infe
 thread_info *
 debug_target::thread_handle_to_thread_info (const gdb_byte *arg0, int arg1, inferior *arg2)
 {
-  gdb_printf (gdb_stdlog, "-> %s->thread_handle_to_thread_info (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->thread_handle_to_thread_info (...)", this->beneath ()->shortname ());
   thread_info * result
     = this->beneath ()->thread_handle_to_thread_info (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->thread_handle_to_thread_info (%s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->thread_handle_to_thread_info (%s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_gdb_byte_p (arg0).c_str (),
 	      target_debug_print_int (arg1).c_str (),
@@ -1893,11 +1833,10 @@ dummy_target::thread_info_to_thread_handle (struct thread_info *arg0)
 gdb::array_view<const_gdb_byte>
 debug_target::thread_info_to_thread_handle (struct thread_info *arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->thread_info_to_thread_handle (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->thread_info_to_thread_handle (...)", this->beneath ()->shortname ());
   gdb::array_view<const_gdb_byte> result
     = this->beneath ()->thread_info_to_thread_handle (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->thread_info_to_thread_handle (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->thread_info_to_thread_handle (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_thread_info_p (arg0).c_str (),
 	      target_debug_print_gdb_array_view_const_gdb_byte (result).c_str ());
@@ -1918,10 +1857,9 @@ dummy_target::stop (ptid_t arg0)
 void
 debug_target::stop (ptid_t arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->stop (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->stop (...)", this->beneath ()->shortname ());
   this->beneath ()->stop (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->stop (%s)\n",
+  target_debug_printf_nofunc ("<- %s->stop (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ptid_t (arg0).c_str ());
 }
@@ -1940,10 +1878,9 @@ dummy_target::interrupt ()
 void
 debug_target::interrupt ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->interrupt (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->interrupt (...)", this->beneath ()->shortname ());
   this->beneath ()->interrupt ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->interrupt ()\n",
+  target_debug_printf_nofunc ("<- %s->interrupt ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -1962,10 +1899,9 @@ dummy_target::pass_ctrlc ()
 void
 debug_target::pass_ctrlc ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->pass_ctrlc (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->pass_ctrlc (...)", this->beneath ()->shortname ());
   this->beneath ()->pass_ctrlc ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->pass_ctrlc ()\n",
+  target_debug_printf_nofunc ("<- %s->pass_ctrlc ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -1984,10 +1920,9 @@ dummy_target::rcmd (const char *arg0, struct ui_file *arg1)
 void
 debug_target::rcmd (const char *arg0, struct ui_file *arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->rcmd (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->rcmd (...)", this->beneath ()->shortname ());
   this->beneath ()->rcmd (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->rcmd (%s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->rcmd (%s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_char_p (arg0).c_str (),
 	      target_debug_print_ui_file_p (arg1).c_str ());
@@ -2008,11 +1943,10 @@ dummy_target::pid_to_exec_file (int arg0)
 const char *
 debug_target::pid_to_exec_file (int arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->pid_to_exec_file (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->pid_to_exec_file (...)", this->beneath ()->shortname ());
   const char * result
     = this->beneath ()->pid_to_exec_file (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->pid_to_exec_file (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->pid_to_exec_file (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (arg0).c_str (),
 	      target_debug_print_const_char_p (result).c_str ());
@@ -2033,10 +1967,9 @@ dummy_target::log_command (const char *arg0)
 void
 debug_target::log_command (const char *arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->log_command (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->log_command (...)", this->beneath ()->shortname ());
   this->beneath ()->log_command (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->log_command (%s)\n",
+  target_debug_printf_nofunc ("<- %s->log_command (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_char_p (arg0).c_str ());
 }
@@ -2056,11 +1989,10 @@ dummy_target::get_section_table ()
 const std::vector<target_section> *
 debug_target::get_section_table ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->get_section_table (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->get_section_table (...)", this->beneath ()->shortname ());
   const std::vector<target_section> * result
     = this->beneath ()->get_section_table ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->get_section_table () = %s\n",
+  target_debug_printf_nofunc ("<- %s->get_section_table () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_std_vector_target_section_p (result).c_str ());
   return result;
@@ -2081,11 +2013,10 @@ dummy_target::get_thread_control_capabilities ()
 thread_control_capabilities
 debug_target::get_thread_control_capabilities ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->get_thread_control_capabilities (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->get_thread_control_capabilities (...)", this->beneath ()->shortname ());
   thread_control_capabilities result
     = this->beneath ()->get_thread_control_capabilities ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->get_thread_control_capabilities () = %s\n",
+  target_debug_printf_nofunc ("<- %s->get_thread_control_capabilities () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_thread_control_capabilities (result).c_str ());
   return result;
@@ -2106,11 +2037,10 @@ dummy_target::attach_no_wait ()
 bool
 debug_target::attach_no_wait ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->attach_no_wait (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->attach_no_wait (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->attach_no_wait ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->attach_no_wait () = %s\n",
+  target_debug_printf_nofunc ("<- %s->attach_no_wait () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -2131,11 +2061,10 @@ dummy_target::can_async_p ()
 bool
 debug_target::can_async_p ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->can_async_p (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->can_async_p (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->can_async_p ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->can_async_p () = %s\n",
+  target_debug_printf_nofunc ("<- %s->can_async_p () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -2156,11 +2085,10 @@ dummy_target::is_async_p ()
 bool
 debug_target::is_async_p ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->is_async_p (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->is_async_p (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->is_async_p ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->is_async_p () = %s\n",
+  target_debug_printf_nofunc ("<- %s->is_async_p () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -2181,10 +2109,9 @@ dummy_target::async (bool arg0)
 void
 debug_target::async (bool arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->async (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->async (...)", this->beneath ()->shortname ());
   this->beneath ()->async (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->async (%s)\n",
+  target_debug_printf_nofunc ("<- %s->async (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (arg0).c_str ());
 }
@@ -2204,11 +2131,10 @@ dummy_target::async_wait_fd ()
 int
 debug_target::async_wait_fd ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->async_wait_fd (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->async_wait_fd (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->async_wait_fd ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->async_wait_fd () = %s\n",
+  target_debug_printf_nofunc ("<- %s->async_wait_fd () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (result).c_str ());
   return result;
@@ -2229,11 +2155,10 @@ dummy_target::has_pending_events ()
 bool
 debug_target::has_pending_events ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->has_pending_events (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->has_pending_events (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->has_pending_events ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->has_pending_events () = %s\n",
+  target_debug_printf_nofunc ("<- %s->has_pending_events () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -2253,10 +2178,9 @@ dummy_target::thread_events (int arg0)
 void
 debug_target::thread_events (int arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->thread_events (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->thread_events (...)", this->beneath ()->shortname ());
   this->beneath ()->thread_events (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->thread_events (%s)\n",
+  target_debug_printf_nofunc ("<- %s->thread_events (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (arg0).c_str ());
 }
@@ -2276,11 +2200,10 @@ dummy_target::supports_set_thread_options (gdb_thread_options arg0)
 bool
 debug_target::supports_set_thread_options (gdb_thread_options arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->supports_set_thread_options (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->supports_set_thread_options (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_set_thread_options (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->supports_set_thread_options (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->supports_set_thread_options (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_gdb_thread_options (arg0).c_str (),
 	      target_debug_print_bool (result).c_str ());
@@ -2302,11 +2225,10 @@ dummy_target::supports_non_stop ()
 bool
 debug_target::supports_non_stop ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->supports_non_stop (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->supports_non_stop (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_non_stop ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->supports_non_stop () = %s\n",
+  target_debug_printf_nofunc ("<- %s->supports_non_stop () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -2327,11 +2249,10 @@ dummy_target::always_non_stop_p ()
 bool
 debug_target::always_non_stop_p ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->always_non_stop_p (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->always_non_stop_p (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->always_non_stop_p ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->always_non_stop_p () = %s\n",
+  target_debug_printf_nofunc ("<- %s->always_non_stop_p () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -2352,11 +2273,10 @@ dummy_target::find_memory_regions (find_memory_region_ftype arg0, void *arg1)
 int
 debug_target::find_memory_regions (find_memory_region_ftype arg0, void *arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->find_memory_regions (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->find_memory_regions (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->find_memory_regions (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->find_memory_regions (%s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->find_memory_regions (%s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_find_memory_region_ftype (arg0).c_str (),
 	      target_debug_print_void_p (arg1).c_str (),
@@ -2379,11 +2299,10 @@ dummy_target::make_corefile_notes (bfd *arg0, int *arg1)
 gdb::unique_xmalloc_ptr<char>
 debug_target::make_corefile_notes (bfd *arg0, int *arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->make_corefile_notes (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->make_corefile_notes (...)", this->beneath ()->shortname ());
   gdb::unique_xmalloc_ptr<char> result
     = this->beneath ()->make_corefile_notes (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->make_corefile_notes (%s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->make_corefile_notes (%s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bfd_p (arg0).c_str (),
 	      target_debug_print_int_p (arg1).c_str (),
@@ -2406,11 +2325,10 @@ dummy_target::get_bookmark (const char *arg0, int arg1)
 gdb_byte *
 debug_target::get_bookmark (const char *arg0, int arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->get_bookmark (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->get_bookmark (...)", this->beneath ()->shortname ());
   gdb_byte * result
     = this->beneath ()->get_bookmark (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->get_bookmark (%s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->get_bookmark (%s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_char_p (arg0).c_str (),
 	      target_debug_print_int (arg1).c_str (),
@@ -2433,10 +2351,9 @@ dummy_target::goto_bookmark (const gdb_byte *arg0, int arg1)
 void
 debug_target::goto_bookmark (const gdb_byte *arg0, int arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->goto_bookmark (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->goto_bookmark (...)", this->beneath ()->shortname ());
   this->beneath ()->goto_bookmark (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->goto_bookmark (%s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->goto_bookmark (%s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_gdb_byte_p (arg0).c_str (),
 	      target_debug_print_int (arg1).c_str ());
@@ -2457,11 +2374,10 @@ dummy_target::get_thread_local_address (ptid_t arg0, CORE_ADDR arg1, CORE_ADDR a
 CORE_ADDR
 debug_target::get_thread_local_address (ptid_t arg0, CORE_ADDR arg1, CORE_ADDR arg2)
 {
-  gdb_printf (gdb_stdlog, "-> %s->get_thread_local_address (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->get_thread_local_address (...)", this->beneath ()->shortname ());
   CORE_ADDR result
     = this->beneath ()->get_thread_local_address (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->get_thread_local_address (%s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->get_thread_local_address (%s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ptid_t (arg0).c_str (),
 	      target_debug_print_CORE_ADDR (arg1).c_str (),
@@ -2485,11 +2401,10 @@ dummy_target::xfer_partial (enum target_object arg0, const char *arg1, gdb_byte
 enum target_xfer_status
 debug_target::xfer_partial (enum target_object arg0, const char *arg1, gdb_byte *arg2, const gdb_byte *arg3, ULONGEST arg4, ULONGEST arg5, ULONGEST *arg6)
 {
-  gdb_printf (gdb_stdlog, "-> %s->xfer_partial (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->xfer_partial (...)", this->beneath ()->shortname ());
   enum target_xfer_status result
     = this->beneath ()->xfer_partial (arg0, arg1, arg2, arg3, arg4, arg5, arg6);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->xfer_partial (%s, %s, %s, %s, %s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->xfer_partial (%s, %s, %s, %s, %s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_target_object (arg0).c_str (),
 	      target_debug_print_const_char_p (arg1).c_str (),
@@ -2517,11 +2432,10 @@ dummy_target::get_memory_xfer_limit ()
 ULONGEST
 debug_target::get_memory_xfer_limit ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->get_memory_xfer_limit (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->get_memory_xfer_limit (...)", this->beneath ()->shortname ());
   ULONGEST result
     = this->beneath ()->get_memory_xfer_limit ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->get_memory_xfer_limit () = %s\n",
+  target_debug_printf_nofunc ("<- %s->get_memory_xfer_limit () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ULONGEST (result).c_str ());
   return result;
@@ -2542,11 +2456,10 @@ dummy_target::memory_map ()
 std::vector<mem_region>
 debug_target::memory_map ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->memory_map (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->memory_map (...)", this->beneath ()->shortname ());
   std::vector<mem_region> result
     = this->beneath ()->memory_map ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->memory_map () = %s\n",
+  target_debug_printf_nofunc ("<- %s->memory_map () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_std_vector_mem_region (result).c_str ());
   return result;
@@ -2567,10 +2480,9 @@ dummy_target::flash_erase (ULONGEST arg0, LONGEST arg1)
 void
 debug_target::flash_erase (ULONGEST arg0, LONGEST arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->flash_erase (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->flash_erase (...)", this->beneath ()->shortname ());
   this->beneath ()->flash_erase (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->flash_erase (%s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->flash_erase (%s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ULONGEST (arg0).c_str (),
 	      target_debug_print_LONGEST (arg1).c_str ());
@@ -2591,10 +2503,9 @@ dummy_target::flash_done ()
 void
 debug_target::flash_done ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->flash_done (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->flash_done (...)", this->beneath ()->shortname ());
   this->beneath ()->flash_done ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->flash_done ()\n",
+  target_debug_printf_nofunc ("<- %s->flash_done ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -2613,11 +2524,10 @@ dummy_target::read_description ()
 const struct target_desc *
 debug_target::read_description ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->read_description (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->read_description (...)", this->beneath ()->shortname ());
   const struct target_desc * result
     = this->beneath ()->read_description ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->read_description () = %s\n",
+  target_debug_printf_nofunc ("<- %s->read_description () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_target_desc_p (result).c_str ());
   return result;
@@ -2638,11 +2548,10 @@ dummy_target::get_ada_task_ptid (long arg0, ULONGEST arg1)
 ptid_t
 debug_target::get_ada_task_ptid (long arg0, ULONGEST arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->get_ada_task_ptid (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->get_ada_task_ptid (...)", this->beneath ()->shortname ());
   ptid_t result
     = this->beneath ()->get_ada_task_ptid (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->get_ada_task_ptid (%s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->get_ada_task_ptid (%s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_long (arg0).c_str (),
 	      target_debug_print_ULONGEST (arg1).c_str (),
@@ -2665,11 +2574,10 @@ dummy_target::auxv_parse (const gdb_byte **arg0, const gdb_byte *arg1, CORE_ADDR
 int
 debug_target::auxv_parse (const gdb_byte **arg0, const gdb_byte *arg1, CORE_ADDR *arg2, CORE_ADDR *arg3)
 {
-  gdb_printf (gdb_stdlog, "-> %s->auxv_parse (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->auxv_parse (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->auxv_parse (arg0, arg1, arg2, arg3);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->auxv_parse (%s, %s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->auxv_parse (%s, %s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_gdb_byte_pp (arg0).c_str (),
 	      target_debug_print_const_gdb_byte_p (arg1).c_str (),
@@ -2694,11 +2602,10 @@ dummy_target::search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2
 int
 debug_target::search_memory (CORE_ADDR arg0, ULONGEST arg1, const gdb_byte *arg2, ULONGEST arg3, CORE_ADDR *arg4)
 {
-  gdb_printf (gdb_stdlog, "-> %s->search_memory (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->search_memory (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->search_memory (arg0, arg1, arg2, arg3, arg4);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->search_memory (%s, %s, %s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->search_memory (%s, %s, %s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_CORE_ADDR (arg0).c_str (),
 	      target_debug_print_ULONGEST (arg1).c_str (),
@@ -2724,11 +2631,10 @@ dummy_target::can_execute_reverse ()
 bool
 debug_target::can_execute_reverse ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->can_execute_reverse (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->can_execute_reverse (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->can_execute_reverse ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->can_execute_reverse () = %s\n",
+  target_debug_printf_nofunc ("<- %s->can_execute_reverse () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -2749,11 +2655,10 @@ dummy_target::execution_direction ()
 enum exec_direction_kind
 debug_target::execution_direction ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->execution_direction (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->execution_direction (...)", this->beneath ()->shortname ());
   enum exec_direction_kind result
     = this->beneath ()->execution_direction ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->execution_direction () = %s\n",
+  target_debug_printf_nofunc ("<- %s->execution_direction () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_exec_direction_kind (result).c_str ());
   return result;
@@ -2774,11 +2679,10 @@ dummy_target::supports_multi_process ()
 bool
 debug_target::supports_multi_process ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->supports_multi_process (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->supports_multi_process (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_multi_process ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->supports_multi_process () = %s\n",
+  target_debug_printf_nofunc ("<- %s->supports_multi_process () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -2799,11 +2703,10 @@ dummy_target::supports_enable_disable_tracepoint ()
 bool
 debug_target::supports_enable_disable_tracepoint ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->supports_enable_disable_tracepoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->supports_enable_disable_tracepoint (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_enable_disable_tracepoint ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->supports_enable_disable_tracepoint () = %s\n",
+  target_debug_printf_nofunc ("<- %s->supports_enable_disable_tracepoint () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -2824,11 +2727,10 @@ dummy_target::supports_disable_randomization ()
 bool
 debug_target::supports_disable_randomization ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->supports_disable_randomization (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->supports_disable_randomization (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_disable_randomization ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->supports_disable_randomization () = %s\n",
+  target_debug_printf_nofunc ("<- %s->supports_disable_randomization () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -2849,11 +2751,10 @@ dummy_target::supports_string_tracing ()
 bool
 debug_target::supports_string_tracing ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->supports_string_tracing (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->supports_string_tracing (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_string_tracing ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->supports_string_tracing () = %s\n",
+  target_debug_printf_nofunc ("<- %s->supports_string_tracing () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -2874,11 +2775,10 @@ dummy_target::supports_evaluation_of_breakpoint_conditions ()
 bool
 debug_target::supports_evaluation_of_breakpoint_conditions ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->supports_evaluation_of_breakpoint_conditions (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->supports_evaluation_of_breakpoint_conditions (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_evaluation_of_breakpoint_conditions ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->supports_evaluation_of_breakpoint_conditions () = %s\n",
+  target_debug_printf_nofunc ("<- %s->supports_evaluation_of_breakpoint_conditions () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -2899,11 +2799,10 @@ dummy_target::supports_dumpcore ()
 bool
 debug_target::supports_dumpcore ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->supports_dumpcore (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->supports_dumpcore (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_dumpcore ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->supports_dumpcore () = %s\n",
+  target_debug_printf_nofunc ("<- %s->supports_dumpcore () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -2923,10 +2822,9 @@ dummy_target::dumpcore (const char *arg0)
 void
 debug_target::dumpcore (const char *arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->dumpcore (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->dumpcore (...)", this->beneath ()->shortname ());
   this->beneath ()->dumpcore (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->dumpcore (%s)\n",
+  target_debug_printf_nofunc ("<- %s->dumpcore (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_char_p (arg0).c_str ());
 }
@@ -2946,11 +2844,10 @@ dummy_target::can_run_breakpoint_commands ()
 bool
 debug_target::can_run_breakpoint_commands ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->can_run_breakpoint_commands (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->can_run_breakpoint_commands (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->can_run_breakpoint_commands ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->can_run_breakpoint_commands () = %s\n",
+  target_debug_printf_nofunc ("<- %s->can_run_breakpoint_commands () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -2971,11 +2868,10 @@ dummy_target::thread_architecture (ptid_t arg0)
 struct gdbarch *
 debug_target::thread_architecture (ptid_t arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->thread_architecture (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->thread_architecture (...)", this->beneath ()->shortname ());
   struct gdbarch * result
     = this->beneath ()->thread_architecture (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->thread_architecture (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->thread_architecture (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ptid_t (arg0).c_str (),
 	      target_debug_print_gdbarch_p (result).c_str ());
@@ -2997,11 +2893,10 @@ dummy_target::filesystem_is_local ()
 bool
 debug_target::filesystem_is_local ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->filesystem_is_local (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->filesystem_is_local (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->filesystem_is_local ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->filesystem_is_local () = %s\n",
+  target_debug_printf_nofunc ("<- %s->filesystem_is_local () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -3022,10 +2917,9 @@ dummy_target::trace_init ()
 void
 debug_target::trace_init ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->trace_init (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->trace_init (...)", this->beneath ()->shortname ());
   this->beneath ()->trace_init ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->trace_init ()\n",
+  target_debug_printf_nofunc ("<- %s->trace_init ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -3044,10 +2938,9 @@ dummy_target::download_tracepoint (struct bp_location *arg0)
 void
 debug_target::download_tracepoint (struct bp_location *arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->download_tracepoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->download_tracepoint (...)", this->beneath ()->shortname ());
   this->beneath ()->download_tracepoint (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->download_tracepoint (%s)\n",
+  target_debug_printf_nofunc ("<- %s->download_tracepoint (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bp_location_p (arg0).c_str ());
 }
@@ -3067,11 +2960,10 @@ dummy_target::can_download_tracepoint ()
 bool
 debug_target::can_download_tracepoint ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->can_download_tracepoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->can_download_tracepoint (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->can_download_tracepoint ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->can_download_tracepoint () = %s\n",
+  target_debug_printf_nofunc ("<- %s->can_download_tracepoint () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -3092,10 +2984,9 @@ dummy_target::download_trace_state_variable (const trace_state_variable &arg0)
 void
 debug_target::download_trace_state_variable (const trace_state_variable &arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->download_trace_state_variable (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->download_trace_state_variable (...)", this->beneath ()->shortname ());
   this->beneath ()->download_trace_state_variable (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->download_trace_state_variable (%s)\n",
+  target_debug_printf_nofunc ("<- %s->download_trace_state_variable (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_trace_state_variable_r (arg0).c_str ());
 }
@@ -3115,10 +3006,9 @@ dummy_target::enable_tracepoint (struct bp_location *arg0)
 void
 debug_target::enable_tracepoint (struct bp_location *arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->enable_tracepoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->enable_tracepoint (...)", this->beneath ()->shortname ());
   this->beneath ()->enable_tracepoint (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->enable_tracepoint (%s)\n",
+  target_debug_printf_nofunc ("<- %s->enable_tracepoint (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bp_location_p (arg0).c_str ());
 }
@@ -3138,10 +3028,9 @@ dummy_target::disable_tracepoint (struct bp_location *arg0)
 void
 debug_target::disable_tracepoint (struct bp_location *arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->disable_tracepoint (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->disable_tracepoint (...)", this->beneath ()->shortname ());
   this->beneath ()->disable_tracepoint (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->disable_tracepoint (%s)\n",
+  target_debug_printf_nofunc ("<- %s->disable_tracepoint (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bp_location_p (arg0).c_str ());
 }
@@ -3161,10 +3050,9 @@ dummy_target::trace_set_readonly_regions ()
 void
 debug_target::trace_set_readonly_regions ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->trace_set_readonly_regions (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->trace_set_readonly_regions (...)", this->beneath ()->shortname ());
   this->beneath ()->trace_set_readonly_regions ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->trace_set_readonly_regions ()\n",
+  target_debug_printf_nofunc ("<- %s->trace_set_readonly_regions ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -3183,10 +3071,9 @@ dummy_target::trace_start ()
 void
 debug_target::trace_start ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->trace_start (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->trace_start (...)", this->beneath ()->shortname ());
   this->beneath ()->trace_start ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->trace_start ()\n",
+  target_debug_printf_nofunc ("<- %s->trace_start ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -3205,11 +3092,10 @@ dummy_target::get_trace_status (struct trace_status *arg0)
 int
 debug_target::get_trace_status (struct trace_status *arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->get_trace_status (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->get_trace_status (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->get_trace_status (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->get_trace_status (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->get_trace_status (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_trace_status_p (arg0).c_str (),
 	      target_debug_print_int (result).c_str ());
@@ -3231,10 +3117,9 @@ dummy_target::get_tracepoint_status (tracepoint *arg0, struct uploaded_tp *arg1)
 void
 debug_target::get_tracepoint_status (tracepoint *arg0, struct uploaded_tp *arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->get_tracepoint_status (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->get_tracepoint_status (...)", this->beneath ()->shortname ());
   this->beneath ()->get_tracepoint_status (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->get_tracepoint_status (%s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->get_tracepoint_status (%s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_tracepoint_p (arg0).c_str (),
 	      target_debug_print_uploaded_tp_p (arg1).c_str ());
@@ -3255,10 +3140,9 @@ dummy_target::trace_stop ()
 void
 debug_target::trace_stop ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->trace_stop (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->trace_stop (...)", this->beneath ()->shortname ());
   this->beneath ()->trace_stop ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->trace_stop ()\n",
+  target_debug_printf_nofunc ("<- %s->trace_stop ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -3277,11 +3161,10 @@ dummy_target::trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2, C
 int
 debug_target::trace_find (enum trace_find_type arg0, int arg1, CORE_ADDR arg2, CORE_ADDR arg3, int *arg4)
 {
-  gdb_printf (gdb_stdlog, "-> %s->trace_find (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->trace_find (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->trace_find (arg0, arg1, arg2, arg3, arg4);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->trace_find (%s, %s, %s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->trace_find (%s, %s, %s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_trace_find_type (arg0).c_str (),
 	      target_debug_print_int (arg1).c_str (),
@@ -3307,11 +3190,10 @@ dummy_target::get_trace_state_variable_value (int arg0, LONGEST *arg1)
 bool
 debug_target::get_trace_state_variable_value (int arg0, LONGEST *arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->get_trace_state_variable_value (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->get_trace_state_variable_value (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->get_trace_state_variable_value (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->get_trace_state_variable_value (%s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->get_trace_state_variable_value (%s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (arg0).c_str (),
 	      target_debug_print_LONGEST_p (arg1).c_str (),
@@ -3334,11 +3216,10 @@ dummy_target::save_trace_data (const char *arg0)
 int
 debug_target::save_trace_data (const char *arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->save_trace_data (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->save_trace_data (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->save_trace_data (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->save_trace_data (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->save_trace_data (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_char_p (arg0).c_str (),
 	      target_debug_print_int (result).c_str ());
@@ -3360,11 +3241,10 @@ dummy_target::upload_tracepoints (struct uploaded_tp **arg0)
 int
 debug_target::upload_tracepoints (struct uploaded_tp **arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->upload_tracepoints (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->upload_tracepoints (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->upload_tracepoints (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->upload_tracepoints (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->upload_tracepoints (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_uploaded_tp_pp (arg0).c_str (),
 	      target_debug_print_int (result).c_str ());
@@ -3386,11 +3266,10 @@ dummy_target::upload_trace_state_variables (struct uploaded_tsv **arg0)
 int
 debug_target::upload_trace_state_variables (struct uploaded_tsv **arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->upload_trace_state_variables (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->upload_trace_state_variables (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->upload_trace_state_variables (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->upload_trace_state_variables (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->upload_trace_state_variables (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_uploaded_tsv_pp (arg0).c_str (),
 	      target_debug_print_int (result).c_str ());
@@ -3412,11 +3291,10 @@ dummy_target::get_raw_trace_data (gdb_byte *arg0, ULONGEST arg1, LONGEST arg2)
 LONGEST
 debug_target::get_raw_trace_data (gdb_byte *arg0, ULONGEST arg1, LONGEST arg2)
 {
-  gdb_printf (gdb_stdlog, "-> %s->get_raw_trace_data (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->get_raw_trace_data (...)", this->beneath ()->shortname ());
   LONGEST result
     = this->beneath ()->get_raw_trace_data (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->get_raw_trace_data (%s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->get_raw_trace_data (%s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_gdb_byte_p (arg0).c_str (),
 	      target_debug_print_ULONGEST (arg1).c_str (),
@@ -3440,11 +3318,10 @@ dummy_target::get_min_fast_tracepoint_insn_len ()
 int
 debug_target::get_min_fast_tracepoint_insn_len ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->get_min_fast_tracepoint_insn_len (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->get_min_fast_tracepoint_insn_len (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->get_min_fast_tracepoint_insn_len ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->get_min_fast_tracepoint_insn_len () = %s\n",
+  target_debug_printf_nofunc ("<- %s->get_min_fast_tracepoint_insn_len () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (result).c_str ());
   return result;
@@ -3464,10 +3341,9 @@ dummy_target::set_disconnected_tracing (int arg0)
 void
 debug_target::set_disconnected_tracing (int arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->set_disconnected_tracing (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->set_disconnected_tracing (...)", this->beneath ()->shortname ());
   this->beneath ()->set_disconnected_tracing (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->set_disconnected_tracing (%s)\n",
+  target_debug_printf_nofunc ("<- %s->set_disconnected_tracing (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (arg0).c_str ());
 }
@@ -3486,10 +3362,9 @@ dummy_target::set_circular_trace_buffer (int arg0)
 void
 debug_target::set_circular_trace_buffer (int arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->set_circular_trace_buffer (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->set_circular_trace_buffer (...)", this->beneath ()->shortname ());
   this->beneath ()->set_circular_trace_buffer (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->set_circular_trace_buffer (%s)\n",
+  target_debug_printf_nofunc ("<- %s->set_circular_trace_buffer (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (arg0).c_str ());
 }
@@ -3508,10 +3383,9 @@ dummy_target::set_trace_buffer_size (LONGEST arg0)
 void
 debug_target::set_trace_buffer_size (LONGEST arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->set_trace_buffer_size (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->set_trace_buffer_size (...)", this->beneath ()->shortname ());
   this->beneath ()->set_trace_buffer_size (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->set_trace_buffer_size (%s)\n",
+  target_debug_printf_nofunc ("<- %s->set_trace_buffer_size (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_LONGEST (arg0).c_str ());
 }
@@ -3531,11 +3405,10 @@ dummy_target::set_trace_notes (const char *arg0, const char *arg1, const char *a
 bool
 debug_target::set_trace_notes (const char *arg0, const char *arg1, const char *arg2)
 {
-  gdb_printf (gdb_stdlog, "-> %s->set_trace_notes (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->set_trace_notes (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->set_trace_notes (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->set_trace_notes (%s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->set_trace_notes (%s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_char_p (arg0).c_str (),
 	      target_debug_print_const_char_p (arg1).c_str (),
@@ -3559,11 +3432,10 @@ dummy_target::core_of_thread (ptid_t arg0)
 int
 debug_target::core_of_thread (ptid_t arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->core_of_thread (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->core_of_thread (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->core_of_thread (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->core_of_thread (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->core_of_thread (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ptid_t (arg0).c_str (),
 	      target_debug_print_int (result).c_str ());
@@ -3585,11 +3457,10 @@ dummy_target::verify_memory (const gdb_byte *arg0, CORE_ADDR arg1, ULONGEST arg2
 int
 debug_target::verify_memory (const gdb_byte *arg0, CORE_ADDR arg1, ULONGEST arg2)
 {
-  gdb_printf (gdb_stdlog, "-> %s->verify_memory (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->verify_memory (...)", this->beneath ()->shortname ());
   int result
     = this->beneath ()->verify_memory (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->verify_memory (%s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->verify_memory (%s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_gdb_byte_p (arg0).c_str (),
 	      target_debug_print_CORE_ADDR (arg1).c_str (),
@@ -3613,11 +3484,10 @@ dummy_target::get_tib_address (ptid_t arg0, CORE_ADDR *arg1)
 bool
 debug_target::get_tib_address (ptid_t arg0, CORE_ADDR *arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->get_tib_address (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->get_tib_address (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->get_tib_address (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->get_tib_address (%s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->get_tib_address (%s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ptid_t (arg0).c_str (),
 	      target_debug_print_CORE_ADDR_p (arg1).c_str (),
@@ -3639,10 +3509,9 @@ dummy_target::set_permissions ()
 void
 debug_target::set_permissions ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->set_permissions (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->set_permissions (...)", this->beneath ()->shortname ());
   this->beneath ()->set_permissions ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->set_permissions ()\n",
+  target_debug_printf_nofunc ("<- %s->set_permissions ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -3661,11 +3530,10 @@ dummy_target::static_tracepoint_marker_at (CORE_ADDR arg0, static_tracepoint_mar
 bool
 debug_target::static_tracepoint_marker_at (CORE_ADDR arg0, static_tracepoint_marker *arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->static_tracepoint_marker_at (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->static_tracepoint_marker_at (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->static_tracepoint_marker_at (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->static_tracepoint_marker_at (%s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->static_tracepoint_marker_at (%s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_CORE_ADDR (arg0).c_str (),
 	      target_debug_print_static_tracepoint_marker_p (arg1).c_str (),
@@ -3688,11 +3556,10 @@ dummy_target::static_tracepoint_markers_by_strid (const char *arg0)
 std::vector<static_tracepoint_marker>
 debug_target::static_tracepoint_markers_by_strid (const char *arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->static_tracepoint_markers_by_strid (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->static_tracepoint_markers_by_strid (...)", this->beneath ()->shortname ());
   std::vector<static_tracepoint_marker> result
     = this->beneath ()->static_tracepoint_markers_by_strid (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->static_tracepoint_markers_by_strid (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->static_tracepoint_markers_by_strid (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_char_p (arg0).c_str (),
 	      target_debug_print_std_vector_static_tracepoint_marker (result).c_str ());
@@ -3714,11 +3581,10 @@ dummy_target::traceframe_info ()
 traceframe_info_up
 debug_target::traceframe_info ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->traceframe_info (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->traceframe_info (...)", this->beneath ()->shortname ());
   traceframe_info_up result
     = this->beneath ()->traceframe_info ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->traceframe_info () = %s\n",
+  target_debug_printf_nofunc ("<- %s->traceframe_info () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_traceframe_info_up (result).c_str ());
   return result;
@@ -3739,11 +3605,10 @@ dummy_target::use_agent (bool arg0)
 bool
 debug_target::use_agent (bool arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->use_agent (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->use_agent (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->use_agent (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->use_agent (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->use_agent (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (arg0).c_str (),
 	      target_debug_print_bool (result).c_str ());
@@ -3765,11 +3630,10 @@ dummy_target::can_use_agent ()
 bool
 debug_target::can_use_agent ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->can_use_agent (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->can_use_agent (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->can_use_agent ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->can_use_agent () = %s\n",
+  target_debug_printf_nofunc ("<- %s->can_use_agent () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -3790,11 +3654,10 @@ dummy_target::enable_btrace (thread_info *arg0, const struct btrace_config *arg1
 struct btrace_target_info *
 debug_target::enable_btrace (thread_info *arg0, const struct btrace_config *arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->enable_btrace (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->enable_btrace (...)", this->beneath ()->shortname ());
   struct btrace_target_info * result
     = this->beneath ()->enable_btrace (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->enable_btrace (%s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->enable_btrace (%s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_thread_info_p (arg0).c_str (),
 	      target_debug_print_const_btrace_config_p (arg1).c_str (),
@@ -3817,10 +3680,9 @@ dummy_target::disable_btrace (struct btrace_target_info *arg0)
 void
 debug_target::disable_btrace (struct btrace_target_info *arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->disable_btrace (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->disable_btrace (...)", this->beneath ()->shortname ());
   this->beneath ()->disable_btrace (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->disable_btrace (%s)\n",
+  target_debug_printf_nofunc ("<- %s->disable_btrace (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_btrace_target_info_p (arg0).c_str ());
 }
@@ -3840,10 +3702,9 @@ dummy_target::teardown_btrace (struct btrace_target_info *arg0)
 void
 debug_target::teardown_btrace (struct btrace_target_info *arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->teardown_btrace (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->teardown_btrace (...)", this->beneath ()->shortname ());
   this->beneath ()->teardown_btrace (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->teardown_btrace (%s)\n",
+  target_debug_printf_nofunc ("<- %s->teardown_btrace (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_btrace_target_info_p (arg0).c_str ());
 }
@@ -3863,11 +3724,10 @@ dummy_target::read_btrace (struct btrace_data *arg0, struct btrace_target_info *
 enum btrace_error
 debug_target::read_btrace (struct btrace_data *arg0, struct btrace_target_info *arg1, enum btrace_read_type arg2)
 {
-  gdb_printf (gdb_stdlog, "-> %s->read_btrace (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->read_btrace (...)", this->beneath ()->shortname ());
   enum btrace_error result
     = this->beneath ()->read_btrace (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->read_btrace (%s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->read_btrace (%s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_btrace_data_p (arg0).c_str (),
 	      target_debug_print_btrace_target_info_p (arg1).c_str (),
@@ -3891,11 +3751,10 @@ dummy_target::btrace_conf (const struct btrace_target_info *arg0)
 const struct btrace_config *
 debug_target::btrace_conf (const struct btrace_target_info *arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->btrace_conf (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->btrace_conf (...)", this->beneath ()->shortname ());
   const struct btrace_config * result
     = this->beneath ()->btrace_conf (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->btrace_conf (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->btrace_conf (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_btrace_target_info_p (arg0).c_str (),
 	      target_debug_print_const_btrace_config_p (result).c_str ());
@@ -3917,11 +3776,10 @@ dummy_target::record_method (ptid_t arg0)
 enum record_method
 debug_target::record_method (ptid_t arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->record_method (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->record_method (...)", this->beneath ()->shortname ());
   enum record_method result
     = this->beneath ()->record_method (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->record_method (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->record_method (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ptid_t (arg0).c_str (),
 	      target_debug_print_record_method (result).c_str ());
@@ -3942,10 +3800,9 @@ dummy_target::stop_recording ()
 void
 debug_target::stop_recording ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->stop_recording (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->stop_recording (...)", this->beneath ()->shortname ());
   this->beneath ()->stop_recording ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->stop_recording ()\n",
+  target_debug_printf_nofunc ("<- %s->stop_recording ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -3963,10 +3820,9 @@ dummy_target::info_record ()
 void
 debug_target::info_record ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->info_record (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->info_record (...)", this->beneath ()->shortname ());
   this->beneath ()->info_record ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->info_record ()\n",
+  target_debug_printf_nofunc ("<- %s->info_record ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -3985,10 +3841,9 @@ dummy_target::save_record (const char *arg0)
 void
 debug_target::save_record (const char *arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->save_record (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->save_record (...)", this->beneath ()->shortname ());
   this->beneath ()->save_record (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->save_record (%s)\n",
+  target_debug_printf_nofunc ("<- %s->save_record (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_char_p (arg0).c_str ());
 }
@@ -4008,11 +3863,10 @@ dummy_target::supports_delete_record ()
 bool
 debug_target::supports_delete_record ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->supports_delete_record (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->supports_delete_record (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_delete_record ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->supports_delete_record () = %s\n",
+  target_debug_printf_nofunc ("<- %s->supports_delete_record () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -4033,10 +3887,9 @@ dummy_target::delete_record ()
 void
 debug_target::delete_record ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->delete_record (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->delete_record (...)", this->beneath ()->shortname ());
   this->beneath ()->delete_record ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->delete_record ()\n",
+  target_debug_printf_nofunc ("<- %s->delete_record ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -4055,11 +3908,10 @@ dummy_target::record_is_replaying (ptid_t arg0)
 bool
 debug_target::record_is_replaying (ptid_t arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->record_is_replaying (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->record_is_replaying (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->record_is_replaying (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->record_is_replaying (%s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->record_is_replaying (%s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ptid_t (arg0).c_str (),
 	      target_debug_print_bool (result).c_str ());
@@ -4081,11 +3933,10 @@ dummy_target::record_will_replay (ptid_t arg0, int arg1)
 bool
 debug_target::record_will_replay (ptid_t arg0, int arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->record_will_replay (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->record_will_replay (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->record_will_replay (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->record_will_replay (%s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->record_will_replay (%s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ptid_t (arg0).c_str (),
 	      target_debug_print_int (arg1).c_str (),
@@ -4107,10 +3958,9 @@ dummy_target::record_stop_replaying ()
 void
 debug_target::record_stop_replaying ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->record_stop_replaying (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->record_stop_replaying (...)", this->beneath ()->shortname ());
   this->beneath ()->record_stop_replaying ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->record_stop_replaying ()\n",
+  target_debug_printf_nofunc ("<- %s->record_stop_replaying ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -4129,10 +3979,9 @@ dummy_target::goto_record_begin ()
 void
 debug_target::goto_record_begin ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->goto_record_begin (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->goto_record_begin (...)", this->beneath ()->shortname ());
   this->beneath ()->goto_record_begin ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->goto_record_begin ()\n",
+  target_debug_printf_nofunc ("<- %s->goto_record_begin ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -4151,10 +4000,9 @@ dummy_target::goto_record_end ()
 void
 debug_target::goto_record_end ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->goto_record_end (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->goto_record_end (...)", this->beneath ()->shortname ());
   this->beneath ()->goto_record_end ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->goto_record_end ()\n",
+  target_debug_printf_nofunc ("<- %s->goto_record_end ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -4173,10 +4021,9 @@ dummy_target::goto_record (ULONGEST arg0)
 void
 debug_target::goto_record (ULONGEST arg0)
 {
-  gdb_printf (gdb_stdlog, "-> %s->goto_record (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->goto_record (...)", this->beneath ()->shortname ());
   this->beneath ()->goto_record (arg0);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->goto_record (%s)\n",
+  target_debug_printf_nofunc ("<- %s->goto_record (%s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ULONGEST (arg0).c_str ());
 }
@@ -4196,10 +4043,9 @@ dummy_target::insn_history (int arg0, gdb_disassembly_flags arg1)
 void
 debug_target::insn_history (int arg0, gdb_disassembly_flags arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->insn_history (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->insn_history (...)", this->beneath ()->shortname ());
   this->beneath ()->insn_history (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->insn_history (%s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->insn_history (%s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (arg0).c_str (),
 	      target_debug_print_gdb_disassembly_flags (arg1).c_str ());
@@ -4220,10 +4066,9 @@ dummy_target::insn_history_from (ULONGEST arg0, int arg1, gdb_disassembly_flags
 void
 debug_target::insn_history_from (ULONGEST arg0, int arg1, gdb_disassembly_flags arg2)
 {
-  gdb_printf (gdb_stdlog, "-> %s->insn_history_from (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->insn_history_from (...)", this->beneath ()->shortname ());
   this->beneath ()->insn_history_from (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->insn_history_from (%s, %s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->insn_history_from (%s, %s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ULONGEST (arg0).c_str (),
 	      target_debug_print_int (arg1).c_str (),
@@ -4245,10 +4090,9 @@ dummy_target::insn_history_range (ULONGEST arg0, ULONGEST arg1, gdb_disassembly_
 void
 debug_target::insn_history_range (ULONGEST arg0, ULONGEST arg1, gdb_disassembly_flags arg2)
 {
-  gdb_printf (gdb_stdlog, "-> %s->insn_history_range (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->insn_history_range (...)", this->beneath ()->shortname ());
   this->beneath ()->insn_history_range (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->insn_history_range (%s, %s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->insn_history_range (%s, %s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ULONGEST (arg0).c_str (),
 	      target_debug_print_ULONGEST (arg1).c_str (),
@@ -4270,10 +4114,9 @@ dummy_target::call_history (int arg0, record_print_flags arg1)
 void
 debug_target::call_history (int arg0, record_print_flags arg1)
 {
-  gdb_printf (gdb_stdlog, "-> %s->call_history (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->call_history (...)", this->beneath ()->shortname ());
   this->beneath ()->call_history (arg0, arg1);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->call_history (%s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->call_history (%s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_int (arg0).c_str (),
 	      target_debug_print_record_print_flags (arg1).c_str ());
@@ -4294,10 +4137,9 @@ dummy_target::call_history_from (ULONGEST arg0, int arg1, record_print_flags arg
 void
 debug_target::call_history_from (ULONGEST arg0, int arg1, record_print_flags arg2)
 {
-  gdb_printf (gdb_stdlog, "-> %s->call_history_from (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->call_history_from (...)", this->beneath ()->shortname ());
   this->beneath ()->call_history_from (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->call_history_from (%s, %s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->call_history_from (%s, %s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ULONGEST (arg0).c_str (),
 	      target_debug_print_int (arg1).c_str (),
@@ -4319,10 +4161,9 @@ dummy_target::call_history_range (ULONGEST arg0, ULONGEST arg1, record_print_fla
 void
 debug_target::call_history_range (ULONGEST arg0, ULONGEST arg1, record_print_flags arg2)
 {
-  gdb_printf (gdb_stdlog, "-> %s->call_history_range (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->call_history_range (...)", this->beneath ()->shortname ());
   this->beneath ()->call_history_range (arg0, arg1, arg2);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->call_history_range (%s, %s, %s)\n",
+  target_debug_printf_nofunc ("<- %s->call_history_range (%s, %s, %s)",
 	      this->beneath ()->shortname (),
 	      target_debug_print_ULONGEST (arg0).c_str (),
 	      target_debug_print_ULONGEST (arg1).c_str (),
@@ -4344,11 +4185,10 @@ dummy_target::augmented_libraries_svr4_read ()
 bool
 debug_target::augmented_libraries_svr4_read ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->augmented_libraries_svr4_read (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->augmented_libraries_svr4_read (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->augmented_libraries_svr4_read ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->augmented_libraries_svr4_read () = %s\n",
+  target_debug_printf_nofunc ("<- %s->augmented_libraries_svr4_read () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -4369,11 +4209,10 @@ dummy_target::get_unwinder ()
 const struct frame_unwind *
 debug_target::get_unwinder ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->get_unwinder (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->get_unwinder (...)", this->beneath ()->shortname ());
   const struct frame_unwind * result
     = this->beneath ()->get_unwinder ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->get_unwinder () = %s\n",
+  target_debug_printf_nofunc ("<- %s->get_unwinder () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_frame_unwind_p (result).c_str ());
   return result;
@@ -4394,11 +4233,10 @@ dummy_target::get_tailcall_unwinder ()
 const struct frame_unwind *
 debug_target::get_tailcall_unwinder ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->get_tailcall_unwinder (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->get_tailcall_unwinder (...)", this->beneath ()->shortname ());
   const struct frame_unwind * result
     = this->beneath ()->get_tailcall_unwinder ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->get_tailcall_unwinder () = %s\n",
+  target_debug_printf_nofunc ("<- %s->get_tailcall_unwinder () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_const_frame_unwind_p (result).c_str ());
   return result;
@@ -4418,10 +4256,9 @@ dummy_target::prepare_to_generate_core ()
 void
 debug_target::prepare_to_generate_core ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->prepare_to_generate_core (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->prepare_to_generate_core (...)", this->beneath ()->shortname ());
   this->beneath ()->prepare_to_generate_core ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->prepare_to_generate_core ()\n",
+  target_debug_printf_nofunc ("<- %s->prepare_to_generate_core ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -4439,10 +4276,9 @@ dummy_target::done_generating_core ()
 void
 debug_target::done_generating_core ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->done_generating_core (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->done_generating_core (...)", this->beneath ()->shortname ());
   this->beneath ()->done_generating_core ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->done_generating_core ()\n",
+  target_debug_printf_nofunc ("<- %s->done_generating_core ()",
 	      this->beneath ()->shortname ());
 }
 
@@ -4461,11 +4297,10 @@ dummy_target::supports_memory_tagging ()
 bool
 debug_target::supports_memory_tagging ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->supports_memory_tagging (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->supports_memory_tagging (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->supports_memory_tagging ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->supports_memory_tagging () = %s\n",
+  target_debug_printf_nofunc ("<- %s->supports_memory_tagging () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_bool (result).c_str ());
   return result;
@@ -4486,11 +4321,10 @@ dummy_target::fetch_memtags (CORE_ADDR arg0, size_t arg1, gdb::byte_vector &arg2
 bool
 debug_target::fetch_memtags (CORE_ADDR arg0, size_t arg1, gdb::byte_vector &arg2, int arg3)
 {
-  gdb_printf (gdb_stdlog, "-> %s->fetch_memtags (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->fetch_memtags (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->fetch_memtags (arg0, arg1, arg2, arg3);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->fetch_memtags (%s, %s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->fetch_memtags (%s, %s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_CORE_ADDR (arg0).c_str (),
 	      target_debug_print_size_t (arg1).c_str (),
@@ -4515,11 +4349,10 @@ dummy_target::store_memtags (CORE_ADDR arg0, size_t arg1, const gdb::byte_vector
 bool
 debug_target::store_memtags (CORE_ADDR arg0, size_t arg1, const gdb::byte_vector &arg2, int arg3)
 {
-  gdb_printf (gdb_stdlog, "-> %s->store_memtags (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->store_memtags (...)", this->beneath ()->shortname ());
   bool result
     = this->beneath ()->store_memtags (arg0, arg1, arg2, arg3);
-  gdb_printf (gdb_stdlog,
-	      "<- %s->store_memtags (%s, %s, %s, %s) = %s\n",
+  target_debug_printf_nofunc ("<- %s->store_memtags (%s, %s, %s, %s) = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_CORE_ADDR (arg0).c_str (),
 	      target_debug_print_size_t (arg1).c_str (),
@@ -4572,11 +4405,10 @@ dummy_target::fetch_x86_xsave_layout ()
 x86_xsave_layout
 debug_target::fetch_x86_xsave_layout ()
 {
-  gdb_printf (gdb_stdlog, "-> %s->fetch_x86_xsave_layout (...)\n", this->beneath ()->shortname ());
+  target_debug_printf_nofunc ("-> %s->fetch_x86_xsave_layout (...)", this->beneath ()->shortname ());
   x86_xsave_layout result
     = this->beneath ()->fetch_x86_xsave_layout ();
-  gdb_printf (gdb_stdlog,
-	      "<- %s->fetch_x86_xsave_layout () = %s\n",
+  target_debug_printf_nofunc ("<- %s->fetch_x86_xsave_layout () = %s",
 	      this->beneath ()->shortname (),
 	      target_debug_print_x86_xsave_layout (result).c_str ());
   return result;
diff --git a/gdb/target.c b/gdb/target.c
index 0a836d1e146e..d9ff7d648252 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -110,6 +110,16 @@ bool may_stop = true;
 
 static unsigned int targetdebug = 0;
 
+/* Print a "target" debug statement with the function name prefix.  */
+
+#define target_debug_printf(fmt, ...) \
+  debug_prefixed_printf_cond (targetdebug > 0, "target", fmt, ##__VA_ARGS__)
+
+/* Print a "target" debug statement without the function name prefix.  */
+
+#define target_debug_printf_nofunc(fmt, ...) \
+  debug_prefixed_printf_cond_nofunc (targetdebug > 0, "target", fmt, ##__VA_ARGS__)
+
 static void
 set_targetdebug  (const char *args, int from_tty, struct cmd_list_element *c)
 {
@@ -822,15 +832,9 @@ open_target (const char *args, int from_tty, struct cmd_list_element *command)
   auto *ti = static_cast<target_info *> (command->context ());
   target_open_ftype *func = target_factories[ti];
 
-  if (targetdebug)
-    gdb_printf (gdb_stdlog, "-> %s->open (...)\n",
-		ti->shortname);
-
+  target_debug_printf_nofunc ("-> %s->open (...)", ti->shortname);
   func (args, from_tty);
-
-  if (targetdebug)
-    gdb_printf (gdb_stdlog, "<- %s->open (%s, %d)\n",
-		ti->shortname, args, from_tty);
+  target_debug_printf_nofunc ("<- %s->open (%s, %d)", ti->shortname, args, from_tty);
 }
 
 /* See target.h.  */
@@ -1157,8 +1161,7 @@ target_ops_ref_policy::decref (target_ops *t)
 
       t->close ();
 
-      if (targetdebug)
-	gdb_printf (gdb_stdlog, "closing target\n");
+      target_debug_printf_nofunc ("closing target");
     }
 }
 
@@ -1693,18 +1696,15 @@ target_xfer_partial (struct target_ops *ops,
   if (targetdebug)
     {
       const unsigned char *myaddr = NULL;
-
-      gdb_printf (gdb_stdlog,
-		  "%s:target_xfer_partial "
-		  "(%d, %s, %s, %s, %s, %s) = %d, %s",
-		  ops->shortname (),
-		  (int) object,
-		  (annex ? annex : "(null)"),
-		  host_address_to_string (readbuf),
-		  host_address_to_string (writebuf),
-		  core_addr_to_string_nz (offset),
-		  pulongest (len), retval,
-		  pulongest (*xfered_len));
+      std::string s
+	= string_printf ("%s:target_xfer_partial "
+			 "(%d, %s, %s, %s, %s, %s) = %d, %s",
+			 ops->shortname (), (int) object,
+			 (annex ? annex : "(null)"),
+			 host_address_to_string (readbuf),
+			 host_address_to_string (writebuf),
+			 core_addr_to_string_nz (offset), pulongest (len),
+			 retval, pulongest (*xfered_len));
 
       if (readbuf)
 	myaddr = readbuf;
@@ -1714,24 +1714,26 @@ target_xfer_partial (struct target_ops *ops,
 	{
 	  int i;
 
-	  gdb_puts (", bytes =", gdb_stdlog);
+	  string_appendf (s, ", bytes =");
 	  for (i = 0; i < *xfered_len; i++)
 	    {
 	      if ((((intptr_t) &(myaddr[i])) & 0xf) == 0)
 		{
 		  if (targetdebug < 2 && i > 0)
 		    {
-		      gdb_printf (gdb_stdlog, " ...");
+		      string_appendf (s, " ...");
 		      break;
 		    }
-		  gdb_printf (gdb_stdlog, "\n");
+
+		  target_debug_printf_nofunc ("%s", s.c_str ());
+		  s.clear();
 		}
 
-	      gdb_printf (gdb_stdlog, " %02x", myaddr[i] & 0xff);
+	      string_appendf (s, " %02x", myaddr[i] & 0xff);
 	    }
 	}
 
-      gdb_putc ('\n', gdb_stdlog);
+      target_debug_printf_nofunc ("%s", s.c_str ());
     }
 
   /* Check implementations of to_xfer_partial update *XFERED_LEN
@@ -2944,10 +2946,7 @@ target_info_proc (const char *args, enum info_proc_what what)
     {
       if (t->info_proc (args, what))
 	{
-	  if (targetdebug)
-	    gdb_printf (gdb_stdlog,
-			"target_info_proc (\"%s\", %d)\n", args, what);
-
+	  target_debug_printf_nofunc ("target_info_proc (\"%s\", %d)", args, what);
 	  return 1;
 	}
     }
@@ -3238,14 +3237,9 @@ target_fileio_open (struct inferior *inf, const char *filename,
       else
 	fd = acquire_fileio_fd (t, fd);
 
-      if (targetdebug)
-	gdb_printf (gdb_stdlog,
-		    "target_fileio_open (%d,%s,0x%x,0%o,%d)"
-		    " = %d (%d)\n",
-		    inf == NULL ? 0 : inf->num,
-		    filename, flags, mode,
-		    warn_if_slow, fd,
-		    fd != -1 ? 0 : *target_errno);
+      target_debug_printf_nofunc ("target_fileio_open (%d,%s,0x%x,0%o,%d) = %d (%d)",
+			   inf == NULL ? 0 : inf->num, filename, flags, mode,
+			   warn_if_slow, fd, fd != -1 ? 0 : *target_errno);
       return fd;
     }
 
@@ -3270,12 +3264,9 @@ target_fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
     ret = fh->target->fileio_pwrite (fh->target_fd, write_buf,
 				     len, offset, target_errno);
 
-  if (targetdebug)
-    gdb_printf (gdb_stdlog,
-		"target_fileio_pwrite (%d,...,%d,%s) "
-		"= %d (%d)\n",
-		fd, len, pulongest (offset),
-		ret, ret != -1 ? 0 : *target_errno);
+  target_debug_printf_nofunc ("target_fileio_pwrite (%d,...,%d,%s) = %d (%d)", fd,
+		       len, pulongest (offset), ret,
+		       ret != -1 ? 0 : *target_errno);
   return ret;
 }
 
@@ -3296,12 +3287,8 @@ target_fileio_pread (int fd, gdb_byte *read_buf, int len,
     ret = fh->target->fileio_pread (fh->target_fd, read_buf,
 				    len, offset, target_errno);
 
-  if (targetdebug)
-    gdb_printf (gdb_stdlog,
-		"target_fileio_pread (%d,...,%d,%s) "
-		"= %d (%d)\n",
-		fd, len, pulongest (offset),
-		ret, ret != -1 ? 0 : *target_errno);
+  target_debug_printf_nofunc ("target_fileio_pread (%d,...,%d,%s) = %d (%d)", fd, len,
+		       pulongest (offset), ret, ret != -1 ? 0 : *target_errno);
   return ret;
 }
 
@@ -3320,10 +3307,8 @@ target_fileio_fstat (int fd, struct stat *sb, fileio_error *target_errno)
   else
     ret = fh->target->fileio_fstat (fh->target_fd, sb, target_errno);
 
-  if (targetdebug)
-    gdb_printf (gdb_stdlog,
-		"target_fileio_fstat (%d) = %d (%d)\n",
-		fd, ret, ret != -1 ? 0 : *target_errno);
+  target_debug_printf_nofunc ("target_fileio_fstat (%d) = %d (%d)", fd, ret,
+		       ret != -1 ? 0 : *target_errno);
   return ret;
 }
 
@@ -3347,10 +3332,8 @@ target_fileio_close (int fd, fileio_error *target_errno)
       release_fileio_fd (fd, fh);
     }
 
-  if (targetdebug)
-    gdb_printf (gdb_stdlog,
-		"target_fileio_close (%d) = %d (%d)\n",
-		fd, ret, ret != -1 ? 0 : *target_errno);
+  target_debug_printf_nofunc ("target_fileio_close (%d) = %d (%d)", fd, ret,
+		       ret != -1 ? 0 : *target_errno);
   return ret;
 }
 
@@ -3367,12 +3350,9 @@ target_fileio_unlink (struct inferior *inf, const char *filename,
       if (ret == -1 && *target_errno == FILEIO_ENOSYS)
 	continue;
 
-      if (targetdebug)
-	gdb_printf (gdb_stdlog,
-		    "target_fileio_unlink (%d,%s)"
-		    " = %d (%d)\n",
-		    inf == NULL ? 0 : inf->num, filename,
-		    ret, ret != -1 ? 0 : *target_errno);
+      target_debug_printf_nofunc ("target_fileio_unlink (%d,%s) = %d (%d)",
+			   inf == NULL ? 0 : inf->num, filename, ret,
+			   ret != -1 ? 0 : *target_errno);
       return ret;
     }
 
@@ -3394,13 +3374,10 @@ target_fileio_readlink (struct inferior *inf, const char *filename,
       if (!ret.has_value () && *target_errno == FILEIO_ENOSYS)
 	continue;
 
-      if (targetdebug)
-	gdb_printf (gdb_stdlog,
-		    "target_fileio_readlink (%d,%s)"
-		    " = %s (%d)\n",
-		    inf == NULL ? 0 : inf->num,
-		    filename, ret ? ret->c_str () : "(nil)",
-		    ret ? 0 : *target_errno);
+      target_debug_printf_nofunc ("target_fileio_readlink (%d,%s) = %s (%d)",
+			   inf == NULL ? 0 : inf->num, filename,
+			   ret ? ret->c_str () : "(nil)",
+			   ret ? 0 : *target_errno);
       return ret;
     }
 
@@ -3894,9 +3871,7 @@ void
 target_fetch_registers (struct regcache *regcache, int regno)
 {
   current_inferior ()->top_target ()->fetch_registers (regcache, regno);
-  if (targetdebug)
-    gdb_printf (gdb_stdlog, "target_fetch_registers: %s",
-		regcache->register_debug_string (regno).c_str ());
+  target_debug_printf ("%s", regcache->register_debug_string (regno).c_str ());
 }
 
 void
@@ -3906,9 +3881,7 @@ target_store_registers (struct regcache *regcache, int regno)
     error (_("Writing to registers is not allowed (regno %d)"), regno);
 
   current_inferior ()->top_target ()->store_registers (regcache, regno);
-  if (targetdebug)
-    gdb_printf (gdb_stdlog, "target_store_registers: %s",
-		regcache->register_debug_string (regno).c_str ());
+  target_debug_printf ("%s", regcache->register_debug_string (regno).c_str ());
 }
 
 int
-- 
2.44.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/4] gdb: make target debug functions return std::string
  2024-04-19 19:46 [PATCH v2 1/4] gdb: make target debug functions return std::string Simon Marchi
                   ` (2 preceding siblings ...)
  2024-04-19 19:46 ` [PATCH v2 4/4] gdb: add target_debug_printf and target_debug_printf_nofunc Simon Marchi
@ 2024-04-19 20:22 ` Tom Tromey
  2024-04-19 20:30   ` Simon Marchi
  3 siblings, 1 reply; 7+ messages in thread
From: Tom Tromey @ 2024-04-19 20:22 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches, Simon Marchi

>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:

Simon> From: Simon Marchi <simon.marchi@efficios.com>
Simon> Change the functions in target-debug.h to return string representations
Simon> in an std::string, such that they don't need to know how the printing
Simon> part is done.  This also helps the following patch that makes the debug
Simon> prints in debug_target one-liners.

Simon> Update target-delegates.c (through make-target-delegates.py) to do the
Simon> printing.

Simon> Add an overload of gdb_puts to avoid using `.c_str ()`.

Thanks for the update.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 3/4] gdb: make regcache::debug_print_register return a string
  2024-04-19 19:46 ` [PATCH v2 3/4] gdb: make regcache::debug_print_register return a string Simon Marchi
@ 2024-04-19 20:23   ` Tom Tromey
  0 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2024-04-19 20:23 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches, Simon Marchi

>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:

Simon> From: Simon Marchi <simon.marchi@efficios.com>
Simon> Rename the method to `register_debug_string`.

Simon> This makes it easier to introduce `target_debug_printf` in a subsequent
Simon> patch.

Thanks.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/4] gdb: make target debug functions return std::string
  2024-04-19 20:22 ` [PATCH v2 1/4] gdb: make target debug functions return std::string Tom Tromey
@ 2024-04-19 20:30   ` Simon Marchi
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Marchi @ 2024-04-19 20:30 UTC (permalink / raw)
  To: Tom Tromey, Simon Marchi; +Cc: gdb-patches

On 2024-04-19 16:22, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
> 
> Simon> From: Simon Marchi <simon.marchi@efficios.com>
> Simon> Change the functions in target-debug.h to return string representations
> Simon> in an std::string, such that they don't need to know how the printing
> Simon> part is done.  This also helps the following patch that makes the debug
> Simon> prints in debug_target one-liners.
> 
> Simon> Update target-delegates.c (through make-target-delegates.py) to do the
> Simon> printing.
> 
> Simon> Add an overload of gdb_puts to avoid using `.c_str ()`.
> 
> Thanks for the update.
> Approved-By: Tom Tromey <tom@tromey.com>
> 
> Tom

Thanks, I pushed the series.

Simon

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-19 20:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-19 19:46 [PATCH v2 1/4] gdb: make target debug functions return std::string Simon Marchi
2024-04-19 19:46 ` [PATCH v2 2/4] gdb: make debug_target use one-liners Simon Marchi
2024-04-19 19:46 ` [PATCH v2 3/4] gdb: make regcache::debug_print_register return a string Simon Marchi
2024-04-19 20:23   ` Tom Tromey
2024-04-19 19:46 ` [PATCH v2 4/4] gdb: add target_debug_printf and target_debug_printf_nofunc Simon Marchi
2024-04-19 20:22 ` [PATCH v2 1/4] gdb: make target debug functions return std::string Tom Tromey
2024-04-19 20:30   ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).