#include "annotate.h"
#include "symfile.h"
#include "objfiles.h"
+#ifdef UI_OUT
+#include "ui-out.h"
+#endif
/* Prototypes for exported functions. */
{
if (addressprint && mid_statement && !tui_version)
{
+#ifdef UI_OUT
+ ui_out_field_core_addr (uiout, "addr", fi->pc);
+ ui_out_text (uiout, "\t");
+#else
print_address_numeric (fi->pc, 1, gdb_stdout);
printf_filtered ("\t");
+#endif
}
if (print_frame_info_listing_hook)
print_frame_info_listing_hook (sal.symtab, sal.line, sal.line + 1, 0);
struct symbol *func;
register char *funname = 0;
enum language funlang = language_unknown;
+#ifdef UI_OUT
+ struct ui_stream *stb;
+ struct cleanup *old_chain;
+
+ stb = ui_out_stream_new (uiout);
+ old_chain = make_cleanup ((make_cleanup_func) ui_out_stream_delete, stb);
+#endif /* UI_OUT */
func = find_pc_function (fi->pc);
if (func)
annotate_frame_begin (level == -1 ? 0 : level, fi->pc);
+#ifdef UI_OUT
+ ui_out_list_begin (uiout, "frame");
+#endif
if (level >= 0)
- printf_filtered ("#%-2d ", level);
+ {
+#ifdef UI_OUT
+ ui_out_text (uiout, "#");
+ ui_out_field_fmt (uiout, "level", "%-2d", level);
+ ui_out_spaces (uiout, 1);
+#else
+ printf_filtered ("#%-2d ", level);
+#endif
+ }
if (addressprint)
if (fi->pc != sal.pc || !sal.symtab || source == LOC_AND_ADDRESS)
{
annotate_frame_address ();
+#ifdef UI_OUT
+ ui_out_field_core_addr (uiout, "addr", fi->pc);
+ annotate_frame_address_end ();
+ ui_out_text (uiout, " in ");
+#else
print_address_numeric (fi->pc, 1, gdb_stdout);
annotate_frame_address_end ();
printf_filtered (" in ");
+#endif
}
annotate_frame_function_name ();
+#ifdef UI_OUT
+ fprintf_symbol_filtered (stb->stream, funname ? funname : "??", funlang,
+ DMGL_ANSI);
+ ui_out_field_stream (uiout, "func", stb);
+ ui_out_wrap_hint (uiout, " ");
+#else
fprintf_symbol_filtered (gdb_stdout, funname ? funname : "??", funlang,
DMGL_ANSI);
wrap_here (" ");
+#endif
annotate_frame_args ();
+#ifdef UI_OUT
+ ui_out_text (uiout, " (");
+#else
fputs_filtered (" (", gdb_stdout);
+#endif
if (args)
{
struct print_args_args args;
args.fi = fi;
args.func = func;
args.stream = gdb_stdout;
+#ifdef UI_OUT
+ ui_out_list_begin (uiout, "args");
+ catch_errors (print_args_stub, &args, "", RETURN_MASK_ALL);
+ /* FIXME: args must be a list. If one argument is a string it will
+ have " that will not be properly escaped. */
+ ui_out_list_end (uiout);
+#else
catch_errors (print_args_stub, &args, "", RETURN_MASK_ALL);
+#endif
QUIT;
}
+#ifdef UI_OUT
+ ui_out_text (uiout, ")");
+#else
printf_filtered (")");
+#endif
if (sal.symtab && sal.symtab->filename)
{
annotate_frame_source_begin ();
+#ifdef UI_OUT
+ ui_out_wrap_hint (uiout, " ");
+ ui_out_text (uiout, " at ");
+ annotate_frame_source_file ();
+ ui_out_field_string (uiout, "file", sal.symtab->filename);
+ annotate_frame_source_file_end ();
+ ui_out_text (uiout, ":");
+ annotate_frame_source_line ();
+ ui_out_field_int (uiout, "line", sal.line);
+#else
wrap_here (" ");
printf_filtered (" at ");
annotate_frame_source_file ();
printf_filtered (":");
annotate_frame_source_line ();
printf_filtered ("%d", sal.line);
+#endif
annotate_frame_source_end ();
}
if (!funname)
{
annotate_frame_where ();
+#ifdef UI_OUT
+ ui_out_wrap_hint (uiout, " ");
+ ui_out_text (uiout, " from ");
+ ui_out_field_string (uiout, "from", PC_LOAD_SEGMENT (fi->pc));
+#else
wrap_here (" ");
printf_filtered (" from %s", PC_LOAD_SEGMENT (fi->pc));
+#endif
}
#endif /* PC_LOAD_SEGMENT */
if (lib)
{
annotate_frame_where ();
+#ifdef UI_OUT
+ ui_out_wrap_hint (uiout, " ");
+ ui_out_text (uiout, " from ");
+ ui_out_field_string (uiout, "from", lib);
+#else
wrap_here (" ");
printf_filtered (" from %s", lib);
+#endif
}
}
#endif /* PC_SOLIB */
+#ifdef UI_OUT
+ ui_out_list_end (uiout);
+ ui_out_text (uiout, "\n");
+ do_cleanups (old_chain);
+#else
printf_filtered ("\n");
+#endif
}
\f
printing. Second, it must set the variable count to the number
of frames which we should print, or -1 if all of them. */
trailing = get_current_frame ();
+
+ /* The target can be in a state where there is no valid frames
+ (e.g., just connected). */
+ if (trailing == NULL)
+ error ("No stack.");
+
trailing_level = 0;
if (count_exp)
{
argc = 0;
for (i = 0; (argv[i] != (char *) NULL); i++)
{
- int j;
+ unsigned int j;
for (j = 0; (j < strlen (argv[i])); j++)
argv[i][j] = tolower (argv[i][j]);
frame expressions. */
/* ARGSUSED */
+#ifdef UI_OUT
+void
+select_frame_command_wrapper (level_exp, from_tty)
+ char *level_exp;
+ int from_tty;
+{
+ select_frame_command (level_exp, from_tty);
+}
+#endif
static void
select_frame_command (level_exp, from_tty)
char *level_exp;
show_and_print_stack_frame (selected_frame, selected_frame_level, 1);
}
\f
+#ifdef UI_OUT
+void
+return_command_wrapper (retval_exp, from_tty)
+ char *retval_exp;
+ int from_tty;
+{
+ return_command (retval_exp, from_tty);
+}
+#endif
static void
return_command (retval_exp, from_tty)
char *retval_exp;