/* Select target systems and architectures at runtime for GDB.
- Copyright (C) 1990-2022 Free Software Foundation, Inc.
+ Copyright (C) 1990-2023 Free Software Foundation, Inc.
Contributed by Cygnus Support.
#include "exec.h"
#include "inline-frame.h"
#include "tracepoint.h"
-#include "gdb/fileio.h"
+#include "gdbsupport/fileio.h"
#include "gdbsupport/agent.h"
#include "auxv.h"
#include "target-debug.h"
show_targetdebug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- fprintf_filtered (file, _("Target debugging is %s.\n"), value);
+ gdb_printf (file, _("Target debugging is %s.\n"), value);
}
int
/* See target.h. */
-char *
+const char *
target_pid_to_exec_file (int pid)
{
return current_inferior ()->top_target ()->pid_to_exec_file (pid);
target_open_ftype *func = target_factories[ti];
if (targetdebug)
- fprintf_unfiltered (gdb_stdlog, "-> %s->open (...)\n",
- ti->shortname);
+ gdb_printf (gdb_stdlog, "-> %s->open (...)\n",
+ ti->shortname);
func (args, from_tty);
if (targetdebug)
- fprintf_unfiltered (gdb_stdlog, "<- %s->open (%s, %d)\n",
- ti->shortname, args, from_tty);
+ gdb_printf (gdb_stdlog, "<- %s->open (%s, %d)\n",
+ ti->shortname, args, from_tty);
}
/* See target.h. */
auto &func_slot = target_factories[&t];
if (func_slot != nullptr)
- internal_error (__FILE__, __LINE__,
- _("target already added (\"%s\")."), t.shortname);
+ internal_error (_("target already added (\"%s\")."), t.shortname);
func_slot = func;
if (targetlist == NULL)
void
target_kill (void)
{
+
+ /* If the commit_resume_state of the to-be-killed-inferior's process stratum
+ is true, and this inferior is the last live inferior with resumed threads
+ of that target, then we want to leave commit_resume_state to false, as the
+ target won't have any resumed threads anymore. We achieve this with
+ this scoped_disable_commit_resumed. On construction, it will set the flag
+ to false. On destruction, it will only set it to true if there are resumed
+ threads left. */
+ scoped_disable_commit_resumed disable ("killing");
current_inferior ()->top_target ()->kill ();
}
static void
default_terminal_info (struct target_ops *self, const char *args, int from_tty)
{
- printf_filtered (_("No saved terminal information.\n"));
+ gdb_printf (_("No saved terminal information.\n"));
}
/* A default implementation for the to_get_ada_task_ptid target method.
/* See target.h. */
void
-decref_target (target_ops *t)
+target_ops_ref_policy::decref (target_ops *t)
{
t->decref ();
if (t->refcount () == 0)
void
target_stack::push (target_ops *t)
{
- t->incref ();
+ /* We must create a new reference first. It is possible that T is
+ already pushed on this target stack, in which case we will first
+ unpush it below, before re-pushing it. If we don't increment the
+ reference count now, then when we unpush it, we might end up deleting
+ T, which is not good. */
+ auto ref = target_ops_ref::new_reference (t);
strata stratum = t->stratum ();
- if (stratum == process_stratum)
- connection_list_add (as_process_stratum_target (t));
-
/* If there's already a target at this stratum, remove it. */
- if (m_stack[stratum] != NULL)
- unpush (m_stack[stratum]);
+ if (m_stack[stratum].get () != nullptr)
+ unpush (m_stack[stratum].get ());
/* Now add the new one. */
- m_stack[stratum] = t;
+ m_stack[stratum] = std::move (ref);
if (m_top < stratum)
m_top = stratum;
+
+ if (stratum == process_stratum)
+ connection_list_add (as_process_stratum_target (t));
}
/* See target.h. */
strata stratum = t->stratum ();
if (stratum == dummy_stratum)
- internal_error (__FILE__, __LINE__,
- _("Attempt to unpush the dummy target"));
+ internal_error (_("Attempt to unpush the dummy target"));
/* Look for the specified target. Note that a target can only occur
once in the target stack. */
return false;
}
- /* Unchain the target. */
- m_stack[stratum] = NULL;
-
if (m_top == stratum)
m_top = this->find_beneath (t)->stratum ();
- /* Finally close the target, if there are no inferiors
- referencing this target still. Note we do this after unchaining,
- so any target method calls from within the target_close
- implementation don't end up in T anymore. Do leave the target
- open if we have are other inferiors referencing this target
- still. */
- decref_target (t);
-
- return true;
-}
+ /* Move the target reference off the target stack, this sets the pointer
+ held in m_stack to nullptr, and places the reference in ref. When
+ ref goes out of scope its reference count will be decremented, which
+ might cause the target to close.
-/* Unpush TARGET and assert that it worked. */
+ We have to do it this way, and not just set the value in m_stack to
+ nullptr directly, because doing so would decrement the reference
+ count first, which might close the target, and closing the target
+ does a check that the target is not on any inferiors target_stack. */
+ auto ref = std::move (m_stack[stratum]);
-static void
-unpush_target_and_assert (struct target_ops *target)
-{
- if (!current_inferior ()->unpush_target (target))
- {
- fprintf_unfiltered (gdb_stderr,
- "pop_all_targets couldn't find target %s\n",
- target->shortname ());
- internal_error (__FILE__, __LINE__,
- _("failed internal consistency check"));
- }
-}
-
-void
-pop_all_targets_above (enum strata above_stratum)
-{
- while ((int) (current_inferior ()->top_target ()->stratum ())
- > (int) above_stratum)
- unpush_target_and_assert (current_inferior ()->top_target ());
-}
-
-/* See target.h. */
-
-void
-pop_all_targets_at_and_above (enum strata stratum)
-{
- while ((int) (current_inferior ()->top_target ()->stratum ())
- >= (int) stratum)
- unpush_target_and_assert (current_inferior ()->top_target ());
-}
-
-void
-pop_all_targets (void)
-{
- pop_all_targets_above (dummy_stratum);
+ return true;
}
void
struct target_ops *target = current_inferior ()->top_target ();
struct gdbarch *gdbarch = target_gdbarch ();
+ /* If OBJFILE is a separate debug object file, look for the
+ original object file. */
+ if (objfile->separate_debug_objfile_backlink != NULL)
+ objfile = objfile->separate_debug_objfile_backlink;
+
if (gdbarch_fetch_tls_load_module_address_p (gdbarch))
{
ptid_t ptid = inferior_ptid;
};
-/* See target.h. */
-
-gdb::unique_xmalloc_ptr<char>
-target_read_string (CORE_ADDR memaddr, int len, int *bytes_read)
-{
- gdb::unique_xmalloc_ptr<gdb_byte> buffer;
-
- int ignore;
- if (bytes_read == nullptr)
- bytes_read = &ignore;
-
- /* Note that the endian-ness does not matter here. */
- int errcode = read_string (memaddr, -1, 1, len, BFD_ENDIAN_LITTLE,
- &buffer, bytes_read);
- if (errcode != 0)
- return {};
-
- return gdb::unique_xmalloc_ptr<char> ((char *) buffer.release ());
-}
-
const target_section_table *
target_get_section_table (struct target_ops *target)
{
if (len == 0)
return TARGET_XFER_EOF;
- memaddr = address_significant (target_gdbarch (), memaddr);
+ memaddr = gdbarch_remove_non_address_bits (target_gdbarch (), memaddr);
/* Fill in READBUF with breakpoint shadows, or WRITEBUF with
breakpoint insns, thus hiding out from higher layers whether
{
const unsigned char *myaddr = NULL;
- fprintf_unfiltered (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));
+ 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));
if (readbuf)
myaddr = readbuf;
{
int i;
- fputs_unfiltered (", bytes =", gdb_stdlog);
+ gdb_puts (", bytes =", gdb_stdlog);
for (i = 0; i < *xfered_len; i++)
{
if ((((intptr_t) &(myaddr[i])) & 0xf) == 0)
{
if (targetdebug < 2 && i > 0)
{
- fprintf_unfiltered (gdb_stdlog, " ...");
+ gdb_printf (gdb_stdlog, " ...");
break;
}
- fprintf_unfiltered (gdb_stdlog, "\n");
+ gdb_printf (gdb_stdlog, "\n");
}
- fprintf_unfiltered (gdb_stdlog, " %02x", myaddr[i] & 0xff);
+ gdb_printf (gdb_stdlog, " %02x", myaddr[i] & 0xff);
}
}
- fputc_unfiltered ('\n', gdb_stdlog);
+ gdb_putc ('\n', gdb_stdlog);
}
/* Check implementations of to_xfer_partial update *XFERED_LEN
show_trust_readonly (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- fprintf_filtered (file,
- _("Mode for reading from readonly sections is %s.\n"),
- value);
+ gdb_printf (file,
+ _("Mode for reading from readonly sections is %s.\n"),
+ value);
}
/* Target vector read/write partial wrapper functions. */
if (current_program_space->symfile_object_file != NULL)
{
objfile *objf = current_program_space->symfile_object_file;
- printf_filtered (_("Symbols from \"%s\".\n"),
- objfile_name (objf));
+ gdb_printf (_("Symbols from \"%s\".\n"),
+ objfile_name (objf));
}
for (target_ops *t = current_inferior ()->top_target ();
if ((int) (t->stratum ()) <= (int) dummy_stratum)
continue;
if (has_all_mem)
- printf_filtered (_("\tWhile running this, "
- "GDB does not access memory from...\n"));
- printf_filtered ("%s:\n", t->longname ());
+ gdb_printf (_("\tWhile running this, "
+ "GDB does not access memory from...\n"));
+ gdb_printf ("%s:\n", t->longname ());
t->files_info ();
has_all_mem = t->has_all_memory ();
}
/* attach_flag may be set if the previous process associated with
the inferior was attached to. */
- current_inferior ()->attach_flag = 0;
+ current_inferior ()->attach_flag = false;
current_inferior ()->highest_thread_num = 0;
it doesn't (which seems like a win for UDI), remove it now. */
/* Leave the exec target, though. The user may be switching from a
live process to a core of the same program. */
- pop_all_targets_above (file_stratum);
+ current_inferior ()->pop_all_targets_above (file_stratum);
target_pre_inferior (from_tty);
}
void
target_detach (inferior *inf, int from_tty)
{
+ /* Thread's don't need to be resumed until the end of this function. */
+ scoped_disable_commit_resumed disable_commit_resumed ("detaching");
+
/* After we have detached, we will clear the register cache for this inferior
by calling registers_changed_ptid. We must save the pid_ptid before
detaching, as the target detach method will clear inf->pid. */
inferior_ptid matches save_pid_ptid, but in our case, it does not
call it, as inferior_ptid has been reset. */
reinit_frame_cache ();
+
+ disable_commit_resumed.reset_and_commit ();
}
void
}
void
-target_resume (ptid_t ptid, int step, enum gdb_signal signal)
+target_resume (ptid_t scope_ptid, int step, enum gdb_signal signal)
{
process_stratum_target *curr_target = current_inferior ()->process_target ();
gdb_assert (!curr_target->commit_resumed_state);
+ gdb_assert (inferior_ptid != null_ptid);
+ gdb_assert (inferior_ptid.matches (scope_ptid));
+
target_dcache_invalidate ();
- current_inferior ()->top_target ()->resume (ptid, step, signal);
+ current_inferior ()->top_target ()->resume (scope_ptid, step, signal);
- registers_changed_ptid (curr_target, ptid);
+ registers_changed_ptid (curr_target, scope_ptid);
/* We only set the internal executing state here. The user/frontend
running state is set at a higher level. This also clears the
thread's stop_pc as side effect. */
- set_executing (curr_target, ptid, true);
- clear_inline_frame_state (curr_target, ptid);
+ set_executing (curr_target, scope_ptid, true);
+ clear_inline_frame_state (curr_target, scope_ptid);
if (target_can_async_p ())
- target_async (1);
+ target_async (true);
}
/* See target.h. */
bool follow_child, bool detach_fork)
{
/* Some target returned a fork event, but did not know how to follow it. */
- internal_error (__FILE__, __LINE__,
- _("could not find a target to follow fork"));
+ internal_error (_("could not find a target to follow fork"));
}
/* See target.h. */
static void
default_mourn_inferior (struct target_ops *self)
{
- internal_error (__FILE__, __LINE__,
- _("could not find a target to follow mourn inferior"));
+ internal_error (_("could not find a target to follow mourn inferior"));
}
void
/* This function is only called if the target is running. In that
case there should have been a process_stratum target and it
should either know how to create inferiors, or not... */
- internal_error (__FILE__, __LINE__, _("No targets found"));
+ internal_error (_("No targets found"));
}
/* Whether GDB is allowed to fall back to the default run target for
show_auto_connect_native_target (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- fprintf_filtered (file,
- _("Whether GDB may automatically connect to the "
- "native target is %s.\n"),
- value);
+ gdb_printf (file,
+ _("Whether GDB may automatically connect to the "
+ "native target is %s.\n"),
+ value);
}
/* A pointer to the target that can respond to "run" or "attach".
set_native_target (target_ops *target)
{
if (the_native_target != NULL)
- internal_error (__FILE__, __LINE__,
- _("native target already set (\"%s\")."),
+ internal_error (_("native target already set (\"%s\")."),
the_native_target->longname ());
the_native_target = target;
if (t->info_proc (args, what))
{
if (targetdebug)
- fprintf_unfiltered (gdb_stdlog,
- "target_info_proc (\"%s\", %d)\n", args, what);
+ gdb_printf (gdb_stdlog,
+ "target_info_proc (\"%s\", %d)\n", args, what);
return 1;
}
int
target_ops::fileio_open (struct inferior *inf, const char *filename,
int flags, int mode, int warn_if_slow,
- int *target_errno)
+ fileio_error *target_errno)
{
*target_errno = FILEIO_ENOSYS;
return -1;
int
target_ops::fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
- ULONGEST offset, int *target_errno)
+ ULONGEST offset, fileio_error *target_errno)
{
*target_errno = FILEIO_ENOSYS;
return -1;
int
target_ops::fileio_pread (int fd, gdb_byte *read_buf, int len,
- ULONGEST offset, int *target_errno)
+ ULONGEST offset, fileio_error *target_errno)
{
*target_errno = FILEIO_ENOSYS;
return -1;
}
int
-target_ops::fileio_fstat (int fd, struct stat *sb, int *target_errno)
+target_ops::fileio_fstat (int fd, struct stat *sb, fileio_error *target_errno)
{
*target_errno = FILEIO_ENOSYS;
return -1;
}
int
-target_ops::fileio_close (int fd, int *target_errno)
+target_ops::fileio_close (int fd, fileio_error *target_errno)
{
*target_errno = FILEIO_ENOSYS;
return -1;
int
target_ops::fileio_unlink (struct inferior *inf, const char *filename,
- int *target_errno)
+ fileio_error *target_errno)
{
*target_errno = FILEIO_ENOSYS;
return -1;
gdb::optional<std::string>
target_ops::fileio_readlink (struct inferior *inf, const char *filename,
- int *target_errno)
+ fileio_error *target_errno)
{
*target_errno = FILEIO_ENOSYS;
return {};
int
target_fileio_open (struct inferior *inf, const char *filename,
- int flags, int mode, bool warn_if_slow, int *target_errno)
+ int flags, int mode, bool warn_if_slow, fileio_error *target_errno)
{
for (target_ops *t = default_fileio_target (); t != NULL; t = t->beneath ())
{
fd = acquire_fileio_fd (t, fd);
if (targetdebug)
- fprintf_unfiltered (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);
+ 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);
return fd;
}
int
target_fileio_pwrite (int fd, const gdb_byte *write_buf, int len,
- ULONGEST offset, int *target_errno)
+ ULONGEST offset, fileio_error *target_errno)
{
fileio_fh_t *fh = fileio_fd_to_fh (fd);
int ret = -1;
if (fh->is_closed ())
- *target_errno = EBADF;
+ *target_errno = FILEIO_EBADF;
else if (fh->target == NULL)
- *target_errno = EIO;
+ *target_errno = FILEIO_EIO;
else
ret = fh->target->fileio_pwrite (fh->target_fd, write_buf,
len, offset, target_errno);
if (targetdebug)
- fprintf_unfiltered (gdb_stdlog,
- "target_fileio_pwrite (%d,...,%d,%s) "
- "= %d (%d)\n",
- fd, len, pulongest (offset),
- ret, ret != -1 ? 0 : *target_errno);
+ gdb_printf (gdb_stdlog,
+ "target_fileio_pwrite (%d,...,%d,%s) "
+ "= %d (%d)\n",
+ fd, len, pulongest (offset),
+ ret, ret != -1 ? 0 : *target_errno);
return ret;
}
int
target_fileio_pread (int fd, gdb_byte *read_buf, int len,
- ULONGEST offset, int *target_errno)
+ ULONGEST offset, fileio_error *target_errno)
{
fileio_fh_t *fh = fileio_fd_to_fh (fd);
int ret = -1;
if (fh->is_closed ())
- *target_errno = EBADF;
+ *target_errno = FILEIO_EBADF;
else if (fh->target == NULL)
- *target_errno = EIO;
+ *target_errno = FILEIO_EIO;
else
ret = fh->target->fileio_pread (fh->target_fd, read_buf,
len, offset, target_errno);
if (targetdebug)
- fprintf_unfiltered (gdb_stdlog,
- "target_fileio_pread (%d,...,%d,%s) "
- "= %d (%d)\n",
- fd, len, pulongest (offset),
- ret, ret != -1 ? 0 : *target_errno);
+ gdb_printf (gdb_stdlog,
+ "target_fileio_pread (%d,...,%d,%s) "
+ "= %d (%d)\n",
+ fd, len, pulongest (offset),
+ ret, ret != -1 ? 0 : *target_errno);
return ret;
}
/* See target.h. */
int
-target_fileio_fstat (int fd, struct stat *sb, int *target_errno)
+target_fileio_fstat (int fd, struct stat *sb, fileio_error *target_errno)
{
fileio_fh_t *fh = fileio_fd_to_fh (fd);
int ret = -1;
if (fh->is_closed ())
- *target_errno = EBADF;
+ *target_errno = FILEIO_EBADF;
else if (fh->target == NULL)
- *target_errno = EIO;
+ *target_errno = FILEIO_EIO;
else
ret = fh->target->fileio_fstat (fh->target_fd, sb, target_errno);
if (targetdebug)
- fprintf_unfiltered (gdb_stdlog,
- "target_fileio_fstat (%d) = %d (%d)\n",
- fd, ret, ret != -1 ? 0 : *target_errno);
+ gdb_printf (gdb_stdlog,
+ "target_fileio_fstat (%d) = %d (%d)\n",
+ fd, ret, ret != -1 ? 0 : *target_errno);
return ret;
}
/* See target.h. */
int
-target_fileio_close (int fd, int *target_errno)
+target_fileio_close (int fd, fileio_error *target_errno)
{
fileio_fh_t *fh = fileio_fd_to_fh (fd);
int ret = -1;
if (fh->is_closed ())
- *target_errno = EBADF;
+ *target_errno = FILEIO_EBADF;
else
{
if (fh->target != NULL)
}
if (targetdebug)
- fprintf_unfiltered (gdb_stdlog,
- "target_fileio_close (%d) = %d (%d)\n",
- fd, ret, ret != -1 ? 0 : *target_errno);
+ gdb_printf (gdb_stdlog,
+ "target_fileio_close (%d) = %d (%d)\n",
+ fd, ret, ret != -1 ? 0 : *target_errno);
return ret;
}
int
target_fileio_unlink (struct inferior *inf, const char *filename,
- int *target_errno)
+ fileio_error *target_errno)
{
for (target_ops *t = default_fileio_target (); t != NULL; t = t->beneath ())
{
continue;
if (targetdebug)
- fprintf_unfiltered (gdb_stdlog,
- "target_fileio_unlink (%d,%s)"
- " = %d (%d)\n",
- inf == NULL ? 0 : inf->num, filename,
- ret, ret != -1 ? 0 : *target_errno);
+ gdb_printf (gdb_stdlog,
+ "target_fileio_unlink (%d,%s)"
+ " = %d (%d)\n",
+ inf == NULL ? 0 : inf->num, filename,
+ ret, ret != -1 ? 0 : *target_errno);
return ret;
}
gdb::optional<std::string>
target_fileio_readlink (struct inferior *inf, const char *filename,
- int *target_errno)
+ fileio_error *target_errno)
{
for (target_ops *t = default_fileio_target (); t != NULL; t = t->beneath ())
{
continue;
if (targetdebug)
- fprintf_unfiltered (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);
+ 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);
return ret;
}
{
if (m_fd >= 0)
{
- int target_errno;
+ fileio_error target_errno;
target_fileio_close (m_fd, &target_errno);
}
size_t buf_alloc, buf_pos;
gdb_byte *buf;
LONGEST n;
- int target_errno;
+ fileio_error target_errno;
scoped_target_fd fd (target_fileio_open (inf, filename, FILEIO_O_RDONLY,
0700, false, &target_errno));
{
/* Look for a non-empty slot at stratum levels beneath T's. */
for (int stratum = t->stratum () - 1; stratum >= 0; --stratum)
- if (m_stack[stratum] != NULL)
- return m_stack[stratum];
+ if (m_stack[stratum].get () != NULL)
+ return m_stack[stratum].get ();
return NULL;
}
pid = inferior_ptid.pid ();
exec_file = get_exec_file (0);
if (exec_file == nullptr)
- printf_unfiltered ("Detaching from pid %s\n",
- target_pid_to_str (ptid_t (pid)).c_str ());
+ gdb_printf ("Detaching from pid %s\n",
+ target_pid_to_str (ptid_t (pid)).c_str ());
else
- printf_unfiltered (_("Detaching from program: %s, %s\n"), exec_file,
- target_pid_to_str (ptid_t (pid)).c_str ());
+ gdb_printf (_("Detaching from program: %s, %s\n"), exec_file,
+ target_pid_to_str (ptid_t (pid)).c_str ());
}
/* See target.h */
const char *exec_file = get_exec_file (0);
if (exec_file != nullptr)
- printf_unfiltered ("Attaching to program: %s, %s\n", exec_file,
- target_pid_to_str (ptid_t (pid)).c_str ());
+ gdb_printf ("Attaching to program: %s, %s\n", exec_file,
+ target_pid_to_str (ptid_t (pid)).c_str ());
else
- printf_unfiltered ("Attaching to %s\n",
- target_pid_to_str (ptid_t (pid)).c_str ());
+ gdb_printf ("Attaching to %s\n",
+ target_pid_to_str (ptid_t (pid)).c_str ());
}
/* The inferior process has died. Long live the inferior! */
targ->close ();
if (targetdebug)
- fprintf_unfiltered (gdb_stdlog, "target_close ()\n");
+ gdb_printf (gdb_stdlog, "target_close ()\n");
}
int
static void
maintenance_print_target_stack (const char *cmd, int from_tty)
{
- printf_filtered (_("The current target stack is:\n"));
+ gdb_printf (_("The current target stack is:\n"));
for (target_ops *t = current_inferior ()->top_target ();
t != NULL;
{
if (t->stratum () == debug_stratum)
continue;
- printf_filtered (" - %s (%s)\n", t->shortname (), t->longname ());
+ gdb_printf (" - %s (%s)\n", t->shortname (), t->longname ());
}
}
/* See target.h. */
void
-target_async (int enable)
+target_async (bool enable)
{
/* If we are trying to enable async mode then it must be the case that
async mode is possible for this target. */
show_maint_target_async (ui_file *file, int from_tty,
cmd_list_element *c, const char *value)
{
- fprintf_filtered (file,
- _("Controlling the inferior in "
- "asynchronous mode is %s.\n"), value);
+ gdb_printf (file,
+ _("Controlling the inferior in "
+ "asynchronous mode is %s.\n"), value);
}
/* Return true if the target operates in non-stop mode even with "set
cmd_list_element *c, const char *value)
{
if (target_non_stop_enabled == AUTO_BOOLEAN_AUTO)
- fprintf_filtered (file,
- _("Whether the target is always in non-stop mode "
- "is %s (currently %s).\n"), value,
- target_always_non_stop_p () ? "on" : "off");
+ gdb_printf (file,
+ _("Whether the target is always in non-stop mode "
+ "is %s (currently %s).\n"), value,
+ target_always_non_stop_p () ? "on" : "off");
else
- fprintf_filtered (file,
- _("Whether the target is always in non-stop mode "
- "is %s.\n"), value);
+ gdb_printf (file,
+ _("Whether the target is always in non-stop mode "
+ "is %s.\n"), value);
}
/* Temporary copies of permission settings. */