directly. */
const std::string &inferior_tty = current_inferior ()->tty ();
- fprintf_filtered (file,
- _("Terminal for future runs of program being debugged "
- "is \"%s\".\n"), inferior_tty.c_str ());
+ gdb_printf (file,
+ _("Terminal for future runs of program being debugged "
+ "is \"%s\".\n"), inferior_tty.c_str ());
}
void
const std::string &cwd = current_inferior ()->cwd ();
if (cwd.empty ())
- fprintf_filtered (file,
- _("\
+ gdb_printf (file,
+ _("\
You have not set the inferior's current working directory.\n\
The inferior will inherit GDB's cwd if native debugging, or the remote\n\
server's cwd if remote debugging.\n"));
else
- fprintf_filtered (file,
- _("Current working directory that will be used "
- "when starting the inferior is \"%s\".\n"),
- cwd.c_str ());
+ gdb_printf (file,
+ _("Current working directory that will be used "
+ "when starting the inferior is \"%s\".\n"),
+ cwd.c_str ());
}
uiout->field_string (NULL, "Starting program");
uiout->text (": ");
if (exec_file)
- uiout->field_string ("execfile", exec_file);
+ uiout->field_string ("execfile", exec_file,
+ file_name_style.style ());
uiout->spaces (1);
uiout->field_string ("infargs", current_inferior ()->args ());
uiout->text ("\n");
/* set_ignore_count prints a message ending with a period.
So print two spaces before "Continuing.". */
if (from_tty)
- printf_filtered (" ");
+ gdb_printf (" ");
stopped = 1;
}
if (!stopped && from_tty)
{
- printf_filtered
+ gdb_printf
("Not stopped at any breakpoint; argument ignored.\n");
}
}
prepare_execution_command (current_inferior ()->top_target (), async_exec);
if (from_tty)
- printf_filtered (_("Continuing.\n"));
+ gdb_printf (_("Continuing.\n"));
continue_1 (all_threads_p);
}
error (_("Cannot find bounds of current function"));
target_terminal::ours_for_output ();
- printf_filtered (_("Single stepping until exit from function %s,"
- "\nwhich has no line number information.\n"),
- name);
+ gdb_printf (_("Single stepping until exit from function %s,"
+ "\nwhich has no line number information.\n"),
+ name);
}
}
else
if (from_tty)
{
- printf_filtered (_("Continuing at "));
- puts_filtered (paddress (gdbarch, addr));
- printf_filtered (".\n");
+ gdb_printf (_("Continuing at "));
+ gdb_puts (paddress (gdbarch, addr));
+ gdb_printf (".\n");
}
clear_proceed_status (0);
&& signal_pass_state (tp->stop_signal ()))
{
if (!must_confirm)
- printf_unfiltered (_("Note:\n"));
- printf_unfiltered (_(" Thread %s previously stopped with signal %s, %s.\n"),
- print_thread_id (tp),
- gdb_signal_to_name (tp->stop_signal ()),
- gdb_signal_to_string (tp->stop_signal ()));
+ gdb_printf (_("Note:\n"));
+ gdb_printf (_(" Thread %s previously stopped with signal %s, %s.\n"),
+ print_thread_id (tp),
+ gdb_signal_to_name (tp->stop_signal ()),
+ gdb_signal_to_string (tp->stop_signal ()));
must_confirm = 1;
}
}
if (from_tty)
{
if (oursig == GDB_SIGNAL_0)
- printf_filtered (_("Continuing with no signal.\n"));
+ gdb_printf (_("Continuing with no signal.\n"));
else
- printf_filtered (_("Continuing with signal %s.\n"),
- gdb_signal_to_name (oursig));
+ gdb_printf (_("Continuing with signal %s.\n"),
+ gdb_signal_to_name (oursig));
}
clear_proceed_status (0);
until_break_command (arg, from_tty, 1);
}
\f
-/* Return the value of the result of a function at the end of a 'finish'
- command/BP. DTOR_DATA (if not NULL) can represent inferior registers
- right after an inferior call has finished. */
+/* See inferior.h. */
struct value *
-get_return_value (struct value *function, struct type *value_type)
+get_return_value (struct symbol *func_symbol, struct value *function)
{
regcache *stop_regs = get_current_regcache ();
struct gdbarch *gdbarch = stop_regs->arch ();
struct value *value;
- value_type = check_typedef (value_type);
+ struct type *value_type
+ = check_typedef (TYPE_TARGET_TYPE (func_symbol->type ()));
gdb_assert (value_type->code () != TYPE_CODE_VOID);
+ if (is_nocall_function (check_typedef (::value_type (function))))
+ {
+ warning (_("Function '%s' does not follow the target calling "
+ "convention, cannot determine its returned value."),
+ func_symbol->print_name ());
+
+ return nullptr;
+ }
+
/* FIXME: 2003-09-27: When returning from a nested inferior function
call, it's possible (with no help from the architecture vector)
to locate and return/print a "struct return" value. This is just
struct value *func;
func = read_var_value (function, NULL, get_current_frame ());
- rv->value = get_return_value (func, rv->type);
+ rv->value = get_return_value (function, func);
if (rv->value != NULL)
rv->value_history_index = record_latest_value (rv->value);
}
source. */
if (from_tty)
{
- printf_filtered (_("Run till exit from "));
+ gdb_printf (_("Run till exit from "));
print_stack_frame (get_selected_frame (NULL), 1, LOCATION, 0);
}
if (from_tty)
{
if (execution_direction == EXEC_REVERSE)
- printf_filtered (_("Run back to call of "));
+ gdb_printf (_("Run back to call of "));
else
{
if (sm->function != NULL && TYPE_NO_RETURN (sm->function->type ())
"Try to finish anyway? "),
sm->function->print_name ()))
error (_("Not confirmed."));
- printf_filtered (_("Run till exit from "));
+ gdb_printf (_("Run till exit from "));
}
print_stack_frame (get_selected_frame (NULL), 1, LOCATION, 0);
if (!target_has_execution ())
{
- printf_filtered (_("The program being debugged is not being run.\n"));
+ gdb_printf (_("The program being debugged is not being run.\n"));
return;
}
stat = bpstat_num (&bs, &num);
target_files_info ();
- printf_filtered (_("Program stopped at %s.\n"),
- paddress (target_gdbarch (), tp->stop_pc ()));
+ gdb_printf (_("Program stopped at %s.\n"),
+ paddress (target_gdbarch (), tp->stop_pc ()));
if (tp->control.stop_step)
- printf_filtered (_("It stopped after being stepped.\n"));
+ gdb_printf (_("It stopped after being stepped.\n"));
else if (stat != 0)
{
/* There may be several breakpoints in the same place, so this
{
if (stat < 0)
{
- printf_filtered (_("It stopped at a breakpoint "
- "that has since been deleted.\n"));
+ gdb_printf (_("It stopped at a breakpoint "
+ "that has since been deleted.\n"));
}
else
- printf_filtered (_("It stopped at breakpoint %d.\n"), num);
+ gdb_printf (_("It stopped at breakpoint %d.\n"), num);
stat = bpstat_num (&bs, &num);
}
}
else if (tp->stop_signal () != GDB_SIGNAL_0)
{
- printf_filtered (_("It stopped with signal %s, %s.\n"),
- gdb_signal_to_name (tp->stop_signal ()),
- gdb_signal_to_string (tp->stop_signal ()));
+ gdb_printf (_("It stopped with signal %s, %s.\n"),
+ gdb_signal_to_name (tp->stop_signal ()),
+ gdb_signal_to_string (tp->stop_signal ()));
}
if (from_tty)
{
- printf_filtered (_("Type \"info stack\" or \"info "
- "registers\" for more information.\n"));
+ gdb_printf (_("Type \"info stack\" or \"info "
+ "registers\" for more information.\n"));
}
}
\f
if (val)
{
- puts_filtered (var);
- puts_filtered (" = ");
- puts_filtered (val);
- puts_filtered ("\n");
+ gdb_puts (var);
+ gdb_puts (" = ");
+ gdb_puts (val);
+ gdb_puts ("\n");
}
else
{
- puts_filtered ("Environment variable \"");
- puts_filtered (var);
- puts_filtered ("\" not defined.\n");
+ gdb_puts ("Environment variable \"");
+ gdb_puts (var);
+ gdb_puts ("\" not defined.\n");
}
}
else
for (int idx = 0; envp[idx] != NULL; ++idx)
{
- puts_filtered (envp[idx]);
- puts_filtered ("\n");
+ gdb_puts (envp[idx]);
+ gdb_puts ("\n");
}
}
}
std::string var (arg, p - arg);
if (nullset)
{
- printf_filtered (_("Setting environment variable "
- "\"%s\" to null value.\n"),
- var.c_str ());
+ gdb_printf (_("Setting environment variable "
+ "\"%s\" to null value.\n"),
+ var.c_str ());
current_inferior ()->environment.set (var.c_str (), "");
}
else
static void
path_info (const char *args, int from_tty)
{
- puts_filtered ("Executable and object file path: ");
- puts_filtered (current_inferior ()->environment.get (path_var_name));
- puts_filtered ("\n");
+ gdb_puts ("Executable and object file path: ");
+ gdb_puts (current_inferior ()->environment.get (path_var_name));
+ gdb_puts ("\n");
}
/* Add zero or more directories to the front of the execution path. */
}
}
- fputs_filtered (format_stream.c_str (), file);
- fprintf_filtered (file, "\n");
+ gdb_puts (format_stream.c_str (), file);
+ gdb_printf (file, "\n");
}
/* Print out the machine register regnum. If regnum is -1, print all
}
}
if (!printed_something)
- fprintf_filtered (file, "No vector information\n");
+ gdb_printf (file, "No vector information\n");
}
}
bfd_cache_close_all ();
if (print_inferior_events)
- printf_filtered (_("[Inferior %d (%s) killed]\n"),
- infnum, pid_str.c_str ());
+ gdb_printf (_("[Inferior %d (%s) killed]\n"),
+ infnum, pid_str.c_str ());
}
/* Used in `attach&' command. Proceed threads of inferior INF iff
{
struct thread_info *lowest = inferior_thread ();
- stop_all_threads ();
+ stop_all_threads ("attaching");
/* It's not defined which thread will report the attach
stop. For consistency, always select the thread with
thread_state_string (thread->state));
}
+ /* Enable async mode if it is supported by the target. */
+ if (target_can_async_p ())
+ target_async (1);
+
/* Set up the "saved terminal modes" of the inferior
based on what modes we are starting it with. */
target_terminal::init ();
}
}
if (!printed_something)
- fprintf_filtered (file, "No floating-point info "
- "available for this processor.\n");
+ gdb_printf (file, "No floating-point info "
+ "available for this processor.\n");
}
static void
struct cmd_list_element *c,
const char *value)
{
- fprintf_filtered (file, _("\
+ gdb_printf (file, _("\
Printing of return value after `finish' is %s.\n"),
- value);
+ value);
}