Change all references to stdout/stderr to gdb_stdout/gdb_stderr.
Replace all calls to stdio output functions with calls to
corresponding _unfiltered functions (`fprintf_unfiltered')
Replaced calls to fopen for output to gdb_fopen.
Added sufficient goo to utils.c and defs.h to make the above work.
The net effect is that stdio output functions are only directly used
in utils.c. Elsewhere, the _unfiltered and _filtered functions and
GDB_FILE type are used.
In the near future, GDB_FILE will stop being equivalant to FILE.
The semantics of some commands has changed in a very subtle way:
called in the right context, they may cause new occurences of
prompt_for_continue() behavior. The testsuite doesn't notice anything
like this, though.
Please respect this change by not reintroducing stdio output
dependencies in the main body of gdb code. All output from commands
should go to a GDB_FILE.
Target-specific code can still use stdio directly to communicate with
targets.
dir ../libiberty
dir ../bfd
set prompt (top-gdb)
+source /.gdbinit
* breakpoint.c (mention): Add bp_call_dummy to switch.
* symmisc.c (dump_symtab): Use %d not %ld for line number.
+Sun Oct 24 18:29:32 1993 Tom Lord (lord@rtl.cygnus.com)
+
+ * every non-obsolete file except utils.c:
+ Change the stream argument to _filtered to GDB_FILE *.
+ Change all references to stdout/stderr to gdb_stdout/gdb_stderr.
+ Replace all calls to stdio output functions with
+ calls to corresponding _unfiltered functions.
+ Replaced calls to fopen for output to gdb_fopen.
+ Added sufficient goo to utils.c and defs.h to make the above
+ work.
+
+ The net effect is that stdio output functions are only directly
+ used in utils.c. Elsewhere, the _unfiltered and _filtered
+ functions and GDB_FILE type are used.
+
+ In the near future, GDB_FILE will stop being equivalant to
+ FILE.
+
+ The semantics of some commands has changed in a very subtle way:
+ called in the right context, they may cause new occurences of
+ prompt_for_continue() behavior.
+
+ Please respect this change by not reintroducing stdio output
+ dependencies in the main body of gdb code. All output from
+ commands should go to a GDB_FILE.
+
Sun Oct 24 20:16:38 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* parse.c, parser-defs.h (write_exp_msymbol): New function to write
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
switch ((cfg_reg >> 28) & 0xf)
{
case 0:
- fprintf_filtered (stderr, "Remote debugging an Am29000");
+ fprintf_filtered (gdb_stderr, "Remote debugging an Am29000");
break;
case 1:
- fprintf_filtered (stderr, "Remote debugging an Am29005");
+ fprintf_filtered (gdb_stderr, "Remote debugging an Am29005");
break;
case 2:
- fprintf_filtered (stderr, "Remote debugging an Am29050");
+ fprintf_filtered (gdb_stderr, "Remote debugging an Am29050");
processor_type = a29k_freeze_mode;
break;
case 3:
- fprintf_filtered (stderr, "Remote debugging an Am29035");
+ fprintf_filtered (gdb_stderr, "Remote debugging an Am29035");
break;
case 4:
- fprintf_filtered (stderr, "Remote debugging an Am29030");
+ fprintf_filtered (gdb_stderr, "Remote debugging an Am29030");
break;
case 5:
- fprintf_filtered (stderr, "Remote debugging an Am2920*");
+ fprintf_filtered (gdb_stderr, "Remote debugging an Am2920*");
break;
case 6:
- fprintf_filtered (stderr, "Remote debugging an Am2924*");
+ fprintf_filtered (gdb_stderr, "Remote debugging an Am2924*");
break;
case 7:
- fprintf_filtered (stderr, "Remote debugging an Am29040");
+ fprintf_filtered (gdb_stderr, "Remote debugging an Am29040");
break;
default:
- fprintf_filtered (stderr, "Remote debugging an unknown Am29k\n");
+ fprintf_filtered (gdb_stderr, "Remote debugging an unknown Am29k\n");
/* Don't bother to print the revision. */
return;
}
- fprintf_filtered (stderr, " revision %c\n", 'A' + ((cfg_reg >> 24) & 0x0f));
+ fprintf_filtered (gdb_stderr, " revision %c\n", 'A' + ((cfg_reg >> 24) & 0x0f));
}
void
#endif
}
else
- fprintf (stderr, "Couldn't read float regs from core file\n");
+ fprintf_unfiltered (gdb_stderr, "Couldn't read float regs from core file\n");
}
}
#else /* Not sun3 target. */
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
reg_offset -= KERNEL_U_ADDR;
memcpy (&core_aouthdr, &u.u_exdata, sizeof (AOUTHDR));
- printf ("Core file is from \"%s\".\n", u.u_comm);
+ printf_unfiltered ("Core file is from \"%s\".\n", u.u_comm);
/* I don't know where to find this info.
So, for now, mark it as not available. */
validate_files ();
}
else if (from_tty)
- printf ("No core file now.\n");
+ printf_unfiltered ("No core file now.\n");
}
#include "ctype.h"
#include "command.h"
#include "inferior.h"
+#include "thread.h"
#include "target.h"
#include "language.h"
#include <string.h>
b->enable = disabled;
if (!disabled_breaks)
{
- fprintf (stderr,
+ fprintf_unfiltered (gdb_stderr,
"Cannot insert breakpoint %d:\n", b->number);
printf_filtered ("Disabling shared library breakpoints:\n");
}
else
#endif
{
- fprintf (stderr, "Cannot insert breakpoint %d:\n", b->number);
+ fprintf_unfiltered (gdb_stderr, "Cannot insert breakpoint %d:\n", b->number);
#ifdef ONE_PROCESS_WRITETEXT
- fprintf (stderr,
+ fprintf_unfiltered (gdb_stderr,
"The same program may be running in another process.\n");
#endif
memory_error (val, b->address); /* which bombs us out */
int val;
#ifdef BREAKPOINT_DEBUG
- printf ("Removing breakpoints.\n");
+ printf_unfiltered ("Removing breakpoints.\n");
#endif /* BREAKPOINT_DEBUG */
ALL_BREAKPOINTS (b)
return val;
b->inserted = 0;
#ifdef BREAKPOINT_DEBUG
- printf ("Removed breakpoint at %s",
+ printf_unfiltered ("Removed breakpoint at %s",
local_hex_string((unsigned long) b->address));
- printf (", shadow %s",
+ printf_unfiltered (", shadow %s",
local_hex_string((unsigned long) b->shadow_contents[0]));
- printf (", %s.\n",
+ printf_unfiltered (", %s.\n",
local_hex_string((unsigned long) b->shadow_contents[1]));
#endif /* BREAKPOINT_DEBUG */
}
return 0;
}
+
+/* breakpoint_match_thread (PC, PID) returns true if the breakpoint at PC
+ is valid for process/thread PID. */
+
+int
+breakpoint_thread_match (pc, pid)
+ CORE_ADDR pc;
+ int pid;
+{
+ struct breakpoint *b;
+ int thread;
+
+ thread = pid_to_thread_id (pid);
+
+ ALL_BREAKPOINTS (b)
+ if (b->enable != disabled
+ && b->address == pc
+ && (b->thread == -1 || b->thread == thread))
+ return 1;
+
+ return 0;
+}
+
\f
/* bpstat stuff. External routines' interfaces are documented
in breakpoint.h. */
if (bs->old_val != NULL)
{
printf_filtered ("\nWatchpoint %d, ", bs->breakpoint_at->number);
- print_expression (bs->breakpoint_at->exp, stdout);
+ print_expression (bs->breakpoint_at->exp, gdb_stdout);
printf_filtered ("\nOld value = ");
- value_print (bs->old_val, stdout, 0, Val_pretty_default);
+ value_print (bs->old_val, gdb_stdout, 0, Val_pretty_default);
printf_filtered ("\nNew value = ");
- value_print (bs->breakpoint_at->val, stdout, 0,
+ value_print (bs->breakpoint_at->val, gdb_stdout, 0,
Val_pretty_default);
printf_filtered ("\n");
value_free (bs->old_val);
switch (b->type)
{
case bp_watchpoint:
- print_expression (b->exp, stdout);
+ print_expression (b->exp, gdb_stdout);
break;
case bp_breakpoint:
sym = find_pc_function (b->address);
if (sym)
{
- fputs_filtered ("in ", stdout);
- fputs_filtered (SYMBOL_SOURCE_NAME (sym), stdout);
+ fputs_filtered ("in ", gdb_stdout);
+ fputs_filtered (SYMBOL_SOURCE_NAME (sym), gdb_stdout);
wrap_here (wrap_indent);
- fputs_filtered (" at ", stdout);
+ fputs_filtered (" at ", gdb_stdout);
}
- fputs_filtered (b->source_file, stdout);
+ fputs_filtered (b->source_file, gdb_stdout);
printf_filtered (":%d", b->line_number);
}
else
- print_address_symbolic (b->address, stdout, demangle, " ");
+ print_address_symbolic (b->address, gdb_stdout, demangle, " ");
break;
}
if (b->cond)
{
printf_filtered ("\tstop only if ");
- print_expression (b->cond, stdout);
+ print_expression (b->cond, gdb_stdout);
printf_filtered ("\n");
}
if (b->ignore_count)
if ((l = b->commands))
while (l)
{
- fputs_filtered ("\t", stdout);
- fputs_filtered (l->line, stdout);
- fputs_filtered ("\n", stdout);
+ fputs_filtered ("\t", gdb_stdout);
+ fputs_filtered (l->line, gdb_stdout);
+ fputs_filtered ("\n", gdb_stdout);
l = l->next;
}
}
others++;
if (others > 0)
{
- printf ("Note: breakpoint%s ", (others > 1) ? "s" : "");
+ printf_unfiltered ("Note: breakpoint%s ", (others > 1) ? "s" : "");
ALL_BREAKPOINTS (b)
if (b->address == pc)
{
others--;
- printf ("%d%s%s ",
+ printf_unfiltered ("%d%s%s ",
b->number,
(b->enable == disabled) ? " (disabled)" : "",
(others > 1) ? "," : ((others == 1) ? " and" : ""));
}
- printf ("also set at pc %s.\n", local_hex_string((unsigned long) pc));
+ printf_unfiltered ("also set at pc %s.\n", local_hex_string((unsigned long) pc));
}
}
\f
else
b->source_file = savestring (sal.symtab->filename,
strlen (sal.symtab->filename));
+ b->thread = -1;
b->line_number = sal.line;
b->enable = enabled;
b->next = 0;
{
case bp_watchpoint:
printf_filtered ("Watchpoint %d: ", b->number);
- print_expression (b->exp, stdout);
+ print_expression (b->exp, gdb_stdout);
break;
case bp_breakpoint:
printf_filtered ("Breakpoint %d at %s", b->number,
case bp_longjmp:
case bp_longjmp_resume:
case bp_step_resume:
+ case bp_call_dummy:
break;
}
printf_filtered ("\n");
struct cleanup *old_chain;
struct cleanup *canonical_strings_chain = NULL;
char **canonical = (char **)NULL;
-
int i;
+ int thread;
sals.sals = NULL;
sals.nelts = 0;
}
}
+ thread = -1; /* No specific thread yet */
+
/* Resolve all line numbers to PC's, and verify that conditions
can be parsed, before setting any breakpoints. */
for (i = 0; i < sals.nelts; i++)
{
+ char *tok, *end_tok;
+ int toklen;
+
resolve_sal_pc (&sals.sals[i]);
- while (arg && *arg)
+ tok = arg;
+
+ while (tok && *tok)
{
- if (arg[0] == 'i' && arg[1] == 'f'
- && (arg[2] == ' ' || arg[2] == '\t'))
+ while (*tok == ' ' || *tok == '\t')
+ tok++;
+
+ end_tok = tok;
+
+ while (*end_tok != ' ' && *end_tok != '\t' && *end_tok != '\000')
+ end_tok++;
+
+ toklen = end_tok - tok;
+
+ if (toklen >= 1 && strncmp (tok, "if", toklen) == 0)
+ {
+ tok = cond_start = end_tok + 1;
+ cond = parse_exp_1 (&tok, block_for_pc (sals.sals[i].pc), 0);
+ cond_end = tok;
+ }
+ else if (toklen >= 1 && strncmp (tok, "thread", toklen) == 0)
{
- arg += 2;
- cond_start = arg;
- cond = parse_exp_1 (&arg, block_for_pc (sals.sals[i].pc), 0);
- cond_end = arg;
+ char *tmptok;
+
+ tok = end_tok + 1;
+ tmptok = tok;
+ thread = strtol (tok, &tok, 0);
+ if (tok == tmptok)
+ error ("Junk after thread keyword.");
+ if (!valid_thread_id (thread))
+ error ("Unknown thread %d\n", thread);
}
else
error ("Junk at end of arguments.");
b->number = breakpoint_count;
b->type = bp_breakpoint;
b->cond = cond;
+ b->thread = thread;
/* If a canonical line spec is needed use that instead of the
command string. */
if (sals.nelts > 1)
{
- printf ("Multiple breakpoints were set.\n");
- printf ("Use the \"delete\" command to delete unwanted breakpoints.\n");
+ printf_unfiltered ("Multiple breakpoints were set.\n");
+ printf_unfiltered ("Use the \"delete\" command to delete unwanted breakpoints.\n");
}
do_cleanups (old_chain);
}
goto win;
}
#endif
- printf ("No catch clause for exception %s.\n", p);
+ printf_unfiltered ("No catch clause for exception %s.\n", p);
#if 0
win:
#endif
if (sals.nelts > 1)
{
- printf ("Multiple breakpoints were set.\n");
- printf ("Use the \"delete\" command to delete unwanted breakpoints.\n");
+ printf_unfiltered ("Multiple breakpoints were set.\n");
+ printf_unfiltered ("Use the \"delete\" command to delete unwanted breakpoints.\n");
}
free ((PTR)sals.sals);
}
}
if (found->next) from_tty = 1; /* Always report if deleted more than one */
- if (from_tty) printf ("Deleted breakpoint%s ", found->next ? "s" : "");
+ if (from_tty) printf_unfiltered ("Deleted breakpoint%s ", found->next ? "s" : "");
while (found)
{
- if (from_tty) printf ("%d ", found->number);
+ if (from_tty) printf_unfiltered ("%d ", found->number);
b1 = found->next;
delete_breakpoint (found);
found = b1;
}
- if (from_tty) putchar ('\n');
+ if (from_tty) putchar_unfiltered ('\n');
}
free ((PTR)sals.sals);
}
val = target_insert_breakpoint (b->address, b->shadow_contents);
if (val != 0)
{
- fprintf (stderr, "Cannot insert breakpoint %d:\n", b->number);
+ fprintf_unfiltered (gdb_stderr, "Cannot insert breakpoint %d:\n", b->number);
memory_error (val, b->address); /* which bombs us out */
}
else
free (bpt->source_file);
if (xgdb_verbose && bpt->type == bp_breakpoint)
- printf ("breakpoint #%d deleted\n", bpt->number);
+ printf_unfiltered ("breakpoint #%d deleted\n", bpt->number);
/* Be sure no bpstat's are pointing at it after it's been freed. */
/* FIXME, how can we find all bpstat's? We just check stop_bpstat for now. */
function (b);
goto win;
}
- printf ("No breakpoint number %d.\n", num);
+ printf_unfiltered ("No breakpoint number %d.\n", num);
win:
p = p1;
}
bpt->enable = enabled;
if (xgdb_verbose && bpt->type == bp_breakpoint)
- printf ("breakpoint #%d enabled\n", bpt->number);
+ printf_unfiltered ("breakpoint #%d enabled\n", bpt->number);
check_duplicates (bpt->address);
if (bpt->type == bp_watchpoint)
static void
emit_char (c, stream, quoter)
register int c;
- FILE *stream;
+ GDB_FILE *stream;
int quoter;
{
static void
c_printchar (c, stream)
int c;
- FILE *stream;
+ GDB_FILE *stream;
{
fputs_filtered ("'", stream);
emit_char (c, stream, '\'');
static void
c_printstr (stream, string, length, force_ellipses)
- FILE *stream;
+ GDB_FILE *stream;
char *string;
unsigned int length;
int force_ellipses;
if (length == 0)
{
- fputs_filtered ("\"\"", stdout);
+ fputs_filtered ("\"\"", gdb_stdout);
return;
}
c_error PARAMS ((char *)); /* Defined in c-exp.y */
extern void /* Defined in c-typeprint.c */
-c_print_type PARAMS ((struct type *, char *, FILE *, int, int));
+c_print_type PARAMS ((struct type *, char *, GDB_FILE *, int, int));
extern int
-c_val_print PARAMS ((struct type *, char *, CORE_ADDR, FILE *, int, int,
+c_val_print PARAMS ((struct type *, char *, CORE_ADDR, GDB_FILE *, int, int,
int, enum val_prettyprint));
extern int demangle; /* whether to print C++ syms raw or source-form */
static void
-c_type_print_args PARAMS ((struct type *, FILE *));
+c_type_print_args PARAMS ((struct type *, GDB_FILE *));
static void
-c_type_print_varspec_suffix PARAMS ((struct type *, FILE *, int, int, int));
+c_type_print_varspec_suffix PARAMS ((struct type *, GDB_FILE *, int, int, int));
static void
-cp_type_print_derivation_info PARAMS ((FILE *, struct type *));
+cp_type_print_derivation_info PARAMS ((GDB_FILE *, struct type *));
void
-c_type_print_varspec_prefix PARAMS ((struct type *, FILE *, int, int));
+c_type_print_varspec_prefix PARAMS ((struct type *, GDB_FILE *, int, int));
void
-c_type_print_base PARAMS ((struct type *, FILE *, int, int));
+c_type_print_base PARAMS ((struct type *, GDB_FILE *, int, int));
\f
/* Print a description of a type in the format of a
c_typedef_print (type, new, stream)
struct type *type;
struct symbol *new;
- FILE *stream;
+ GDB_FILE *stream;
{
switch (current_language->la_language)
{
c_print_type (type, varstring, stream, show, level)
struct type *type;
char *varstring;
- FILE *stream;
+ GDB_FILE *stream;
int show;
int level;
{
char *prefix;
char *varstring;
int staticp;
- FILE *stream;
+ GDB_FILE *stream;
{
int i;
static void
cp_type_print_derivation_info (stream, type)
- FILE *stream;
+ GDB_FILE *stream;
struct type *type;
{
char *name;
void
c_type_print_varspec_prefix (type, stream, show, passed_a_ptr)
struct type *type;
- FILE *stream;
+ GDB_FILE *stream;
int show;
int passed_a_ptr;
{
case TYPE_CODE_METHOD:
if (passed_a_ptr)
- fprintf (stream, "(");
+ fprintf_unfiltered (stream, "(");
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
if (passed_a_ptr)
{
static void
c_type_print_args (type, stream)
struct type *type;
- FILE *stream;
+ GDB_FILE *stream;
{
int i;
struct type **args;
static void
c_type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args)
struct type *type;
- FILE *stream;
+ GDB_FILE *stream;
int show;
int passed_a_ptr;
int demangled_args;
void
c_type_print_base (type, stream, show, level)
struct type *type;
- FILE *stream;
+ GDB_FILE *stream;
int show;
int level;
{
if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) == 0)
{
/* Keep GDB from crashing here. */
- fprintf (stream, "<undefined type> %s;\n",
+ fprintf_unfiltered (stream, "<undefined type> %s;\n",
TYPE_FN_FIELD_PHYSNAME (f, j));
break;
}
extern int demangle; /* whether to print C++ syms raw or src-form */
extern void
-cp_print_class_member PARAMS ((char *, struct type *, FILE *, char *));
+cp_print_class_member PARAMS ((char *, struct type *, GDB_FILE *, char *));
extern void
-cp_print_class_method PARAMS ((char *, struct type *, FILE *));
+cp_print_class_method PARAMS ((char *, struct type *, GDB_FILE *));
extern void
-cp_print_value_fields PARAMS ((struct type *, char *, FILE *, int, int,
+cp_print_value_fields PARAMS ((struct type *, char *, GDB_FILE *, int, int,
enum val_prettyprint, struct type **));
extern int
/* BEGIN-FIXME: Hooks into c-typeprint.c */
extern void
-c_type_print_varspec_prefix PARAMS ((struct type *, FILE *, int, int));
+c_type_print_varspec_prefix PARAMS ((struct type *, GDB_FILE *, int, int));
extern void
cp_type_print_method_args PARAMS ((struct type **, char *, char *, int,
- FILE *));
+ GDB_FILE *));
/* END-FIXME */
struct type *type;
char *valaddr;
CORE_ADDR address;
- FILE *stream;
+ GDB_FILE *stream;
int format;
int deref_ref;
int recurse;
default:
error ("Invalid C/C++ type code %d in symbol table.", TYPE_CODE (type));
}
- fflush (stream);
+ gdb_flush (stream);
return (0);
}
yyerror (msg)
char *msg; /* unused */
{
- printf ("Parsing: %s\n", lexptr);
+ printf_unfiltered ("Parsing: %s\n", lexptr);
if (yychar < 256)
{
error ("Invalid syntax in expression near character '%c'.", yychar);
static void
chill_printchar (c, stream)
register int c;
- FILE *stream;
+ GDB_FILE *stream;
{
c &= 0xFF; /* Avoid sign bit follies */
static void
chill_printstr (stream, string, length, force_ellipses)
- FILE *stream;
+ GDB_FILE *stream;
char *string;
unsigned int length;
int force_ellipses;
chill_error PARAMS ((char *)); /* Defined in ch-exp.y */
extern void /* Defined in ch-typeprint.c */
-chill_print_type PARAMS ((struct type *, char *, FILE *, int, int));
+chill_print_type PARAMS ((struct type *, char *, GDB_FILE *, int, int));
extern int
-chill_val_print PARAMS ((struct type *, char *, CORE_ADDR, FILE *, int, int,
+chill_val_print PARAMS ((struct type *, char *, CORE_ADDR, GDB_FILE *, int, int,
int, enum val_prettyprint));
#include <errno.h>
static void
-chill_type_print_base PARAMS ((struct type *, FILE *, int, int));
+chill_type_print_base PARAMS ((struct type *, GDB_FILE *, int, int));
void
chill_print_type (type, varstring, stream, show, level)
struct type *type;
char *varstring;
- FILE *stream;
+ GDB_FILE *stream;
int show;
int level;
{
static void
chill_type_print_base (type, stream, show, level)
struct type *type;
- FILE *stream;
+ GDB_FILE *stream;
int show;
int level;
{
#include "c-lang.h" /* For c_val_print */
static void
-chill_print_value_fields PARAMS ((struct type *, char *, FILE *, int, int,
+chill_print_value_fields PARAMS ((struct type *, char *, GDB_FILE *, int, int,
enum val_prettyprint, struct type **));
\f
struct type *type;
char *valaddr;
CORE_ADDR address;
- FILE *stream;
+ GDB_FILE *stream;
int format;
int deref_ref;
int recurse;
c_val_print (type, valaddr, address, stream, format,
deref_ref, recurse, pretty);
}
- fflush (stream);
+ gdb_flush (stream);
return (0);
}
dont_print)
struct type *type;
char *valaddr;
- FILE *stream;
+ GDB_FILE *stream;
int format;
int recurse;
enum val_prettyprint pretty;
show_user PARAMS ((char *, int));
static void
-show_user_1 PARAMS ((struct cmd_list_element *, FILE *));
+show_user_1 PARAMS ((struct cmd_list_element *, GDB_FILE *));
static void
make_command PARAMS ((char *, int));
parse_binary_operation PARAMS ((char *));
static void
-print_doc_line PARAMS ((FILE *, char *));
+print_doc_line PARAMS ((GDB_FILE *, char *));
/* Add element named NAME.
CLASS is the top level category into which commands are broken down
&& setcmd->doc[2] == 't' && setcmd->doc[3] == ' ')
showcmd->doc = concat ("Show ", setcmd->doc + 4, NULL);
else
- fprintf (stderr, "GDB internal error: Bad docstring for set command\n");
+ fprintf_unfiltered (gdb_stderr, "GDB internal error: Bad docstring for set command\n");
showcmd->next = *list;
*list = showcmd;
void
help_cmd (command, stream)
char *command;
- FILE *stream;
+ GDB_FILE *stream;
{
struct cmd_list_element *c;
extern struct cmd_list_element *cmdlist;
struct cmd_list_element *list;
char *cmdtype;
enum command_class class;
- FILE *stream;
+ GDB_FILE *stream;
{
int len;
char *cmdtype1, *cmdtype2;
/* Print only the first line of STR on STREAM. */
static void
print_doc_line (stream, str)
- FILE *stream;
+ GDB_FILE *stream;
char *str;
{
static char *line_buffer = 0;
enum command_class class;
char *prefix;
int recurse;
- FILE *stream;
+ GDB_FILE *stream;
{
register struct cmd_list_element *c;
else if (c->type == show_cmd)
{
/* Print doc minus "show" at start. */
- print_doc_line (stdout, c->doc + 5);
+ print_doc_line (gdb_stdout, c->doc + 5);
- fputs_filtered (" is ", stdout);
+ fputs_filtered (" is ", gdb_stdout);
wrap_here (" ");
switch (c->var_type)
{
case var_string:
{
unsigned char *p;
- fputs_filtered ("\"", stdout);
+ fputs_filtered ("\"", gdb_stdout);
for (p = *(unsigned char **) c->var; *p != '\0'; p++)
- gdb_printchar (*p, stdout, '"');
- fputs_filtered ("\"", stdout);
+ gdb_printchar (*p, gdb_stdout, '"');
+ fputs_filtered ("\"", gdb_stdout);
}
break;
case var_string_noescape:
case var_filename:
- fputs_filtered ("\"", stdout);
- fputs_filtered (*(char **) c->var, stdout);
- fputs_filtered ("\"", stdout);
+ fputs_filtered ("\"", gdb_stdout);
+ fputs_filtered (*(char **) c->var, gdb_stdout);
+ fputs_filtered ("\"", gdb_stdout);
break;
case var_boolean:
- fputs_filtered (*(int *) c->var ? "on" : "off", stdout);
+ fputs_filtered (*(int *) c->var ? "on" : "off", gdb_stdout);
break;
case var_uinteger:
if (*(unsigned int *) c->var == UINT_MAX) {
- fputs_filtered ("unlimited", stdout);
+ fputs_filtered ("unlimited", gdb_stdout);
break;
}
/* else fall through */
case var_zinteger:
- fprintf_filtered (stdout, "%u", *(unsigned int *) c->var);
+ fprintf_filtered (gdb_stdout, "%u", *(unsigned int *) c->var);
break;
case var_integer:
if (*(int *) c->var == INT_MAX)
{
- fputs_filtered ("unlimited", stdout);
+ fputs_filtered ("unlimited", gdb_stdout);
}
else
- fprintf_filtered (stdout, "%d", *(int *) c->var);
+ fprintf_filtered (gdb_stdout, "%d", *(int *) c->var);
break;
default:
error ("gdb internal error: bad var_type in do_setshow_command");
}
- fputs_filtered (".\n", stdout);
+ fputs_filtered (".\n", gdb_stdout);
}
else
error ("gdb internal error: bad cmd_type in do_setshow_command");
cmd_show_list (*list->prefixlist, from_tty, list->prefixname + 5);
if (list->type == show_cmd)
{
- fputs_filtered (prefix, stdout);
- fputs_filtered (list->name, stdout);
- fputs_filtered (": ", stdout);
+ fputs_filtered (prefix, gdb_stdout);
+ fputs_filtered (list->name, gdb_stdout);
+ fputs_filtered (": ", gdb_stdout);
do_setshow_command ((char *)NULL, from_tty, list);
}
}
else
execl (user_shell, p, "-c", arg, 0);
- fprintf (stderr, "Exec of shell failed\n");
+ fprintf_unfiltered (gdb_stderr, "Exec of shell failed\n");
exit (0);
}
static void
show_user_1 (c, stream)
struct cmd_list_element *c;
- FILE *stream;
+ GDB_FILE *stream;
{
register struct command_line *cmdlines;
c = lookup_cmd (&args, cmdlist, "", 0, 1);
if (c->class != class_user)
error ("Not a user command.");
- show_user_1 (c, stdout);
+ show_user_1 (c, gdb_stdout);
}
else
{
for (c = cmdlist; c; c = c->next)
{
if (c->class == class_user)
- show_user_1 (c, stdout);
+ show_user_1 (c, gdb_stdout);
}
}
}
/* If GDB dumps core, we'd like to see the complaints first. Presumably
GDB will not be sending so many complaints that this becomes a
performance hog. */
- fflush (stdout);
+ gdb_flush (gdb_stdout);
va_end (args);
}
else
{
cant:
- fprintf_filtered (stderr, "Couldn't fetch registers from core file: %s\n",
+ fprintf_filtered (gdb_stderr, "Couldn't fetch registers from core file: %s\n",
bfd_errmsg (bfd_error));
}
}
else
{
- fprintf_filtered (stderr, "Couldn't fetch register set 2 from core file: %s\n",
+ fprintf_filtered (gdb_stderr, "Couldn't fetch register set 2 from core file: %s\n",
bfd_errmsg (bfd_error));
}
}
struct obstack dont_print_obstack;
static void
-cplus_print_value PARAMS ((struct type *, char *, FILE *, int, int,
+cplus_print_value PARAMS ((struct type *, char *, GDB_FILE *, int, int,
enum val_prettyprint, struct type **));
/* BEGIN-FIXME: Hooks into typeprint.c, find a better home for prototypes. */
extern void
-c_type_print_base PARAMS ((struct type *, FILE *, int, int));
+c_type_print_base PARAMS ((struct type *, GDB_FILE *, int, int));
extern void
-c_type_print_varspec_prefix PARAMS ((struct type *, FILE *, int, int));
+c_type_print_varspec_prefix PARAMS ((struct type *, GDB_FILE *, int, int));
extern void
cp_type_print_method_args PARAMS ((struct type **, char *, char *, int,
- FILE *));
+ GDB_FILE *));
extern struct obstack dont_print_obstack;
/* BEGIN-FIXME: Hooks into c-valprint.c */
extern int
-c_val_print PARAMS ((struct type *, char *, CORE_ADDR, FILE *, int, int, int,
+c_val_print PARAMS ((struct type *, char *, CORE_ADDR, GDB_FILE *, int, int, int,
enum val_prettyprint));
/* END-FIXME */
cp_print_class_method (valaddr, type, stream)
char *valaddr;
struct type *type;
- FILE *stream;
+ GDB_FILE *stream;
{
struct type *domain;
struct fn_field *f = NULL;
{
fprintf_filtered (stream, "&");
c_type_print_varspec_prefix (TYPE_FN_FIELD_TYPE (f, j), stream, 0, 0);
- fprintf (stream, kind);
+ fprintf_unfiltered (stream, kind);
if (TYPE_FN_FIELD_PHYSNAME (f, j)[0] == '_'
&& TYPE_FN_FIELD_PHYSNAME (f, j)[1] == CPLUS_MARKER)
{
dont_print)
struct type *type;
char *valaddr;
- FILE *stream;
+ GDB_FILE *stream;
int format;
int recurse;
enum val_prettyprint pretty;
cplus_print_value (type, valaddr, stream, format, recurse, pretty, dont_print)
struct type *type;
char *valaddr;
- FILE *stream;
+ GDB_FILE *stream;
int format;
int recurse;
enum val_prettyprint pretty;
cp_print_class_member (valaddr, domain, stream, prefix)
char *valaddr;
struct type *domain;
- FILE *stream;
+ GDB_FILE *stream;
char *prefix;
{
if (pst->readin)
{
- fprintf (stderr, "Psymtab for %s already read in. Shouldn't happen.\n",
+ fprintf_unfiltered (gdb_stderr, "Psymtab for %s already read in. Shouldn't happen.\n",
pst->filename);
return;
}
/* Inform about additional files that need to be read in. */
if (info_verbose)
{
- fputs_filtered (" ", stdout);
+ fputs_filtered (" ", gdb_stdout);
wrap_here ("");
- fputs_filtered ("and ", stdout);
+ fputs_filtered ("and ", gdb_stdout);
wrap_here ("");
printf_filtered ("%s...", pst->dependencies[i]->filename);
wrap_here (""); /* Flush output */
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
dbx_psymtab_to_symtab_1 (pst->dependencies[i]);
}
if (pst->readin)
{
- fprintf (stderr, "Psymtab for %s already read in. Shouldn't happen.\n",
+ fprintf_unfiltered (gdb_stderr, "Psymtab for %s already read in. Shouldn't happen.\n",
pst->filename);
return;
}
if (info_verbose)
{
printf_filtered ("Reading in symbols for %s...", pst->filename);
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
sym_bfd = pst->objfile->obfd;
return offsetof (struct user, u_fpu.regs.iaddr);
else
{
- fprintf (stderr, "\
+ fprintf_unfiltered (gdb_stderr, "\
Internal error: invalid register number %d in REGISTER_U_ADDR\n",
regno);
return blockend;
{
if (*current_demangling_style_string != '\0')
{
- printf ("Unknown demangling style `%s'.\n",
+ printf_unfiltered ("Unknown demangling style `%s'.\n",
current_demangling_style_string);
}
- printf ("The currently understood settings are:\n\n");
+ printf_unfiltered ("The currently understood settings are:\n\n");
for (dem = demanglers; dem -> demangling_style_name != NULL; dem++)
{
- printf ("%-10s %s\n", dem -> demangling_style_name,
+ printf_unfiltered ("%-10s %s\n", dem -> demangling_style_name,
dem -> demangling_style_doc);
if (dem -> demangling_style == current_demangling_style)
{
Mon Oct 25 03:25:41 1993 Tom Lord (lord@cygnus.com)
+ * libgdb.texinfo (I/O): incorporated better phrasing from rich.
+
* libgdb.texinfo (Defining Commands): made the DOC arg
to gdb_define_app_command a char * instead of char **
per a suggestion from kingdon.
@code{default-output-vector}, &c.
The default query function always returns `y'. Other input functions
-always abort. The default output functions do nothing.
+always abort. The default output functions discard output silently.
@node Invoking, Defining Commands, I/O, Top
symfile_bfd = abfd; /* Kludge for swap routines */
/* WARNING WILL ROBINSON! ACCESSING BFD-PRIVATE DATA HERE! FIXME! */
- desc = fileno ((FILE *)(abfd->iostream)); /* File descriptor */
+ desc = fileno ((GDB_FILE *)(abfd->iostream)); /* File descriptor */
/* Read the line number table, all at once. */
bfd_map_over_sections (abfd, find_dst_sections, (PTR)NULL);
}
if (size == -1)
{
- fprintf(stderr, "Warning: unexpected DST entry type (%d) found\nLast valid entry was of type: %d\n",
+ fprintf_unfiltered(gdb_stderr, "Warning: unexpected DST entry type (%d) found\nLast valid entry was of type: %d\n",
(int) entry->rec_type,
last_type);
- fprintf(stderr, "Last unknown_3 value: %d\n", lu3);
+ fprintf_unfiltered(gdb_stderr, "Last unknown_3 value: %d\n", lu3);
size = 0;
}
else
{
if (count++ == 100)
{
- fprintf(stderr, "Error reading locstring\n");
+ fprintf_unfiltered(gdb_stderr, "Error reading locstring\n");
break;
}
entry = (dst_loc_entry_t *) locstr;
/* Inform about additional files that need to be read in. */
if (info_verbose)
{
- fputs_filtered (" ", stdout);
+ fputs_filtered (" ", gdb_stdout);
wrap_here ("");
- fputs_filtered ("and ", stdout);
+ fputs_filtered ("and ", gdb_stdout);
wrap_here ("");
printf_filtered ("%s...",
pst -> dependencies[i] -> filename);
wrap_here ("");
- fflush (stdout); /* Flush output */
+ gdb_flush (gdb_stdout); /* Flush output */
}
psymtab_to_symtab_1 (pst -> dependencies[i]);
}
{
printf_filtered ("%d DIE's, sorting...", diecount);
wrap_here ("");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
sort_symtab_syms (pst -> symtab);
do_cleanups (old_chain);
{
printf_filtered ("Reading in symbols for %s...",
pst -> filename);
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
psymtab_to_symtab_1 (pst);
if (info_verbose)
{
printf_filtered ("done.\n");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
}
}
{
val_print (elttype, valaddr + i * eltlen,
***************
-*** 841,846 ****
+Sun Oct 24 23:48:55 1993*** 841,846 ****
--- 856,862 ----
recurse + 1, pretty);
things_printed++;
}
#ifdef KERNEL_RECORD
-FILE *kerout;
+GDB_FILE *kerout;
static int
kernel_record(fd, ptr, num)
output prior to doing a fork, to avoid the possibility of both the
parent and child flushing the same data after the fork. */
- fflush (stdout);
- fflush (stderr);
+ gdb_flush (gdb_stdout);
+ gdb_flush (gdb_stderr);
#if defined(USG) && !defined(HAVE_VFORK)
pid = fork ();
environ = env;
execlp (shell_file, shell_file, "-c", shell_command, (char *)0);
- fprintf (stderr, "Cannot exec %s: %s.\n", shell_file,
+ fprintf_unfiltered (gdb_stderr, "Cannot exec %s: %s.\n", shell_file,
safe_strerror (errno));
- fflush (stderr);
+ gdb_flush (gdb_stderr);
_exit (0177);
}
TYPE_CODE (type) != TYPE_CODE_UNION)
{
target_terminal_ours ();
- fflush (stdout);
- fprintf (stderr, "Type ");
- type_print (type, "", stderr, -1);
+ gdb_flush (gdb_stdout);
+ fprintf_unfiltered (gdb_stderr, "Type ");
+ type_print (type, "", gdb_stderr, -1);
error (" is not a structure or union type.");
}
}
target_terminal_ours ();
- fflush (stdout);
- fprintf (stderr, "Type ");
- type_print (type, "", stderr, -1);
- fprintf (stderr, " has no component named ");
- fputs_filtered (name, stderr);
+ gdb_flush (gdb_stdout);
+ fprintf_unfiltered (gdb_stderr, "Type ");
+ type_print (type, "", gdb_stderr, -1);
+ fprintf_unfiltered (gdb_stderr, " has no component named ");
+ fputs_filtered (name, gdb_stderr);
error (".");
return (struct type *)-1; /* For lint */
}
/* printcmd.c */
extern void
-print_scalar_formatted PARAMS ((char *, struct type *, int, int, FILE *));
+print_scalar_formatted PARAMS ((char *, struct type *, int, int, GDB_FILE *));
#if MAINTENANCE_CMDS
extern void maintenance_print_type PARAMS ((char *, int));
static void uerror(char *s)
{
- fprintf(stderr, "Fatal: %s!\n");
+ fprintf_unfiltered(gdb_stderr, "Fatal: %s!\n");
exit(1);
}
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
GDB_INIT_DISASSEMBLE_INFO(info, stream);
char *args;
int from_tty;
{
- printf ("\"set machine\" must be followed by h8300 or h8300h.\n");
- help_list (setmemorylist, "set memory ", -1, stdout);
+ printf_unfiltered ("\"set machine\" must be followed by h8300 or h8300h.\n");
+ help_list (setmemorylist, "set memory ", -1, gdb_stdout);
}
void
read_relative_register_raw_bytes (regno, b);
l = b[1];
- printf ("\t");
- printf ("I-%d - ", (l & 0x80) != 0);
- printf ("H-%d - ", (l & 0x20) != 0);
+ printf_unfiltered ("\t");
+ printf_unfiltered ("I-%d - ", (l & 0x80) != 0);
+ printf_unfiltered ("H-%d - ", (l & 0x20) != 0);
N = (l & 0x8) != 0;
Z = (l & 0x4) != 0;
V = (l & 0x2) != 0;
C = (l & 0x1) != 0;
- printf ("N-%d ", N);
- printf ("Z-%d ", Z);
- printf ("V-%d ", V);
- printf ("C-%d ", C);
+ printf_unfiltered ("N-%d ", N);
+ printf_unfiltered ("Z-%d ", Z);
+ printf_unfiltered ("V-%d ", V);
+ printf_unfiltered ("C-%d ", C);
if ((C | Z) == 0)
- printf ("u> ");
+ printf_unfiltered ("u> ");
if ((C | Z) == 1)
- printf ("u<= ");
+ printf_unfiltered ("u<= ");
if ((C == 0))
- printf ("u>= ");
+ printf_unfiltered ("u>= ");
if (C == 1)
- printf ("u< ");
+ printf_unfiltered ("u< ");
if (Z == 0)
- printf ("!= ");
+ printf_unfiltered ("!= ");
if (Z == 1)
- printf ("== ");
+ printf_unfiltered ("== ");
if ((N ^ V) == 0)
- printf (">= ");
+ printf_unfiltered (">= ");
if ((N ^ V) == 1)
- printf ("< ");
+ printf_unfiltered ("< ");
if ((Z | (N ^ V)) == 0)
- printf ("> ");
+ printf_unfiltered ("> ");
if ((Z | (N ^ V)) == 1)
- printf ("<= ");
+ printf_unfiltered ("<= ");
}
}
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
GDB_INIT_DISASSEMBLE_INFO (info, stream);
read_relative_register_raw_bytes (regno, b);
l = b[1];
- printf ("\t");
- printf ("I-%d - ", (l & 0x80) != 0);
+ printf_unfiltered ("\t");
+ printf_unfiltered ("I-%d - ", (l & 0x80) != 0);
N = (l & 0x8) != 0;
Z = (l & 0x4) != 0;
V = (l & 0x2) != 0;
C = (l & 0x1) != 0;
- printf ("N-%d ", N);
- printf ("Z-%d ", Z);
- printf ("V-%d ", V);
- printf ("C-%d ", C);
+ printf_unfiltered ("N-%d ", N);
+ printf_unfiltered ("Z-%d ", Z);
+ printf_unfiltered ("V-%d ", V);
+ printf_unfiltered ("C-%d ", C);
if ((C | Z) == 0)
- printf ("u> ");
+ printf_unfiltered ("u> ");
if ((C | Z) == 1)
- printf ("u<= ");
+ printf_unfiltered ("u<= ");
if ((C == 0))
- printf ("u>= ");
+ printf_unfiltered ("u>= ");
if (C == 1)
- printf ("u< ");
+ printf_unfiltered ("u< ");
if (Z == 0)
- printf ("!= ");
+ printf_unfiltered ("!= ");
if (Z == 1)
- printf ("== ");
+ printf_unfiltered ("== ");
if ((N ^ V) == 0)
- printf (">= ");
+ printf_unfiltered (">= ");
if ((N ^ V) == 1)
- printf ("< ");
+ printf_unfiltered ("< ");
if ((Z | (N ^ V)) == 0)
- printf ("> ");
+ printf_unfiltered ("> ");
if ((Z | (N ^ V)) == 1)
- printf ("<= ");
+ printf_unfiltered ("<= ");
}
}
if (oldsize != newsize)
{
- printf ("pointer size set to %d bits\n", newsize);
+ printf_unfiltered ("pointer size set to %d bits\n", newsize);
oldsize = newsize;
if (newsize == 32)
{
char *args;
int from_tty;
{
- printf ("\"set memory\" must be followed by the name of a memory subcommand.\n");
- help_list (setmemorylist, "set memory ", -1, stdout);
+ printf_unfiltered ("\"set memory\" must be followed by the name of a memory subcommand.\n");
+ help_list (setmemorylist, "set memory ", -1, gdb_stdout);
}
/* See if variable name is ppc or pr[0-7] */
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
{
stop_signal = WTERMSIG (w);
terminal_ours_for_output ();
- printf ("\nProgram terminated with signal %d, %s\n",
+ printf_unfiltered ("\nProgram terminated with signal %d, %s\n",
stop_signal, safe_strsignal (stop_signal));
- fflush (stdout);
+ gdb_flush (gdb_stdout);
return 0;
}
}
if (regnum == -1)
pa_print_registers (raw_regs, regnum, fpregs);
else if (regnum < FP0_REGNUM)
- printf ("%s %x\n", reg_names[regnum], *(long *)(raw_regs +
+ printf_unfiltered ("%s %x\n", reg_names[regnum], *(long *)(raw_regs +
REGISTER_BYTE (regnum)));
else
pa_print_fp_reg (regnum);
int i;
for (i = 0; i < 18; i++)
- printf ("%8.8s: %8x %8.8s: %8x %8.8s: %8x %8.8s: %8x\n",
+ printf_unfiltered ("%8.8s: %8x %8.8s: %8x %8.8s: %8x %8.8s: %8x\n",
reg_names[i],
*(int *)(raw_regs + REGISTER_BYTE (i)),
reg_names[i + 18],
read_relative_register_raw_bytes (i, raw_buffer);
REGISTER_CONVERT_TO_VIRTUAL (i, raw_buffer, virtual_buffer);
- fputs_filtered (reg_names[i], stdout);
- print_spaces_filtered (15 - strlen (reg_names[i]), stdout);
+ fputs_filtered (reg_names[i], gdb_stdout);
+ print_spaces_filtered (15 - strlen (reg_names[i]), gdb_stdout);
- val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, stdout, 0,
+ val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, gdb_stdout, 0,
1, 0, Val_pretty_default);
printf_filtered ("\n");
}
if (!xxx.u)
{
- printf ("Can't find unwind table entry for PC 0x%x\n", address);
+ printf_unfiltered ("Can't find unwind table entry for PC 0x%x\n", address);
return;
}
- printf ("%08x\n%08X\n%08X\n%08X\n", xxx.foo[0], xxx.foo[1], xxx.foo[2],
+ printf_unfiltered ("%08x\n%08X\n%08X\n%08X\n", xxx.foo[0], xxx.foo[1], xxx.foo[2],
xxx.foo[3]);
}
#endif /* MAINTENANCE_CMDS */
xmitcsum += hex(ch);
if ((remote_debug ) && (checksum != xmitcsum))
{
- fprintf(stderr,"bad checksum. My count = 0x%x, sent=0x%x. buf=%s\n",
+ fprintf_unfiltered(gdb_stderr,"bad checksum. My count = 0x%x, sent=0x%x. buf=%s\n",
checksum,xmitcsum,buffer);
}
{
if (remote_debug)
{
- fprintf (stderr, format, parm);
- fprintf (stderr, "\n");
+ fprintf_unfiltered (gdb_stderr, format, parm);
+ fprintf_unfiltered (gdb_stderr, "\n");
}
}
/* Create a screen for the debugger. */
console_screen = CreateScreen ("System Console", 0);
if (DisplayScreen (console_screen) != ESUCCESS)
- fprintf (stderr, "DisplayScreen failed\n");
+ fprintf_unfiltered (gdb_stderr, "DisplayScreen failed\n");
if (argc < 4)
{
- fprintf (stderr,
+ fprintf_unfiltered (gdb_stderr,
"Usage: load gdbserver board port program [arguments]\n");
exit (1);
}
switch (err)
{
case AIO_PORT_NOT_AVAILABLE:
- fprintf (stderr, "Port not available\n");
+ fprintf_unfiltered (gdb_stderr, "Port not available\n");
break;
case AIO_BOARD_NUMBER_INVALID:
case AIO_PORT_NUMBER_INVALID:
- fprintf (stderr, "No such port\n");
+ fprintf_unfiltered (gdb_stderr, "No such port\n");
break;
default:
- fprintf (stderr, "Could not open port: %d\n", err);
+ fprintf_unfiltered (gdb_stderr, "Could not open port: %d\n", err);
break;
}
AIO_HARDWARE_FLOW_CONTROL_OFF);
if (err != AIO_SUCCESS)
{
- fprintf (stderr, "Could not configure port: %d\n", err);
+ fprintf_unfiltered (gdb_stderr, "Could not configure port: %d\n", err);
AIOReleasePort (AIOhandle);
exit (1);
}
DebuggerSignature));
if (s.DDSResourceTag == 0)
{
- fprintf (stderr, "AllocateResourceTag failed\n");
+ fprintf_unfiltered (gdb_stderr, "AllocateResourceTag failed\n");
AIOReleasePort (AIOhandle);
exit (1);
}
err = RegisterDebuggerRTag (&s, AT_FIRST);
if (err != 0)
{
- fprintf (stderr, "RegisterDebuggerRTag failed\n");
+ fprintf_unfiltered (gdb_stderr, "RegisterDebuggerRTag failed\n");
AIOReleasePort (AIOhandle);
exit (1);
}
"$?#xx") sitting there. */
if (! putDebugChar ('+'))
{
- fprintf (stderr, "putDebugChar failed\n");
+ fprintf_unfiltered (gdb_stderr, "putDebugChar failed\n");
UnRegisterDebugger (&s);
AIOReleasePort (AIOhandle);
exit (1);
cmdlin, LO_DEBUG);
if (err != 0)
{
- fprintf (stderr, "LoadModule failed: %d\n", err);
+ fprintf_unfiltered (gdb_stderr, "LoadModule failed: %d\n", err);
UnRegisterDebugger (&s);
AIOReleasePort (AIOhandle);
exit (1);
/* If we are woken up, print an optional error message, deregister
ourselves and exit. */
if (error_message != NULL)
- fprintf (stderr, "%s\n", error_message);
+ fprintf_unfiltered (gdb_stderr, "%s\n", error_message);
UnRegisterDebugger (&s);
AIOReleasePort (AIOhandle);
exit (0);
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
if (status != 0)
{
if (bothstatus)
- printf ("u: ");
+ printf_unfiltered ("u: ");
print_387_status_word (status);
}
if (ep->status != 0)
{
if (bothstatus)
- printf ("e: ");
+ printf_unfiltered ("e: ");
print_387_status_word (ep->status);
}
print_387_control_word (ep->control);
- printf ("last exception: ");
- printf ("opcode %s; ", local_hex_string(ep->opcode));
- printf ("pc %s:", local_hex_string(ep->code_seg));
- printf ("%s; ", local_hex_string(ep->eip));
- printf ("operand %s", local_hex_string(ep->operand_seg));
- printf (":%s\n", local_hex_string(ep->operand));
+ printf_unfiltered ("last exception: ");
+ printf_unfiltered ("opcode %s; ", local_hex_string(ep->opcode));
+ printf_unfiltered ("pc %s:", local_hex_string(ep->code_seg));
+ printf_unfiltered ("%s; ", local_hex_string(ep->eip));
+ printf_unfiltered ("operand %s", local_hex_string(ep->operand_seg));
+ printf_unfiltered (":%s\n", local_hex_string(ep->operand));
top = 7- ((ep->status >> 11) & 7);
- printf ("regno tag msb lsb value\n");
+ printf_unfiltered ("regno tag msb lsb value\n");
for (fpreg = 7; fpreg >= 0; fpreg--)
{
double val;
- printf ("%s %d: ", fpreg == top ? "=>" : " ", fpreg);
+ printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : " ", fpreg);
switch ((ep->tag >> ((7 - fpreg) * 2)) & 3)
{
- case 0: printf ("valid "); break;
- case 1: printf ("zero "); break;
- case 2: printf ("trap "); break;
- case 3: printf ("empty "); break;
+ case 0: printf_unfiltered ("valid "); break;
+ case 1: printf_unfiltered ("zero "); break;
+ case 2: printf_unfiltered ("trap "); break;
+ case 3: printf_unfiltered ("empty "); break;
}
for (i = 9; i >= 0; i--)
- printf ("%02x", ep->regs[fpreg][i]);
+ printf_unfiltered ("%02x", ep->regs[fpreg][i]);
i387_to_double ((char *)ep->regs[fpreg], (char *)&val);
- printf (" %#g\n", val);
+ printf_unfiltered (" %#g\n", val);
}
}
if (fpsaved == 0)
{
- printf ("no floating point status saved\n");
+ printf_unfiltered ("no floating point status saved\n");
return;
}
if (core_reg_size >= sizeof (core_env387))
memcpy (&core_env387, core_reg_sect, core_reg_size);
else
- fprintf (stderr, "Couldn't read float regs from core file\n");
+ fprintf_unfiltered (gdb_stderr, "Couldn't read float regs from core file\n");
}
}
--- /dev/null
+<<<<<<< 2.6 is dead >>>>>>>
+/* Native-dependent code for Lynx running on i386's, for GDB.
+ Copyright 1988, 1989, 1991, 1992, 1993
+ Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include "defs.h"
+#include "frame.h"
+#include "inferior.h"
+#include "target.h"
+
+#include <sys/ptrace.h>
+#include "/usr/include/sys/wait.h"
+
+/* these values indicate the offset of the named register in the econtext
+ structure */
+
+#define EAX 10
+#define ECX 9
+#define EDX 8
+#define EBX 7
+#define ESP 16
+#define EBP 5
+#define ESI 4
+#define EDI 3
+#define EIP 13
+#define EFL 15
+#define CS 14
+#define SS 17
+#define DS 2
+#define ES 1
+
+/* Currently these are not being used. So set them to 0 */
+
+#define FS 0
+#define GS 0
+
+/* this table must line up with REGISTER_NAMES in m-i386.h */
+static unsigned int regmap[] =
+{
+ EAX, ECX, EDX, EBX,
+ ESP, EBP, ESI, EDI,
+ EIP, EFL, CS, SS,
+ DS, ES, FS, GS,
+};
+
+/* Return the address in the core dump or inferior of register REGNO.
+ BLOCKEND is the address of the econtext structure */
+
+static unsigned int
+register_addr (regno, blockend)
+ int regno, blockend;
+{
+ if (regno < 0 || regno >= NUM_REGS)
+ error ("Invalid register number %d.", regno);
+
+ return (blockend + regmap[regno] * sizeof (long));
+}
+
+/* Fetch one register. */
+
+static void
+fetch_register (regno, offset, bpid)
+ int regno, bpid;
+ unsigned int offset;
+{
+ unsigned int regaddr;
+ char buf[MAX_REGISTER_RAW_SIZE];
+ char mess[128]; /* For messages */
+ int i;
+
+ regaddr = register_addr (regno, offset);
+ for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
+ {
+ errno = 0;
+ *(int *) &buf[i] = ptrace (PTRACE_PEEKTHREAD, bpid,
+ (PTRACE_ARG3_TYPE) regaddr, 0);
+ regaddr += sizeof (int);
+ if (errno != 0)
+ {
+ sprintf (mess, "reading register %s (#%d)", reg_names[regno], regno);
+ perror_with_name (mess);
+ }
+ }
+ supply_register (regno, buf);
+}
+
+/* Store our register values back into the inferior.
+ If REGNO is -1, do this for all registers.
+ Otherwise, REGNO specifies which register (so we can save time). */
+
+static void
+store_register (regno, offset, bpid)
+ int regno, bpid;
+ unsigned int offset;
+{
+ unsigned int regaddr;
+ char mess[128];
+ extern char registers[];
+ int i;
+
+ regaddr = register_addr (regno, offset);
+ for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int))
+ {
+ errno = 0;
+ ptrace (PTRACE_POKEUSER, bpid, (PTRACE_ARG3_TYPE) regaddr,
+ *(int *) ®isters[REGISTER_BYTE (regno) + i]);
+ if (errno != 0)
+ {
+ sprintf (mess, "writing register number %d(%d)", regno, i);
+ perror_with_name (mess);
+ }
+ regaddr += sizeof(int);
+ }
+}
+
+/* return an offset for use with register_addr() */
+
+static unsigned int
+fetch_offset (pid)
+ int pid;
+{
+ struct st_entry s;
+ unsigned int specpage_off, offset = (char *) &s.ecp - (char *) &s;
+
+ errno = 0;
+ specpage_off = ptrace (PTRACE_THREADUSER, pid, (PTRACE_ARG3_TYPE) 0, 0);
+ if (errno != 0)
+ perror_with_name ("ptrace");
+ errno = 0;
+ offset = ptrace (PTRACE_PEEKTHREAD, pid, (PTRACE_ARG3_TYPE) offset, 0)
+ - specpage_off;
+ if (errno != 0)
+ perror_with_name ("ptrace");
+ return offset;
+}
+
+/* Fetch all registers, or just one, from the child process. */
+
+void
+fetch_inferior_registers (regno)
+ int regno;
+{
+ unsigned int offset = fetch_offset (inferior_pid);
+
+ if (regno == -1)
+ {
+ for (regno = 0; regno < NUM_REGS; regno++)
+ fetch_register (regno, offset, inferior_pid);
+ }
+ else
+ fetch_register (regno, offset, inferior_pid);
+}
+
+/* Store all registers, or just one, to the child process. */
+
+void
+store_inferior_registers (regno)
+ int regno;
+{
+ unsigned int offset = fetch_offset (inferior_pid);
+
+ if (regno == -1)
+ {
+ for (regno = 0; regno < NUM_REGS; regno++)
+ store_register (regno, offset, inferior_pid);
+ }
+ else
+ store_register (regno, offset, inferior_pid);
+}
+
+/* Wait for child to do something. Return pid of child, or -1 in case
+ of error; store status through argument pointer STATUS. */
+
+int
+child_wait (pid, status)
+ int pid;
+ int *status;
+{
+ int save_errno;
+ int thread;
+
+ while (1)
+ {
+ int sig;
+
+ if (attach_flag)
+ set_sigint_trap(); /* Causes SIGINT to be passed on to the
+ attached process. */
+ pid = wait (status);
+ save_errno = errno;
+
+ if (attach_flag)
+ clear_sigint_trap();
+
+ if (pid == -1)
+ {
+ if (save_errno == EINTR)
+ continue;
+ fprintf_unfiltered (gdb_stderr, "Child process unexpectedly missing: %s.\n",
+ safe_strerror (save_errno));
+ *status = 42; /* Claim it exited with signal 42 */
+ return -1;
+ }
+
+ if (pid != PIDGET (inferior_pid)) /* Some other process?!? */
+ continue;
+
+/* thread = WIFTID (*status);*/
+ thread = *status >> 16;
+
+ /* Initial thread value can only be acquired via wait, so we have to
+ resort to this hack. */
+
+ if (TIDGET (inferior_pid) == 0)
+ {
+ inferior_pid = BUILDPID (inferior_pid, thread);
+ add_thread (inferior_pid);
+ }
+
+ pid = BUILDPID (pid, thread);
+
+ return pid;
+ }
+}
+
+/* Convert a Lynx process ID to a string. Returns the string in a static
+ buffer. */
+
+char *
+i386lynx_pid_to_str (pid)
+ int pid;
+{
+ static char buf[40];
+
+ sprintf (buf, "process %d thread %d", PIDGET (pid), TIDGET (pid));
+
+ return buf;
+}
+
+/* Extract the register values out of the core file and store
+ them where `read_register' will find them.
+
+ CORE_REG_SECT points to the register values themselves, read into memory.
+ CORE_REG_SIZE is the size of that area.
+ WHICH says which set of registers we are handling (0 = int, 2 = float
+ on machines where they are discontiguous).
+ REG_ADDR is the offset from u.u_ar0 to the register values relative to
+ core_reg_sect. This is used with old-fashioned core files to
+ locate the registers in a large upage-plus-stack ".reg" section.
+ Original upage address X is at location core_reg_sect+x+reg_addr.
+ */
+
+void
+fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
+ char *core_reg_sect;
+ unsigned core_reg_size;
+ int which;
+ unsigned reg_addr;
+{
+ struct st_entry s;
+ unsigned int regno, addr;
+
+ for (regno = 0; regno < NUM_REGS; regno++)
+ {
+ addr = register_addr (regno, (char *) &s.ec - (char *) &s);
+ supply_register (regno, core_reg_sect + addr);
+ }
+}
if (status != 0)
{
if (bothstatus)
- printf ("u: ");
+ printf_unfiltered ("u: ");
print_387_status_word (status);
}
if (ep->status != 0)
{
if (bothstatus)
- printf ("e: ");
+ printf_unfiltered ("e: ");
print_387_status_word (ep->status);
}
print_387_control_word (ep->control);
- printf ("last exception: ");
- printf ("opcode %s; ", local_hex_string(ep->opcode));
- printf ("pc %s:", local_hex_string(ep->code_seg));
- printf ("%s; ", local_hex_string(ep->eip));
- printf ("operand %s", local_hex_string(ep->operand_seg));
- printf (":%s\n", local_hex_string(ep->operand));
+ printf_unfiltered ("last exception: ");
+ printf_unfiltered ("opcode %s; ", local_hex_string(ep->opcode));
+ printf_unfiltered ("pc %s:", local_hex_string(ep->code_seg));
+ printf_unfiltered ("%s; ", local_hex_string(ep->eip));
+ printf_unfiltered ("operand %s", local_hex_string(ep->operand_seg));
+ printf_unfiltered (":%s\n", local_hex_string(ep->operand));
top = (ep->status >> 11) & 7;
- printf ("regno tag msb lsb value\n");
+ printf_unfiltered ("regno tag msb lsb value\n");
for (fpreg = 7; fpreg >= 0; fpreg--)
{
double val;
- printf ("%s %d: ", fpreg == top ? "=>" : " ", fpreg);
+ printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : " ", fpreg);
switch ((ep->tag >> (fpreg * 2)) & 3)
{
- case 0: printf ("valid "); break;
- case 1: printf ("zero "); break;
- case 2: printf ("trap "); break;
- case 3: printf ("empty "); break;
+ case 0: printf_unfiltered ("valid "); break;
+ case 1: printf_unfiltered ("zero "); break;
+ case 2: printf_unfiltered ("trap "); break;
+ case 3: printf_unfiltered ("empty "); break;
}
for (i = 9; i >= 0; i--)
- printf ("%02x", ep->regs[fpreg][i]);
+ printf_unfiltered ("%02x", ep->regs[fpreg][i]);
ieee_extended_to_double (&ext_format_i387, (char *)ep->regs[fpreg],
&val);
- printf (" %g\n", val);
+ printf_unfiltered (" %g\n", val);
}
if (ep->r0)
- printf ("warning: reserved0 is %s\n", local_hex_string(ep->r0));
+ printf_unfiltered ("warning: reserved0 is %s\n", local_hex_string(ep->r0));
if (ep->r1)
- printf ("warning: reserved1 is %s\n", local_hex_string(ep->r1));
+ printf_unfiltered ("warning: reserved1 is %s\n", local_hex_string(ep->r1));
if (ep->r2)
- printf ("warning: reserved2 is %s\n", local_hex_string(ep->r2));
+ printf_unfiltered ("warning: reserved2 is %s\n", local_hex_string(ep->r2));
if (ep->r3)
- printf ("warning: reserved3 is %s\n", local_hex_string(ep->r3));
+ printf_unfiltered ("warning: reserved3 is %s\n", local_hex_string(ep->r3));
}
/*
if (fpvalid == 0)
{
- printf ("no floating point status saved\n");
+ printf_unfiltered ("no floating point status saved\n");
return;
}
print_387_control_word (control)
unsigned int control;
{
- printf ("control %s: ", local_hex_string(control));
- printf ("compute to ");
+ printf_unfiltered ("control %s: ", local_hex_string(control));
+ printf_unfiltered ("compute to ");
switch ((control >> 8) & 3)
{
- case 0: printf ("24 bits; "); break;
- case 1: printf ("(bad); "); break;
- case 2: printf ("53 bits; "); break;
- case 3: printf ("64 bits; "); break;
+ case 0: printf_unfiltered ("24 bits; "); break;
+ case 1: printf_unfiltered ("(bad); "); break;
+ case 2: printf_unfiltered ("53 bits; "); break;
+ case 3: printf_unfiltered ("64 bits; "); break;
}
- printf ("round ");
+ printf_unfiltered ("round ");
switch ((control >> 10) & 3)
{
- case 0: printf ("NEAREST; "); break;
- case 1: printf ("DOWN; "); break;
- case 2: printf ("UP; "); break;
- case 3: printf ("CHOP; "); break;
+ case 0: printf_unfiltered ("NEAREST; "); break;
+ case 1: printf_unfiltered ("DOWN; "); break;
+ case 2: printf_unfiltered ("UP; "); break;
+ case 3: printf_unfiltered ("CHOP; "); break;
}
if (control & 0x3f)
{
- printf ("mask:");
- if (control & 0x0001) printf (" INVALID");
- if (control & 0x0002) printf (" DENORM");
- if (control & 0x0004) printf (" DIVZ");
- if (control & 0x0008) printf (" OVERF");
- if (control & 0x0010) printf (" UNDERF");
- if (control & 0x0020) printf (" LOS");
- printf (";");
+ printf_unfiltered ("mask:");
+ if (control & 0x0001) printf_unfiltered (" INVALID");
+ if (control & 0x0002) printf_unfiltered (" DENORM");
+ if (control & 0x0004) printf_unfiltered (" DIVZ");
+ if (control & 0x0008) printf_unfiltered (" OVERF");
+ if (control & 0x0010) printf_unfiltered (" UNDERF");
+ if (control & 0x0020) printf_unfiltered (" LOS");
+ printf_unfiltered (";");
}
- printf ("\n");
+ printf_unfiltered ("\n");
if (control & 0xe080) warning ("reserved bits on: %s\n",
local_hex_string(control & 0xe080));
}
print_387_status_word (status)
unsigned int status;
{
- printf ("status %s: ", local_hex_string (status));
+ printf_unfiltered ("status %s: ", local_hex_string (status));
if (status & 0xff)
{
- printf ("exceptions:");
- if (status & 0x0001) printf (" INVALID");
- if (status & 0x0002) printf (" DENORM");
- if (status & 0x0004) printf (" DIVZ");
- if (status & 0x0008) printf (" OVERF");
- if (status & 0x0010) printf (" UNDERF");
- if (status & 0x0020) printf (" LOS");
- if (status & 0x0040) printf (" FPSTACK");
- printf ("; ");
+ printf_unfiltered ("exceptions:");
+ if (status & 0x0001) printf_unfiltered (" INVALID");
+ if (status & 0x0002) printf_unfiltered (" DENORM");
+ if (status & 0x0004) printf_unfiltered (" DIVZ");
+ if (status & 0x0008) printf_unfiltered (" OVERF");
+ if (status & 0x0010) printf_unfiltered (" UNDERF");
+ if (status & 0x0020) printf_unfiltered (" LOS");
+ if (status & 0x0040) printf_unfiltered (" FPSTACK");
+ printf_unfiltered ("; ");
}
- printf ("flags: %d%d%d%d; ",
+ printf_unfiltered ("flags: %d%d%d%d; ",
(status & 0x4000) != 0,
(status & 0x0400) != 0,
(status & 0x0200) != 0,
/* FIXME: Someone claims this should be 7 - (status >> 11) & 7 for AIX.
What's the story? Is the following just wrong or are differing
notations in use? */
- printf ("top %d\n", (status >> 11) & 7);
+ printf_unfiltered ("top %d\n", (status >> 11) & 7);
}
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
*/
for ( i = 0; i < TYPELEN; i++ ){
if ( types[i].hostsize != types[i].i960size ){
- printf("sizeof(%s) != %d: PROCEED AT YOUR OWN RISK!\n",
+ printf_unfiltered("sizeof(%s) != %d: PROCEED AT YOUR OWN RISK!\n",
types[i].typename, types[i].i960size );
}
# define NUMMSGS ((int)( sizeof(sigmsgs) / sizeof(sigmsgs[0]) ))
if (siggnal < NSIG) {
- printf ("\nProgram received signal %d, %s\n",
+ printf_unfiltered ("\nProgram received signal %d, %s\n",
siggnal, safe_strsignal (siggnal));
} else {
/* The various target_wait()s bias the 80960 "signal number"
"unbias" it before using it. */
siggnal -= NSIG;
- printf("Program stopped for reason #%d: %s.\n", siggnal,
+ printf_unfiltered("Program stopped for reason #%d: %s.\n", siggnal,
(siggnal < NUMMSGS && siggnal >= 0)?
sigmsgs[siggnal] : unknown );
}
puts_filtered(" ");
puts_filtered(inferior_args);
puts_filtered("\n");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
target_create_inferior (exec_file, inferior_args,
printf_filtered ("\
Single stepping until exit from function %s, \n\
which has no line number information.\n", name);
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
}
else
BLOCK_GCC_COMPILED (SYMBOL_BLOCK_VALUE (function))));
printf_filtered ("Value returned is $%d = ", record_latest_value (val));
- value_print (val, stdout, 0, Val_no_prettyprint);
+ value_print (val, gdb_stdout, 0, Val_no_prettyprint);
printf_filtered ("\n");
}
do_cleanups(old_chain);
continue;
}
- fputs_filtered (reg_names[i], stdout);
- print_spaces_filtered (15 - strlen (reg_names[i]), stdout);
+ fputs_filtered (reg_names[i], gdb_stdout);
+ print_spaces_filtered (15 - strlen (reg_names[i]), gdb_stdout);
/* Get the data in raw format, then convert also to virtual format. */
if (read_relative_register_raw_bytes (i, raw_buffer))
register int j;
val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0,
- stdout, 0, 1, 0, Val_pretty_default);
+ gdb_stdout, 0, 1, 0, Val_pretty_default);
printf_filtered ("\t(raw 0x");
for (j = 0; j < REGISTER_RAW_SIZE (i); j++)
else
{
val_print (REGISTER_VIRTUAL_TYPE (i), raw_buffer, 0,
- stdout, 'x', 1, 0, Val_pretty_default);
+ gdb_stdout, 'x', 1, 0, Val_pretty_default);
printf_filtered ("\t");
val_print (REGISTER_VIRTUAL_TYPE (i), raw_buffer, 0,
- stdout, 0, 1, 0, Val_pretty_default);
+ gdb_stdout, 0, 1, 0, Val_pretty_default);
}
/* The SPARC wants to print even-numbered float regs as doubles
int from_tty;
{
printf_filtered ("\"unset\" must be followed by the name of an unset subcommand.\n");
- help_list (unsetlist, "unset ", -1, stdout);
+ help_list (unsetlist, "unset ", -1, gdb_stdout);
}
void
#include "serial.h"
#include "terminal.h"
#include "target.h"
+#include "thread.h"
#include <signal.h>
#include <fcntl.h>
}
return gdb_has_a_terminal_flag == yes;
+ default:
+ /* "Can't happen". */
+ return 0;
}
}
#define OOPSY(what) \
if (result == -1) \
- fprintf(stderr, "[%s failed in terminal_inferior: %s]\n", \
+ fprintf_unfiltered(gdb_stderr, "[%s failed in terminal_inferior: %s]\n", \
what, strerror (errno))
static void terminal_ours_1 PARAMS ((int));
used to check for an error here, so perhaps there are other
such situations as well. */
if (result == -1)
- fprintf (stderr, "[tcsetpgrp failed in terminal_ours: %s]\n",
+ fprintf_unfiltered (gdb_stderr, "[tcsetpgrp failed in terminal_ours: %s]\n",
strerror (errno));
#endif
#endif /* termios */
error ("Not confirmed.");
target_kill ();
+ init_thread_list(); /* Destroy thread info */
+
/* Killing off the inferior can leave us with a core file. If so,
print the state we are left in. */
if (target_has_stack) {
printf_filtered ("In %s,\n", current_target->to_longname);
if (selected_frame == NULL)
- fputs_filtered ("No selected stack frame.\n", stdout);
+ fputs_filtered ("No selected stack frame.\n", gdb_stdout);
else
print_stack_frame (selected_frame, selected_frame_level, 1);
}
static CORE_ADDR prev_pc;
static CORE_ADDR prev_sp;
static CORE_ADDR prev_func_start;
-static CORE_ADDR prev_func_end;
static char *prev_func_name;
\f
int random_signal;
CORE_ADDR stop_sp = 0;
CORE_ADDR stop_func_start;
- CORE_ADDR stop_func_end;
char *stop_func_name;
CORE_ADDR prologue_pc = 0, tmp;
struct symtab_and_line sal;
else
if (!batch_mode())
printf_filtered ("\nProgram exited normally.\n");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
target_mourn_inferior ();
#ifdef NO_SINGLE_STEP
one_stepped = 0;
printf_filtered (", %s\n", safe_strsignal (stop_signal));
#endif
printf_filtered ("The program no longer exists.\n");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
#ifdef NO_SINGLE_STEP
one_stepped = 0;
#endif
if (!in_thread_list (pid))
{
- fprintf (stderr, "[New %s]\n", target_pid_to_str (pid));
+ fprintf_unfiltered (gdb_stderr, "[New %s]\n", target_pid_to_str (pid));
add_thread (pid);
target_resume (-1, 0, 0);
printf_filtered ("%s (%d)", signame, stop_signal);
printf_filtered (", %s\n", safe_strsignal (stop_signal));
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
if (stop_signal == SIGTRAP
stop_frame_address = FRAME_FP (get_current_frame ());
stop_sp = read_sp ();
stop_func_start = 0;
- stop_func_end = 0;
stop_func_name = 0;
/* Don't care about return value; stop_func_start and stop_func_name
will both be 0 if it doesn't work. */
find_pc_partial_function (stop_pc, &stop_func_name, &stop_func_start,
- &stop_func_end);
+ NULL);
stop_func_start += FUNCTION_START_OFFSET;
another_trap = 0;
bpstat_clear (&stop_bpstat);
printf_filtered ("%s (%d)", signame, stop_signal);
printf_filtered (", %s\n", safe_strsignal (stop_signal));
#endif /* PRINT_RANDOM_SIGNAL */
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
if (stop_signal >= NSIG
|| signal_stop[stop_signal])
or the call instruction itself saves the PC on the stack. */
|| prologue_pc != stop_func_start
|| stop_sp != prev_sp)
- && (/* PC is out of bounds of the current function. Note that this
- seems sorta redundant w.r.t the prior test of stop_func_start
- != prev_func_start... */
- stop_pc < prev_func_start
- || stop_pc >= prev_func_end
+ && (/* PC is completely out of bounds of any known objfiles. Treat
+ like a subroutine call. */
+ ! stop_func_start
/* If we do a call, we will be at the start of a function. */
|| stop_pc == stop_func_start
original pc would not have
been at the start of a
function. */
- prev_func_end = stop_func_end;
prev_func_name = stop_func_name;
prev_sp = stop_sp;
loop. */
prev_pc = read_pc ();
prev_func_start = stop_func_start;
- prev_func_end = stop_func_end;
prev_func_name = stop_func_name;
prev_sp = stop_sp;
}
}
else
{
- printf ("Not confirmed, unchanged.\n");
- fflush (stdout);
+ printf_unfiltered ("Not confirmed, unchanged.\n");
+ gdb_flush (gdb_stdout);
}
}
break;
fprintf (stderr, "Cannot exec %s: %s.\n", shell_file,
errno < sys_nerr ? sys_errlist[errno] : "unknown error");
- fflush (stderr);
+ gdb_flush (stderr);
_exit (0177);
}
{
printf ("Attaching program: %s pid %d\n",
exec_file, pid);
- fflush (stdout);
+ gdb_flush (stdout);
}
attach (pid);
else
if (!batch_mode())
printf ("\nProgram exited normally.\n");
- fflush (stdout);
+ gdb_flush (stdout);
target_mourn_inferior ();
#ifdef NO_SINGLE_STEP
one_stepped = 0;
? sys_siglist[stop_signal]
: "(undocumented)");
printf ("The inferior process no longer exists.\n");
- fflush (stdout);
+ gdb_flush (stdout);
#ifdef NO_SINGLE_STEP
one_stepped = 0;
#endif
? sys_siglist[stop_signal]
: "(undocumented)");
#endif /* PRINT_RANDOM_SIGNAL */
- fflush (stdout);
+ gdb_flush (stdout);
}
if (stop_signal >= NSIG
|| signal_stop[stop_signal])
/* FIXME -- do this from the list, with HELP. */
if (!language || !language[0]) {
- printf("The currently understood settings are:\n\n");
- printf ("local or auto Automatic setting based on source file\n");
- printf ("c Use the C language\n");
- printf ("c++ Use the C++ language\n");
- printf ("chill Use the Chill language\n");
- printf ("modula-2 Use the Modula-2 language\n");
+ printf_unfiltered("The currently understood settings are:\n\n");
+ printf_unfiltered ("local or auto Automatic setting based on source file\n");
+ printf_unfiltered ("c Use the C language\n");
+ printf_unfiltered ("c++ Use the C++ language\n");
+ printf_unfiltered ("chill Use the Chill language\n");
+ printf_unfiltered ("modula-2 Use the Modula-2 language\n");
/* Restore the silly string. */
set_language(current_language->la_language);
return;
int from_tty;
{
if (type_check != current_language->la_type_check)
- printf(
+ printf_unfiltered(
"Warning: the current type check setting does not match the language.\n");
}
{
if (range_check != current_language->la_range_check)
- printf(
+ printf_unfiltered(
"Warning: the current range check setting does not match the language.\n");
}
return;
expected_language = current_language;
- printf("Current language: %s\n",language);
+ printf_unfiltered("Current language: %s\n",language);
show_language_command((char *)0, 1);
if (!quietly)
{
- printf("Type checking: %s\n",type);
+ printf_unfiltered("Type checking: %s\n",type);
show_type_command((char *)0, 1);
- printf("Range checking: %s\n",range);
+ printf_unfiltered("Range checking: %s\n",range);
show_range_command((char *)0, 1);
}
}
char *string;
if (type_check==type_check_warn)
- fprintf(stderr,warning_pre_print);
+ fprintf_unfiltered(gdb_stderr,warning_pre_print);
else
target_terminal_ours();
va_start (args);
string = va_arg (args, char *);
- vfprintf (stderr, string, args);
- fprintf (stderr, "\n");
+ vfprintf_unfiltered (gdb_stderr, string, args);
+ fprintf_unfiltered (gdb_stderr, "\n");
va_end (args);
if (type_check==type_check_on)
return_to_top_level (RETURN_ERROR);
char *string;
if (range_check==range_check_warn)
- fprintf(stderr,warning_pre_print);
+ fprintf_unfiltered(gdb_stderr,warning_pre_print);
else
target_terminal_ours();
va_start (args);
string = va_arg (args, char *);
- vfprintf (stderr, string, args);
- fprintf (stderr, "\n");
+ vfprintf_unfiltered (gdb_stderr, string, args);
+ fprintf_unfiltered (gdb_stderr, "\n");
va_end (args);
if (range_check==range_check_on)
return_to_top_level (RETURN_ERROR);
char *ignore;
int from_tty;
{
- printf(
+ printf_unfiltered(
"\"set check\" must be followed by the name of a check subcommand.\n");
- help_list(setchecklist, "set check ", -1, stdout);
+ help_list(setchecklist, "set check ", -1, gdb_stdout);
}
static void
{
if (lang->la_magic != LANG_MAGIC)
{
- fprintf(stderr, "Magic number of %s language struct wrong\n",
+ fprintf_unfiltered(gdb_stderr, "Magic number of %s language struct wrong\n",
lang->la_name);
abort();
}
static void
unk_lang_printchar (c, stream)
register int c;
- FILE *stream;
+ GDB_FILE *stream;
{
error ("internal error - unimplemented function unk_lang_printchar called.");
}
static void
unk_lang_printstr (stream, string, length, force_ellipses)
- FILE *stream;
+ GDB_FILE *stream;
char *string;
unsigned int length;
int force_ellipses;
unk_lang_print_type (type, varstring, stream, show, level)
struct type *type;
char *varstring;
- FILE *stream;
+ GDB_FILE *stream;
int show;
int level;
{
struct type *type;
char *valaddr;
CORE_ADDR address;
- FILE *stream;
+ GDB_FILE *stream;
int format;
int deref_ref;
int recurse;
void (*la_error) PARAMS ((char *));
- void (*la_printchar) PARAMS ((int, FILE *));
+ void (*la_printchar) PARAMS ((int, GDB_FILE *));
- void (*la_printstr) PARAMS ((FILE *, char *, unsigned int, int));
+ void (*la_printstr) PARAMS ((GDB_FILE *, char *, unsigned int, int));
struct type *(*la_fund_type) PARAMS ((struct objfile *, int));
/* Print a type using syntax appropriate for this language. */
- void (*la_print_type) PARAMS ((struct type *, char *, FILE *, int, int));
+ void (*la_print_type) PARAMS ((struct type *, char *, GDB_FILE *, int, int));
/* Print a value using syntax appropriate for this language. */
- int (*la_val_print) PARAMS ((struct type *, char *, CORE_ADDR, FILE *,
+ int (*la_val_print) PARAMS ((struct type *, char *, CORE_ADDR, GDB_FILE *,
int, int, int, enum val_prettyprint));
/* Longest signed integral type */
yyerror(msg)
char *msg; /* unused */
{
- printf("Parsing: %s\n",lexptr);
+ printf_unfiltered("Parsing: %s\n",lexptr);
if (yychar < 256)
error("Invalid syntax in expression near character '%c'.",yychar);
else
static void
emit_char (c, stream, quoter)
register int c;
- FILE *stream;
+ GDB_FILE *stream;
int quoter;
{
static void
m2_printchar (c, stream)
int c;
- FILE *stream;
+ GDB_FILE *stream;
{
fputs_filtered ("'", stream);
emit_char (c, stream, '\'');
static void
m2_printstr (stream, string, length, force_ellipses)
- FILE *stream;
+ GDB_FILE *stream;
char *string;
unsigned int length;
int force_ellipses;
if (length == 0)
{
- fputs_filtered ("\"\"", stdout);
+ fputs_filtered ("\"\"", gdb_stdout);
return;
}
m2_error PARAMS ((char *)); /* Defined in m2-exp.y */
extern void /* Defined in m2-typeprint.c */
-m2_print_type PARAMS ((struct type *, char *, FILE *, int, int));
+m2_print_type PARAMS ((struct type *, char *, GDB_FILE *, int, int));
extern int
-m2_val_print PARAMS ((struct type *, char *, CORE_ADDR, FILE *, int, int,
+m2_val_print PARAMS ((struct type *, char *, CORE_ADDR, GDB_FILE *, int, int,
int, enum val_prettyprint));
m2_print_type (type, varstring, stream, show, level)
struct type *type;
char *varstring;
- FILE *stream;
+ GDB_FILE *stream;
int show;
int level;
{
- extern void c_print_type PARAMS ((struct type *, char *, FILE *, int, int));
+ extern void c_print_type PARAMS ((struct type *, char *, GDB_FILE *, int, int));
c_print_type (type, varstring, stream, show, level); /* FIXME */
}
struct type *type;
char *valaddr;
CORE_ADDR address;
- FILE *stream;
+ GDB_FILE *stream;
int format;
int deref_ref;
int recurse;
enum val_prettyprint pretty;
{
extern int
- c_val_print PARAMS ((struct type *, char *, CORE_ADDR, FILE *, int, int,
+ c_val_print PARAMS ((struct type *, char *, CORE_ADDR, GDB_FILE *, int, int,
int, enum val_prettyprint));
return (c_val_print (type, valaddr, address, stream, format, deref_ref,
recurse, pretty));
void
print_tl_address (stream, pc)
- FILE *stream;
+ GDB_FILE *stream;
CORE_ADDR pc;
{
if (! lookup_minimal_symbol_by_pc (pc))
buf,
translate_cstate (scan->state),
wired);
- print_tl_address (stdout, kthread->pc);
+ print_tl_address (gdb_stdout, kthread->pc);
}
else
{
if (FETCH_CPROC_STATE (&state) == -1)
puts_filtered ("???");
else
- print_tl_address (stdout, state.pc);
+ print_tl_address (gdb_stdout, state.pc);
neworder++;
}
buf,
"", /* No cproc state */
""); /* Can't be wired */
- print_tl_address (stdout, their_threads[index].pc);
+ print_tl_address (gdb_stdout, their_threads[index].pc);
puts_filtered ("\n");
}
}
char *arg;
int from_tty;
{
- printf ("\"thread\" must be followed by the name of a thread command.\n");
- help_list (cmd_thread_list, "thread ", -1, stdout);
+ printf_unfiltered ("\"thread\" must be followed by the name of a thread command.\n");
+ help_list (cmd_thread_list, "thread ", -1, gdb_stdout);
}
/*ARGSUSED*/
char *arg;
int from_tty;
{
- printf ("\"task\" must be followed by the name of a task command.\n");
- help_list (cmd_task_list, "task ", -1, stdout);
+ printf_unfiltered ("\"task\" must be followed by the name of a task command.\n");
+ help_list (cmd_task_list, "task ", -1, gdb_stdout);
}
add_mach_specific_commands ()
exec_file = (char *) get_exec_file (0);
if (exec_file)
- printf ("Attaching to program `%s', %s\n", exec_file, target_pid_to_str (pid));
+ printf_unfiltered ("Attaching to program `%s', %s\n", exec_file, target_pid_to_str (pid));
else
- printf ("Attaching to %s\n", target_pid_to_str (pid));
+ printf_unfiltered ("Attaching to %s\n", target_pid_to_str (pid));
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
m3_do_attach (pid);
char *exec_file = get_exec_file (0);
if (exec_file == 0)
exec_file = "";
- printf ("Detaching from program: %s %s\n",
+ printf_unfiltered ("Detaching from program: %s %s\n",
exec_file, target_pid_to_str (inferior_pid));
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
if (args)
siggnal = atoi (args);
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
ptrace (6, inferior_pid,
(PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register(regno));
else
- printf ("Bad register number for store_inferior routine\n");
+ printf_unfiltered ("Bad register number for store_inferior routine\n");
}
else
{
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
/* (we hope...) */
if (fsr->regs[SP_REGNUM] != 0
&& fsr->regs[SP_REGNUM] != frame_sp - sp_offset)
- fprintf(stderr, "Bad saved SP value %x != %x, offset %x!\n",
+ fprintf_unfiltered(gdb_stderr, "Bad saved SP value %x != %x, offset %x!\n",
fsr->regs[SP_REGNUM],
frame_sp - sp_offset, sp_offset);
command_loop_marker PARAMS ((int));
static void
-print_gdb_version PARAMS ((FILE *));
+print_gdb_version PARAMS ((GDB_FILE *));
static void
quit_command PARAMS ((char *, int));
ADDITIONAL_OPTION_CASES
#endif
case '?':
- fprintf (stderr,
+ fprintf_unfiltered (gdb_stderr,
"Use `%s --help' for a complete list of options.\n",
argv[0]);
exit (1);
corearg = argv[optind];
break;
case 3:
- fprintf (stderr,
+ fprintf_unfiltered (gdb_stderr,
"Excess command line arguments ignored. (%s%s)\n",
argv[optind], (optind == argc - 1) ? "" : " ...");
break;
after initialize_all_files. */
if (print_version)
{
- print_gdb_version (stdout);
+ print_gdb_version (gdb_stdout);
wrap_here ("");
printf_filtered ("\n");
exit (0);
are printing the version here, and the help is long enough
already. */
- print_gdb_version (stdout);
+ print_gdb_version (gdb_stdout);
/* Make sure the output gets printed. */
wrap_here ("");
printf_filtered ("\n");
/* But don't use *_filtered here. We don't want to prompt for continue
no matter how small the screen or how much we're going to print. */
- fputs ("\
+ fputs_unfiltered ("\
This is the GNU debugger. Usage:\n\
gdb [options] [executable-file [core-file or process-id]]\n\
Options:\n\
-b BAUDRATE Set serial port baud rate used for remote debugging.\n\
--mapped Use mapped symbol files if supported on this system.\n\
--readnow Fully read symbol files on first access.\n\
-", stdout);
+", gdb_stdout);
#ifdef ADDITIONAL_OPTION_HELP
- fputs (ADDITIONAL_OPTION_HELP, stdout);
+ fputs_unfiltered (ADDITIONAL_OPTION_HELP, gdb_stdout);
#endif
- fputs ("\n\
+ fputs_unfiltered ("\n\
For more information, type \"help\" from within GDB, or consult the\n\
-GDB manual (available as on-line info or a printed manual).\n", stdout);
+GDB manual (available as on-line info or a printed manual).\n", gdb_stdout);
exit (0);
}
/* Print all the junk at the top, with trailing "..." if we are about
to read a symbol file (possibly slowly). */
print_gnu_advertisement ();
- print_gdb_version (stdout);
+ print_gdb_version (gdb_stdout);
if (symarg)
printf_filtered ("..");
wrap_here("");
- fflush (stdout); /* Force to screen during slow operations */
+ gdb_flush (gdb_stdout); /* Force to screen during slow operations */
}
error_pre_print = "\n\n";
/* Don't use a _filtered function here. It causes the assumed
character position to be off, since the newline we read from
the user is not accounted for. */
- fputs (prrompt, stdout);
- fflush (stdout);
+ fputs_unfiltered (prrompt, gdb_stdout);
+ gdb_flush (gdb_stdout);
}
result = (char *) xmalloc (result_size);
#else
signal (STOP_SIGNAL, stop_sig);
#endif
- printf ("%s", prompt);
- fflush (stdout);
+ printf_unfiltered ("%s", prompt);
+ gdb_flush (gdb_stdout);
/* Forget about any previous command -- null line now will do nothing. */
dont_repeat ();
while (1)
{
- /* Reports are that some Sys V's don't flush stdout/err on reads
+ /* Reports are that some Sys V's don't flush gdb_stdout/err on reads
from stdin, when stdin/out are sockets rather than ttys. So we
have to do it ourselves, to make emacs-gdb and xxgdb work.
On other machines, doing this once per input should be a cheap nop. */
- fflush (stdout);
- fflush (stderr);
+ gdb_flush (gdb_stdout);
+ gdb_flush (gdb_stderr);
/* Don't use fancy stuff if not talking to stdin. */
if (command_editing_p && instream == stdin
if (expanded)
{
/* Print the changes. */
- printf ("%s\n", history_value);
+ printf_unfiltered ("%s\n", history_value);
/* If there was an error, call this function again. */
if (expanded < 0)
char *arg;
int from_tty;
{
- printf ("\"info\" must be followed by the name of an info command.\n");
- help_list (infolist, "info ", -1, stdout);
+ printf_unfiltered ("\"info\" must be followed by the name of an info command.\n");
+ help_list (infolist, "info ", -1, gdb_stdout);
}
/* The "show" command with no arguments shows all the settings. */
char *command;
int from_tty; /* Ignored */
{
- help_cmd (command, stdout);
+ help_cmd (command, gdb_stdout);
}
\f
static void
if (from_tty)
{
- printf ("Type commands for definition of \"%s\".\n\
+ printf_unfiltered ("Type commands for definition of \"%s\".\n\
End with a line saying just \"end\".\n", comname);
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
cmds = read_command_lines ();
error ("Command \"%s\" is built-in.", comname);
if (from_tty)
- printf ("Type documentation for \"%s\".\n\
+ printf_unfiltered ("Type documentation for \"%s\".\n\
End with a line saying just \"end\".\n", comname);
doclines = read_command_lines ();
static void
print_gnu_advertisement()
{
- printf ("\
+ printf_unfiltered ("\
GDB is free software and you are welcome to distribute copies of it\n\
under certain conditions; type \"show copying\" to see the conditions.\n\
There is absolutely no warranty for GDB; type \"show warranty\" for details.\n\
static void
print_gdb_version (stream)
- FILE *stream;
+ GDB_FILE *stream;
{
fprintf_filtered (stream, "\
GDB %s (%s", version, host_canonical);
{
immediate_quit++;
print_gnu_advertisement ();
- print_gdb_version (stdout);
+ print_gdb_version (gdb_stdout);
printf_filtered ("\n");
immediate_quit--;
}
void
print_prompt ()
{
- printf ("%s", prompt);
- fflush (stdout);
+ printf_unfiltered ("%s", prompt);
+ gdb_flush (gdb_stdout);
}
\f
static void
getcwd (dirbuf, sizeof (dirbuf));
if (!STREQ (dirbuf, current_directory))
- printf ("Working directory %s\n (canonically %s).\n",
+ printf_unfiltered ("Working directory %s\n (canonically %s).\n",
current_directory, dirbuf);
else
- printf ("Working directory %s.\n", current_directory);
+ printf_unfiltered ("Working directory %s.\n", current_directory);
}
static void
/* Force this output to appear now. */
wrap_here ("");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
\f
char *args;
int from_tty;
{
- printf ("\"set history\" must be followed by the name of a history subcommand.\n");
- help_list (sethistlist, "set history ", -1, stdout);
+ printf_unfiltered ("\"set history\" must be followed by the name of a history subcommand.\n");
+ help_list (sethistlist, "set history ", -1, gdb_stdout);
}
/* ARGSUSED */
add_cmd ("version", no_class, show_version,
"Show what version of GDB this is.", &showlist);
+ /* If target is open when baud changes, it doesn't take effect until the
+ next open (I think, not sure). */
+ add_show_from_set (add_set_cmd ("remotebaud", no_class,
+ var_zinteger, (char *)&baud_rate,
+ "Set baud rate for remote serial I/O.\n\
+This value is used to set the speed of the serial port when debugging\n\
+using remote targets.", &setlist),
+ &showlist);
+
add_show_from_set (
add_set_cmd ("remotedebug", no_class, var_boolean, (char *)&remote_debug,
"Set debugging of remote protocol.\n\
char *args;
int from_tty;
{
- printf ("\"maintenance\" must be followed by the name of a maintenance command.\n");
- help_list (maintenancelist, "maintenance ", -1, stdout);
+ printf_unfiltered ("\"maintenance\" must be followed by the name of a maintenance command.\n");
+ help_list (maintenancelist, "maintenance ", -1, gdb_stdout);
}
if (args == NULL || *args == '\0')
{
- printf ("\"maintenance demangle\" takes an argument to demangle.\n");
+ printf_unfiltered ("\"maintenance demangle\" takes an argument to demangle.\n");
}
else
{
demangled = cplus_demangle (args, DMGL_ANSI | DMGL_PARAMS);
if (demangled != NULL)
{
- printf ("%s\n", demangled);
+ printf_unfiltered ("%s\n", demangled);
free (demangled);
}
else
{
- printf ("Can't demangle \"%s\"\n", args);
+ printf_unfiltered ("Can't demangle \"%s\"\n", args);
}
}
}
char *arg;
int from_tty;
{
- printf ("\"maintenance info\" must be followed by the name of an info command.\n");
- help_list (maintenanceinfolist, "maintenance info ", -1, stdout);
+ printf_unfiltered ("\"maintenance info\" must be followed by the name of an info command.\n");
+ help_list (maintenanceinfolist, "maintenance info ", -1, gdb_stdout);
}
static void
char *arg;
int from_tty;
{
- printf ("\"maintenance print\" must be followed by the name of a print command.\n");
- help_list (maintenanceprintlist, "maintenance print ", -1, stdout);
+ printf_unfiltered ("\"maintenance print\" must be followed by the name of a print command.\n");
+ help_list (maintenanceprintlist, "maintenance print ", -1, gdb_stdout);
}
#endif /* MAINTENANCE_CMDS */
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
we loop forever if we see a zero size frame. */
if (PROC_FRAME_REG (proc_desc) == SP_REGNUM
&& PROC_FRAME_OFFSET (proc_desc) == 0
- /* Frameless functions, which can happen on the innermost frame
- or a frame which was innermost when a signal happened, can
- have frame size zero. No need to check for non-frameless
- functions in these situations, though (I don't think). */
- && frame->next != NULL
- && !frame->next->signal_handler_caller)
+ /* The previous frame from a sigtramp frame might be frameless
+ and have frame size zero. */
+ && !frame->signal_handler_caller)
return 0;
else
return read_next_frame_reg(frame, PROC_FRAME_REG(proc_desc))
/* We let mips_init_extra_frame_info figure out the frame pointer */
set_current_frame (create_new_frame (0, read_pc ()));
- if (PROC_DESC_IS_DUMMY(proc_desc))
+ if (proc_desc && PROC_DESC_IS_DUMMY(proc_desc))
{
struct linked_proc_info *pi_ptr, *prev_ptr;
#endif
printf_filtered ("(d%d: ", regnum-FP0_REGNUM);
val_print (builtin_type_double, dbuffer, 0,
- stdout, 0, 1, 0, Val_pretty_default);
+ gdb_stdout, 0, 1, 0, Val_pretty_default);
printf_filtered ("); ");
}
- fputs_filtered (reg_names[regnum], stdout);
+ fputs_filtered (reg_names[regnum], gdb_stdout);
/* The problem with printing numeric register names (r26, etc.) is that
the user can't use them on input. Probably the best solution is to
if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT
&& ! INVALID_FLOAT (raw_buffer, REGISTER_VIRTUAL_SIZE(regnum))) {
val_print (REGISTER_VIRTUAL_TYPE (regnum), raw_buffer, 0,
- stdout, 0, 1, 0, Val_pretty_default);
+ gdb_stdout, 0, 1, 0, Val_pretty_default);
}
/* Else print as integer in hex. */
else
registers line up. */
printf_filtered (local_hex_format(), val);
else
- printf_filtered ("%s=%d", local_hex_string(val), val);
+ printf_filtered ("%s=%ld", local_hex_string(val), val);
}
}
{
if (error_pre_print)
{
- printf (error_pre_print);
+ printf_unfiltered (error_pre_print);
}
print_sys_errmsg (symsfilename, errno);
}
{
if (error_pre_print)
{
- printf (error_pre_print);
+ printf_unfiltered (error_pre_print);
}
print_sys_errmsg (symsfilename, errno);
}
{
if (from_tty)
{
- printf ("Symbols already loaded for %s\n", so -> so_name);
+ printf_unfiltered ("Symbols already loaded for %s\n", so -> so_name);
}
}
else if (catch_errors
if (exec_bfd == NULL)
{
- printf ("No exec file.\n");
+ printf_unfiltered ("No exec file.\n");
return;
}
while ((so = find_solib (so)) != NULL)
if (!header_done)
{
- printf("%-20s%-20s%-12s%s\n", "From", "To", "Syms Read",
+ printf_unfiltered("%-20s%-20s%-12s%s\n", "From", "To", "Syms Read",
"Shared Object Library");
header_done++;
}
txt_start = (unsigned long) so -> textsection -> addr;
txt_end = (unsigned long) so -> textsection -> endaddr;
}
- printf ("%-20s", local_hex_string_custom (txt_start, "08l"));
- printf ("%-20s", local_hex_string_custom (txt_end, "08l"));
- printf ("%-12s", so -> symbols_loaded ? "Yes" : "No");
- printf ("%s\n", so -> so_name);
+ printf_unfiltered ("%-20s", local_hex_string_custom (txt_start, "08l"));
+ printf_unfiltered ("%-20s", local_hex_string_custom (txt_end, "08l"));
+ printf_unfiltered ("%-12s", so -> symbols_loaded ? "Yes" : "No");
+ printf_unfiltered ("%s\n", so -> so_name);
}
}
if (so_list_head == NULL)
{
- printf ("No shared libraries loaded at this time.\n");
+ printf_unfiltered ("No shared libraries loaded at this time.\n");
}
}
/* Convert expression from postfix form as generated by yacc
parser, to a prefix form. */
- DUMP_EXPRESSION (expout, stdout, "before conversion to prefix form");
+ DUMP_EXPRESSION (expout, gdb_stdout, "before conversion to prefix form");
prefixify_expression (expout);
- DUMP_EXPRESSION (expout, stdout, "after conversion to prefix form");
+ DUMP_EXPRESSION (expout, gdb_stdout, "after conversion to prefix form");
*stringptr = lexptr;
return expout;
(dependencies_used
* sizeof (struct partial_symtab *)));
#ifdef DEBUG_INFO
- fprintf (stderr, "Had to reallocate dependency list.\n");
- fprintf (stderr, "New dependencies allocated: %d\n",
+ fprintf_unfiltered (gdb_stderr, "Had to reallocate dependency list.\n");
+ fprintf_unfiltered (gdb_stderr, "New dependencies allocated: %d\n",
dependencies_allocated);
#endif
}
#include "target.h"
#include "breakpoint.h"
#include "demangle.h"
+#include "valprint.h"
extern int asm_demangle; /* Whether to demangle syms in asm printouts */
extern int addressprint; /* Whether to print hex addresses in HLL " */
static void
print_frame_nameless_args PARAMS ((struct frame_info *, long, int, int,
- FILE *));
+ GDB_FILE *));
static void
display_info PARAMS ((char *, int));
return val;
}
\f
-/* Print value VAL on stdout according to FORMAT, a letter or 0.
+/* Print value VAL on gdb_stdout according to FORMAT, a letter or 0.
Do not end with a newline.
0 means print VAL according to its own type.
SIZE is the letter for the size of datum being printed.
{
case 's':
next_address = VALUE_ADDRESS (val)
- + value_print (value_addr (val), stdout, format, Val_pretty_default);
+ + value_print (value_addr (val), gdb_stdout, format, Val_pretty_default);
break;
case 'i':
/* We often wrap here if there are long symbolic names. */
wrap_here (" ");
next_address = VALUE_ADDRESS (val)
- + print_insn (VALUE_ADDRESS (val), stdout);
+ + print_insn (VALUE_ADDRESS (val), gdb_stdout);
break;
default:
|| TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_STRUCT
|| TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_UNION
|| VALUE_REPEATED (val))
- value_print (val, stdout, format, Val_pretty_default);
+ value_print (val, gdb_stdout, format, Val_pretty_default);
else
print_scalar_formatted (VALUE_CONTENTS (val), VALUE_TYPE (val),
- format, size, stdout);
+ format, size, gdb_stdout);
}
}
struct type *type;
int format;
int size;
- FILE *stream;
+ GDB_FILE *stream;
{
LONGEST val_long;
int len = TYPE_LENGTH (type);
void
print_address_symbolic (addr, stream, do_demangle, leadin)
CORE_ADDR addr;
- FILE *stream;
+ GDB_FILE *stream;
int do_demangle;
char *leadin;
{
void
print_address (addr, stream)
CORE_ADDR addr;
- FILE *stream;
+ GDB_FILE *stream;
{
#if 0 && defined (ADDR_BITS_REMOVE)
/* This is wrong for pointer to char, in which we do want to print
void
print_address_demangle (addr, stream, do_demangle)
CORE_ADDR addr;
- FILE *stream;
+ GDB_FILE *stream;
int do_demangle;
{
if (addr == 0) {
}
\f
+/* These are the types that $__ will get after an examine command of one
+ of these sizes. */
+
+static struct type *examine_b_type;
+static struct type *examine_h_type;
+static struct type *examine_w_type;
+static struct type *examine_g_type;
+
/* Examine data at address ADDR in format FMT.
- Fetch it from memory and print on stdout. */
+ Fetch it from memory and print on gdb_stdout. */
static void
do_examine (fmt, addr)
if (format == 's' || format == 'i')
size = 'b';
- /* I don't think the TYPE_CODE, TYPE_NAME, or TYPE_FLAGS matter.
- This is just a (fairly twisted) way of telling print_formatted
- the right length. */
if (size == 'b')
- val_type = init_type (TYPE_CODE_INT, 1, 0, NULL, NULL);
+ val_type = examine_b_type;
else if (size == 'h')
- val_type = init_type (TYPE_CODE_INT, 2, 0, NULL, NULL);
+ val_type = examine_h_type;
else if (size == 'w')
- val_type = init_type (TYPE_CODE_INT, 4, 0, NULL, NULL);
+ val_type = examine_w_type;
else if (size == 'g')
- val_type = init_type (TYPE_CODE_INT, 8, 0, NULL, NULL);
+ val_type = examine_g_type;
maxelts = 8;
if (size == 'w')
while (count > 0)
{
- print_address (next_address, stdout);
+ print_address (next_address, gdb_stdout);
printf_filtered (":");
for (i = maxelts;
i > 0 && count > 0;
print_formatted (last_examine_value, format, size);
}
printf_filtered ("\n");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
- free (val_type);
}
\f
static void
int histindex = record_latest_value (val);
if (inspect)
- printf ("\031(gdb-makebuffer \"%s\" %d '(\"", exp, histindex);
+ printf_unfiltered ("\031(gdb-makebuffer \"%s\" %d '(\"", exp, histindex);
else
if (histindex >= 0) printf_filtered ("$%d = ", histindex);
print_formatted (val, format, fmt.size);
printf_filtered ("\n");
if (inspect)
- printf("\") )\030");
+ printf_unfiltered("\") )\030");
}
if (cleanup)
{
if (is_a_field_of_this)
{
- printf ("Symbol \"%s\" is a field of the local class variable `this'\n", exp);
+ printf_unfiltered ("Symbol \"%s\" is a field of the local class variable `this'\n", exp);
return;
}
msymbol = lookup_minimal_symbol (exp, (struct objfile *) NULL);
if (msymbol != NULL)
- printf ("Symbol \"%s\" is at %s in a file compiled without debugging.\n",
+ printf_unfiltered ("Symbol \"%s\" is at %s in a file compiled without debugging.\n",
exp,
local_hex_string((unsigned long) SYMBOL_VALUE_ADDRESS (msymbol)));
else
return;
}
- printf ("Symbol \"%s\" is ", SYMBOL_NAME (sym));
+ printf_unfiltered ("Symbol \"%s\" is ", SYMBOL_NAME (sym));
val = SYMBOL_VALUE (sym);
basereg = SYMBOL_BASEREG (sym);
{
case LOC_CONST:
case LOC_CONST_BYTES:
- printf ("constant");
+ printf_unfiltered ("constant");
break;
case LOC_LABEL:
- printf ("a label at address %s",
+ printf_unfiltered ("a label at address %s",
local_hex_string((unsigned long) SYMBOL_VALUE_ADDRESS (sym)));
break;
case LOC_REGISTER:
- printf ("a variable in register %s", reg_names[val]);
+ printf_unfiltered ("a variable in register %s", reg_names[val]);
break;
case LOC_STATIC:
- printf ("static storage at address %s",
+ printf_unfiltered ("static storage at address %s",
local_hex_string((unsigned long) SYMBOL_VALUE_ADDRESS (sym)));
break;
case LOC_REGPARM:
- printf ("an argument in register %s", reg_names[val]);
+ printf_unfiltered ("an argument in register %s", reg_names[val]);
break;
case LOC_REGPARM_ADDR:
- printf ("address of an argument in register %s", reg_names[val]);
+ printf_unfiltered ("address of an argument in register %s", reg_names[val]);
break;
case LOC_ARG:
- printf ("an argument at offset %ld", val);
+ printf_unfiltered ("an argument at offset %ld", val);
break;
case LOC_LOCAL_ARG:
- printf ("an argument at frame offset %ld", val);
+ printf_unfiltered ("an argument at frame offset %ld", val);
break;
case LOC_LOCAL:
- printf ("a local variable at frame offset %ld", val);
+ printf_unfiltered ("a local variable at frame offset %ld", val);
break;
case LOC_REF_ARG:
- printf ("a reference argument at offset %ld", val);
+ printf_unfiltered ("a reference argument at offset %ld", val);
break;
case LOC_BASEREG:
- printf ("a variable at offset %ld from register %s",
+ printf_unfiltered ("a variable at offset %ld from register %s",
val, reg_names[basereg]);
break;
case LOC_BASEREG_ARG:
- printf ("an argument at offset %ld from register %s",
+ printf_unfiltered ("an argument at offset %ld from register %s",
val, reg_names[basereg]);
break;
case LOC_TYPEDEF:
- printf ("a typedef");
+ printf_unfiltered ("a typedef");
break;
case LOC_BLOCK:
- printf ("a function at address %s",
+ printf_unfiltered ("a function at address %s",
local_hex_string((unsigned long) BLOCK_START (SYMBOL_BLOCK_VALUE (sym))));
break;
break;
default:
- printf ("of unknown (botched) type");
+ printf_unfiltered ("of unknown (botched) type");
break;
}
- printf (".\n");
+ printf_unfiltered (".\n");
}
\f
static void
if (d->format.format != 'i' && d->format.format != 's')
printf_filtered ("%c", d->format.size);
printf_filtered (" ");
- print_expression (d->exp, stdout);
+ print_expression (d->exp, gdb_stdout);
if (d->format.count != 1)
printf_filtered ("\n");
else
{
if (d->format.format)
printf_filtered ("/%c ", d->format.format);
- print_expression (d->exp, stdout);
+ print_expression (d->exp, gdb_stdout);
printf_filtered (" = ");
print_formatted (evaluate_expression (d->exp),
d->format.format, d->format.size);
printf_filtered ("\n");
}
- fflush (stdout);
+ gdb_flush (gdb_stdout);
current_display_number = -1;
}
d->status = disabled;
return;
}
- printf ("No display number %d.\n", num);
+ printf_unfiltered ("No display number %d.\n", num);
}
void
if (current_display_number >= 0)
{
disable_display (current_display_number);
- fprintf (stderr, "Disabling display %d to avoid infinite recursion.\n",
+ fprintf_unfiltered (gdb_stderr, "Disabling display %d to avoid infinite recursion.\n",
current_display_number);
}
current_display_number = -1;
register struct display *d;
if (!display_chain)
- printf ("There are no auto-display expressions now.\n");
+ printf_unfiltered ("There are no auto-display expressions now.\n");
else
printf_filtered ("Auto-display expressions now in effect:\n\
Num Enb Expression\n");
d->format.format);
else if (d->format.format)
printf_filtered ("/%c ", d->format.format);
- print_expression (d->exp, stdout);
+ print_expression (d->exp, gdb_stdout);
if (d->block && !contained_in (get_selected_block (), d->block))
printf_filtered (" (cannot be evaluated in the current context)");
printf_filtered ("\n");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
}
d->status = enabled;
goto win;
}
- printf ("No display number %d.\n", num);
+ printf_unfiltered ("No display number %d.\n", num);
win:
p = p1;
while (*p == ' ' || *p == '\t')
print_variable_value (var, frame, stream)
struct symbol *var;
FRAME frame;
- FILE *stream;
+ GDB_FILE *stream;
{
value val = read_var_value (var, frame);
value_print (val, stream, 0, Val_pretty_default);
struct symbol *func;
struct frame_info *fi;
int num;
- FILE *stream;
+ GDB_FILE *stream;
{
struct block *b = NULL;
int nsyms = 0;
long start;
int num;
int first;
- FILE *stream;
+ GDB_FILE *stream;
{
int i;
CORE_ADDR argsaddr;
}
}
\f
-/* This is an interface which allows to us make a va_list. */
-typedef struct {
- unsigned int nargs;
- unsigned int max_arg_size;
-
- /* Current position in bytes. */
- unsigned int argindex;
-
-#ifdef MAKEVA_EXTRA_INFO
- /* For host dependent information. */
- MAKEVA_EXTRA_INFO
-#endif
-
- /* Some systems (mips, pa) would like this to be aligned, and it never
- will hurt. */
- union
- {
- char arg_bytes[1];
- double force_double_align;
- LONGEST force_long_align;
- } aligner;
-} makeva_list;
-
-/* Tell the caller how many bytes to allocate for a makeva_list with NARGS
- arguments and whose largest argument is MAX_ARG_SIZE bytes. This
- way the caller can use alloca, malloc, or some other allocator. */
-unsigned int
-makeva_size (nargs, max_arg_size)
- unsigned int nargs;
- unsigned int max_arg_size;
-{
-#if defined (MAKEVA_SIZE)
- MAKEVA_SIZE (nargs, max_arg_size);
-#else
- return sizeof (makeva_list) + nargs * max_arg_size;
-#endif
-}
-
-/* Start working on LIST with NARGS arguments and whose largest
- argument is MAX_ARG_SIZE bytes. */
-void
-makeva_start (list, nargs, max_arg_size)
- makeva_list *list;
- unsigned int nargs;
- unsigned int max_arg_size;
-{
- list->nargs = nargs;
- list->max_arg_size = max_arg_size;
-#if defined (MAKEVA_START)
- MAKEVA_START (list);
-#else
- list->argindex = 0;
-#endif
-}
-
-/* Add ARG to LIST. */
-void
-makeva_arg (list, argaddr, argsize)
- makeva_list *list;
- PTR argaddr;
- unsigned int argsize;
-{
-#if defined (MAKEVA_ARG)
- MAKEVA_ARG (list, argaddr, argsize);
-#else
- memcpy (&list->aligner.arg_bytes[list->argindex], argaddr, argsize);
- list->argindex += argsize;
-#endif
-}
-
-/* From LIST, for which makeva_arg has been called for each arg,
- return a va_list containing the args. */
-va_list
-makeva_end (list)
- makeva_list *list;
-{
-#if defined (MAKEVA_END)
- MAKEVA_END (list);
-#else
- /* This works if a va_list is just a pointer to the arguments. */
- return (va_list) list->aligner.arg_bytes;
-#endif
-}
-\f
/* ARGSUSED */
static void
printf_command (arg, from_tty)
register char *s = arg;
char *string;
value *val_args;
+ char *substrings;
+ char *current_substring;
int nargs = 0;
int allocated_args = 20;
- va_list args_to_vprintf;
+ struct cleanup *old_cleanups;
val_args = (value *) xmalloc (allocated_args * sizeof (value));
+ old_cleanups = make_cleanup (free_current_contents, &val_args);
if (s == 0)
error_no_arg ("format-control string and values to print");
processing some kinds of escape sequence. */
f = string = (char *) alloca (strlen (s) + 1);
+
while (*s != '"')
{
int c = *s++;
{
case '\0':
error ("Bad format string, non-terminated '\"'.");
- /* doesn't return */
case '\\':
switch (c = *s++)
if (*s == ',') s++;
while (*s == ' ' || *s == '\t') s++;
+ /* Need extra space for the '\0's. Doubling the size is sufficient. */
+ substrings = alloca (strlen (string) * 2);
+ current_substring = substrings;
+
{
/* Now scan the string for %-specs and see what kinds of args they want.
- argclass[I] classifies the %-specs so we can give vprintf something
+ argclass[I] classifies the %-specs so we can give vprintf_unfiltered something
of the right size. */
-
- enum argclass {int_arg, string_arg, double_arg, long_long_arg};
+
+ enum argclass {no_arg, int_arg, string_arg, double_arg, long_long_arg};
enum argclass *argclass;
+ enum argclass this_argclass;
+ char *last_arg;
int nargs_wanted;
int lcount;
int i;
- /* We build up a va_list to pass to vprintf. This is unnecessary;
- instead of calling vprintf ("%d%f", <constructed va_list>) we
- could just call printf ("%d", arg1); printf ("%f", arg2);. Funny
- how I thought of that right *after* I got the MAKEVA stuff pretty much
- working... */
- makeva_list *args_makeva;
argclass = (enum argclass *) alloca (strlen (s) * sizeof *argclass);
nargs_wanted = 0;
f = string;
+ last_arg = string;
while (*f)
if (*f++ == '%')
{
lcount++;
f++;
}
- if (*f == 's')
- argclass[nargs_wanted++] = string_arg;
- else if (*f == 'e' || *f == 'f' || *f == 'g')
- argclass[nargs_wanted++] = double_arg;
- else if (lcount > 1)
- argclass[nargs_wanted++] = long_long_arg;
- else if (*f != '%')
- argclass[nargs_wanted++] = int_arg;
+ switch (*f)
+ {
+ case 's':
+ this_argclass = string_arg;
+ break;
+
+ case 'e':
+ case 'f':
+ case 'g':
+ this_argclass = double_arg;
+ break;
+
+ case '*':
+ error ("`*' not supported for precision or width in printf");
+
+ case 'n':
+ error ("Format specifier `n' not supported in printf");
+
+ case '%':
+ this_argclass = no_arg;
+ break;
+
+ default:
+ if (lcount > 1)
+ this_argclass = long_long_arg;
+ else
+ this_argclass = int_arg;
+ break;
+ }
f++;
+ if (this_argclass != no_arg)
+ {
+ strncpy (current_substring, last_arg, f - last_arg);
+ current_substring += f - last_arg;
+ *current_substring++ = '\0';
+ last_arg = f;
+ argclass[nargs_wanted++] = this_argclass;
+ }
}
/* Now, parse all arguments and evaluate them.
if (nargs != nargs_wanted)
error ("Wrong number of arguments for specified format-string");
- /* Now lay out an argument-list containing the arguments
- as doubles, integers and C pointers. */
+ /* FIXME: We should be using vprintf_filtered, but as long as it
+ has an arbitrary limit that is unacceptable. Correct fix is
+ for vprintf_filtered to scan down the format string so it knows
+ how big a buffer it needs (perhaps by putting a vasprintf (see
+ GNU C library) in libiberty).
+
+ But for now, just force out any pending output, so at least the output
+ appears in the correct order. */
+ wrap_here ((char *)NULL);
- args_makeva = (makeva_list *)
- alloca (makeva_size (nargs, sizeof (double)));
- makeva_start (args_makeva, nargs, sizeof (double));
+ /* Now actually print them. */
+ current_substring = substrings;
for (i = 0; i < nargs; i++)
{
- if (argclass[i] == string_arg)
+ switch (argclass[i])
{
- char *str;
- CORE_ADDR tem;
- int j;
- tem = value_as_pointer (val_args[i]);
-
- /* This is a %s argument. Find the length of the string. */
- for (j = 0; ; j++)
- {
- char c;
- QUIT;
- read_memory (tem + j, &c, 1);
- if (c == 0)
- break;
- }
-
- /* Copy the string contents into a string inside GDB. */
- str = (char *) alloca (j + 1);
- read_memory (tem, str, j);
- str[j] = 0;
-
- /* Pass address of internal copy as the arg to vprintf. */
- makeva_arg (args_makeva, &str, sizeof (str));
- }
- else if (VALUE_TYPE (val_args[i])->code == TYPE_CODE_FLT)
- {
- double val = value_as_double (val_args[i]);
- makeva_arg (args_makeva, &val, sizeof (val));
- }
- else
-#ifdef CC_HAS_LONG_LONG
- if (argclass[i] == long_long_arg)
+ case string_arg:
+ {
+ char *str;
+ CORE_ADDR tem;
+ int j;
+ tem = value_as_pointer (val_args[i]);
+
+ /* This is a %s argument. Find the length of the string. */
+ for (j = 0; ; j++)
+ {
+ char c;
+ QUIT;
+ read_memory (tem + j, &c, 1);
+ if (c == 0)
+ break;
+ }
+
+ /* Copy the string contents into a string inside GDB. */
+ str = (char *) alloca (j + 1);
+ read_memory (tem, str, j);
+ str[j] = 0;
+
+ /* Don't use printf_filtered because of arbitrary limit. */
+ printf_unfiltered (current_substring, str);
+ }
+ break;
+ case double_arg:
+ {
+ double val = value_as_double (val_args[i]);
+ /* Don't use printf_filtered because of arbitrary limit. */
+ printf_unfiltered (current_substring, val);
+ break;
+ }
+ case long_long_arg:
+#if defined (CC_HAS_LONG_LONG) && defined (PRINTF_HAS_LONG_LONG)
{
long long val = value_as_long (val_args[i]);
- makeva_arg (args_makeva, &val, sizeof (val));
+ /* Don't use printf_filtered because of arbitrary limit. */
+ printf_unfiltered (current_substring, val);
+ break;
}
- else
+#else
+ error ("long long not supported in printf");
#endif
+ case int_arg:
{
+ /* FIXME: there should be separate int_arg and long_arg. */
long val = value_as_long (val_args[i]);
- makeva_arg (args_makeva, &val, sizeof (val));
+ /* Don't use printf_filtered because of arbitrary limit. */
+ printf_unfiltered (current_substring, val);
+ break;
}
+ default:
+ error ("internal error in printf_command");
+ }
+ /* Skip to the next substring. */
+ current_substring += strlen (current_substring) + 1;
}
- args_to_vprintf = makeva_end (args_makeva);
+ /* Print the portion of the format string after the last argument. */
+ /* It would be OK to use printf_filtered here. */
+ printf (last_arg);
}
-
- /* FIXME: We should be using vprintf_filtered, but as long as it has an
- arbitrary limit that is unacceptable. Correct fix is for vprintf_filtered
- to scan down the format string so it knows how big a buffer it needs.
-
- But for now, just force out any pending output, so at least the output
- appears in the correct order. */
- wrap_here ((char *)NULL);
- vprintf (string, args_to_vprintf);
+ do_cleanups (old_cleanups);
}
\f
/* Dump a specified section of assembly code. With no command line
for (pc = low; pc < high; )
{
QUIT;
- print_address (pc, stdout);
+ print_address (pc, gdb_stdout);
printf_filtered (":\t");
- pc += print_insn (pc, stdout);
+ pc += print_insn (pc, gdb_stdout);
printf_filtered ("\n");
}
printf_filtered ("End of assembler dump.\n");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
\f
"Set printing of source filename and line number with <symbol>.",
&setprintlist),
&showprintlist);
+
+ examine_b_type = init_type (TYPE_CODE_INT, 1, 0, NULL, NULL);
+ examine_h_type = init_type (TYPE_CODE_INT, 2, 0, NULL, NULL);
+ examine_w_type = init_type (TYPE_CODE_INT, 4, 0, NULL, NULL);
+ examine_g_type = init_type (TYPE_CODE_INT, 8, 0, NULL, NULL);
}
if ((fd = open (procname, O_RDWR)) < 0)
{
perror (procname);
- fflush (stderr);
+ gdb_flush (gdb_stderr);
_exit (127);
}
premptyset (&exitset);
if (ioctl (fd, PIOCSEXIT, &exitset) < 0)
{
perror (procname);
- fflush (stderr);
+ gdb_flush (gdb_stderr);
_exit (127);
}
if (ioctl (fd, PIOCSENTRY, &entryset) < 0)
{
perror (procname);
- fflush (stderr);
+ gdb_flush (gdb_stderr);
_exit (126);
}
exec_file = (char *) get_exec_file (0);
if (exec_file)
- printf ("Attaching to program `%s', %s\n", exec_file, target_pid_to_str (pid));
+ printf_unfiltered ("Attaching to program `%s', %s\n", exec_file, target_pid_to_str (pid));
else
- printf ("Attaching to %s\n", target_pid_to_str (pid));
+ printf_unfiltered ("Attaching to %s\n", target_pid_to_str (pid));
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
do_attach (pid);
char *exec_file = get_exec_file (0);
if (exec_file == 0)
exec_file = "";
- printf ("Detaching from program: %s %s\n",
+ printf_unfiltered ("Detaching from program: %s %s\n",
exec_file, target_pid_to_str (inferior_pid));
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
if (args)
siggnal = atoi (args);
procfs_files_info (ignore)
struct target_ops *ignore;
{
- printf ("\tUsing the running image of %s %s via /proc.\n",
+ printf_unfiltered ("\tUsing the running image of %s %s via /proc.\n",
attach_flag? "attached": "child", target_pid_to_str (inferior_pid));
}
}
else
{
- printf ("Ok, gdb will wait for %s to stop.\n", target_pid_to_str (pid));
+ printf_unfiltered ("Ok, gdb will wait for %s to stop.\n", target_pid_to_str (pid));
}
}
if (ioctl (pi->fd, PIOCSEXIT, &pi->saved_exitset) < 0)
{
print_sys_errmsg (pi->pathname, errno);
- printf ("PIOCSEXIT failed.\n");
+ printf_unfiltered ("PIOCSEXIT failed.\n");
}
if (ioctl (pi->fd, PIOCSENTRY, &pi->saved_entryset) < 0)
{
print_sys_errmsg (pi->pathname, errno);
- printf ("PIOCSENTRY failed.\n");
+ printf_unfiltered ("PIOCSENTRY failed.\n");
}
if (ioctl (pi->fd, PIOCSTRACE, &pi->saved_trace) < 0)
{
print_sys_errmsg (pi->pathname, errno);
- printf ("PIOCSTRACE failed.\n");
+ printf_unfiltered ("PIOCSTRACE failed.\n");
}
if (ioctl (pi->fd, PIOCSHOLD, &pi->saved_sighold) < 0)
{
print_sys_errmsg (pi->pathname, errno);
- printf ("PIOSCHOLD failed.\n");
+ printf_unfiltered ("PIOSCHOLD failed.\n");
}
if (ioctl (pi->fd, PIOCSFAULT, &pi->saved_fltset) < 0)
{
print_sys_errmsg (pi->pathname, errno);
- printf ("PIOCSFAULT failed.\n");
+ printf_unfiltered ("PIOCSFAULT failed.\n");
}
if (ioctl (pi->fd, PIOCSTATUS, &pi->prstatus) < 0)
{
print_sys_errmsg (pi->pathname, errno);
- printf ("PIOCSTATUS failed.\n");
+ printf_unfiltered ("PIOCSTATUS failed.\n");
}
else
{
if (ioctl (pi->fd, PIOCCFAULT, 0))
{
print_sys_errmsg (pi->pathname, errno);
- printf ("PIOCCFAULT failed.\n");
+ printf_unfiltered ("PIOCCFAULT failed.\n");
}
/* Make it run again when we close it. */
if (result)
{
print_sys_errmsg (pi->pathname, errno);
- printf ("PIOCSRLC or PIOCSET failed.\n");
+ printf_unfiltered ("PIOCSRLC or PIOCSET failed.\n");
}
}
}
if (rtnval == -1) /* No more children to wait for */
{
- fprintf (stderr, "Child process unexpectedly missing.\n");
+ fprintf_unfiltered (gdb_stderr, "Child process unexpectedly missing.\n");
*statloc = 42; /* Claim it exited with signal 42 */
return rtnval;
}
{
if (ioctl (procinfo->fd, PIOCSTATUS, &procinfo->prstatus) < 0)
{
- fprintf(stderr, "PIOCSTATUS failed, errno=%d\n", errno);
+ fprintf_unfiltered(gdb_stderr, "PIOCSTATUS failed, errno=%d\n", errno);
}
print_sys_errmsg (procinfo->pathname, errno);
error ("PIOCRUN failed");
CORE_ADDR frame;
{
int foo=frame - CONTROL_STACK_FRAME_SIZE;
- /* printf ("...following chain from %x: got %x\n", frame, foo);*/
+ /* printf_unfiltered ("...following chain from %x: got %x\n", frame, foo);*/
return foo;
}
{
int foo=0;
foo = read_memory_integer (((CORE_ADDR)(frame))+60, 4);
- printf ("..reading pc from frame 0x%0x+%d regs: got %0x\n",
+ printf_unfiltered ("..reading pc from frame 0x%0x+%d regs: got %0x\n",
frame, 60/4, foo);
return foo;
}
if (*((int *)buffer) == 0x0) {
/* "halt" looks just like an invalid "jump" to the insn decoder,
so is dealt with as a special case */
- fprintf (stream, "halt");
+ fprintf_unfiltered (stream, "halt");
return (4);
}
if (i == NOPCODES)
/* FIXME: Handle unrecognised instructions better. */
- fprintf (stream, "???\t#%08x\t(op=%x mode =%x)",
+ fprintf_unfiltered (stream, "???\t#%08x\t(op=%x mode =%x)",
insn, insn_decode.operator, insn_decode.mode);
else
{
special case: check the operands of branch insn and print an
appropriate mnemonic. */
- fprintf (stream, "%s\t", pyr_opcodes[i].name);
+ fprintf_unfiltered (stream, "%s\t", pyr_opcodes[i].name);
/* Print the operands of the insn (as specified in
insn.operand_mode).
/* Is bfc and no bits specified an unconditional branch?*/
for (i=0;i<4;i++) {
if ((bit_codes) & 0x1)
- fputc (cc_bit_names[i], stream);
+ fputc_unfiltered (cc_bit_names[i], stream);
bit_codes >>= 1;
}
- fprintf (stream, ",%0x",
+ fprintf_unfiltered (stream, ",%0x",
displacement + memaddr);
return (insn_size);
}
switch (operand_mode) {
case 0:
- fprintf (stream, "%s,%s",
+ fprintf_unfiltered (stream, "%s,%s",
reg_names [op_1_regno],
reg_names [op_2_regno]);
break;
case 1:
- fprintf (stream, " 0x%0x,%s",
+ fprintf_unfiltered (stream, " 0x%0x,%s",
op_1_regno,
reg_names [op_2_regno]);
break;
read_memory (memaddr+4, buffer, MAXLEN);
insn_size += 4;
extra_1 = * ((int *) buffer);
- fprintf (stream, " $0x%0x,%s",
+ fprintf_unfiltered (stream, " $0x%0x,%s",
extra_1,
reg_names [op_2_regno]);
break;
case 3:
- fprintf (stream, " (%s),%s",
+ fprintf_unfiltered (stream, " (%s),%s",
reg_names [op_1_regno],
reg_names [op_2_regno]);
break;
read_memory (memaddr+4, buffer, MAXLEN);
insn_size += 4;
extra_1 = * ((int *) buffer);
- fprintf (stream, " 0x%0x(%s),%s",
+ fprintf_unfiltered (stream, " 0x%0x(%s),%s",
extra_1,
reg_names [op_1_regno],
reg_names [op_2_regno]);
/* S1 destination mode */
case 5:
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ? "%s,(%s)[%s*%1d]" : "%s,(%s)"),
reg_names [op_1_regno],
reg_names [op_2_regno],
break;
case 6:
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ? " $%#0x,(%s)[%s*%1d]"
: " $%#0x,(%s)"),
op_1_regno,
read_memory (memaddr+4, buffer, MAXLEN);
insn_size += 4;
extra_1 = * ((int *) buffer);
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ? " $%#0x,(%s)[%s*%1d]"
: " $%#0x,(%s)"),
extra_1,
break;
case 8:
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ? " (%s),(%s)[%s*%1d]" : " (%s),(%s)"),
reg_names [op_1_regno],
reg_names [op_2_regno],
read_memory (memaddr+4, buffer, MAXLEN);
insn_size += 4;
extra_1 = * ((int *) buffer);
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno)
? "%#0x(%s),(%s)[%s*%1d]"
: "%#0x(%s),(%s)"),
read_memory (memaddr+4, buffer, MAXLEN);
insn_size += 4;
extra_1 = * ((int *) buffer);
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ? "%s,%#0x(%s)[%s*%1d]" : "%s,%#0x(%s)"),
reg_names [op_1_regno],
extra_1,
read_memory (memaddr+4, buffer, MAXLEN);
insn_size += 4;
extra_1 = * ((int *) buffer);
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ?
" $%#0x,%#0x(%s)[%s*%1d]" : " $%#0x,%#0x(%s)"),
op_1_regno,
read_memory (memaddr+8, buffer, MAXLEN);
insn_size += 4;
extra_2 = * ((int *) buffer);
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ?
" $%#0x,%#0x(%s)[%s*%1d]" : " $%#0x,%#0x(%s)"),
extra_1,
read_memory (memaddr+4, buffer, MAXLEN);
insn_size += 4;
extra_1 = * ((int *) buffer);
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno)
? " (%s),%#0x(%s)[%s*%1d]"
: " (%s),%#0x(%s)"),
read_memory (memaddr+8, buffer, MAXLEN);
insn_size += 4;
extra_2 = * ((int *) buffer);
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ? "%#0x(%s),%#0x(%s)[%s*%1d]"
: "%#0x(%s),%#0x(%s) "),
extra_1,
break;
default:
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ? "%s,%s [%s*%1d]" : "%s,%s"),
reg_names [op_1_regno],
reg_names [op_2_regno],
reg_names [index_reg_regno],
index_multiplier);
- fprintf (stream,
+ fprintf_unfiltered (stream,
"\t\t# unknown mode in %08x",
insn);
break;
struct user u;
for (regno = 0; regno < 16; regno++) {
- printf/*_filtered*/ ("%6.6s: %8x %6.6s: %8x %6s: %8x %6s: %8x\n",
+ printf_unfiltered/*_filtered*/ ("%6.6s: %8x %6.6s: %8x %6s: %8x %6s: %8x\n",
reg_names[regno], reg_buf[regno],
reg_names[regno+16], reg_buf[regno+16],
reg_names[regno+32], reg_buf[regno+32],
ksp = ptrace (3, inferior_pid,
(PTRACE_ARG3_TYPE) ((char *)&u.u_pcb.pcb_ksp) -
((char *)&u), 0);
- printf/*_filtered*/ ("\n%6.6s: %8x %6.6s: %8x (%08x) %6.6s %8x\n",
+ printf_unfiltered/*_filtered*/ ("\n%6.6s: %8x %6.6s: %8x (%08x) %6.6s %8x\n",
reg_names[CSP_REGNUM],reg_buf[CSP_REGNUM],
reg_names[KSP_REGNUM], reg_buf[KSP_REGNUM], ksp,
"usp", usp);
register int addr = find_saved_register (frame,CFP_REGNUM);
register int result = read_memory_integer (addr, 4);
#ifdef PYRAMID_CONTROL_FRAME_DEBUGGING
- fprintf (stderr,
+ fprintf_unfiltered (stderr,
"\t[[..frame_locals:%8x, %s= %x @%x fcfp= %x foo= %x\n\t gr13=%x pr13=%x tr13=%x @%x]]\n",
frame->frame,
reg_names[CFP_REGNUM],
register int result = read_memory_integer (addr, 4);
#ifdef PYRAMID_CONTROL_FRAME_DEBUGGING
- fprintf (stderr,
+ fprintf_unfiltered (stderr,
"\t[[..frame_args:%8x, %s= %x @%x fcfp= %x r_r= %x\n\t gr13=%x pr13=%x tr13=%x @%x]]\n",
frame->frame,
reg_names[CFP_REGNUM],
reg_buf[regno] = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) regno, 0);
#if defined(PYRAMID_CONTROL_FRAME_DEBUGGING)
- printf ("Fetching register %s, got %0x\n",
+ printf_unfiltered ("Fetching register %s, got %0x\n",
reg_names[regno],
reg_buf[regno]);
#endif /* PYRAMID_CONTROL_FRAME_DEBUGGING */
if (reg_buf[regno] == -1 && errno == EIO) {
- printf("fetch_interior_registers: fetching register %s\n",
+ printf_unfiltered("fetch_interior_registers: fetching register %s\n",
reg_names[regno]);
errno = 0;
}
(PTRACE_ARG3_TYPE) (datum+((32+15)*4)), 0);
if (inferior_saved_pc > 0) break;
#if defined(PYRAMID_CONTROL_FRAME_DEBUGGING)
- printf("skipping kernel frame %08x, pc=%08x\n", datum,
+ printf_unfiltered("skipping kernel frame %08x, pc=%08x\n", datum,
inferior_saved_pc);
#endif /* PYRAMID_CONTROL_FRAME_DEBUGGING */
skipped_frames++;
supply_register(CSP_REGNUM, reg_buf+CSP_REGNUM);
#ifdef PYRAMID_CONTROL_FRAME_DEBUGGING
if (skipped_frames) {
- fprintf (stderr,
+ fprintf_unfiltered (stderr,
"skipped %d frames from %x to %x; cfp was %x, now %x\n",
skipped_frames, reg_buf[CSP_REGNUM]);
}
if (*(int *)buf >= 0)
break;
- printf ("skipping frame %s\n", local_hex_string (last_frame_address));
+ printf_unfiltered ("skipping frame %s\n", local_hex_string (last_frame_address));
last_frame_offset -= CONTROL_STACK_FRAME_SIZE;
last_frame_address -= CONTROL_STACK_FRAME_SIZE;
}
reg_offset = last_frame_offset;
#if 1 || defined(PYRAMID_CONTROL_FRAME_DEBUGGING)
- printf ("Control stack pointer = %s\n",
+ printf_unfiltered ("Control stack pointer = %s\n",
local_hex_string (u.u_pcb.pcb_csp));
- printf ("offset to control stack %d outermost frame %d (%s)\n",
+ printf_unfiltered ("offset to control stack %d outermost frame %d (%s)\n",
reg_stack_offset, reg_offset, local_hex_string (last_frame_address));
#endif /* PYRAMID_CONTROL_FRAME_DEBUGGING */
if (val < 0)
perror_with_name (filename);
#ifdef PYRAMID_CONTROL_FRAME_DEBUGGING
- printf ("[reg %s(%d), offset in file %s=0x%0x, addr =0x%0x, =%0x]\n",
+ printf_unfiltered ("[reg %s(%d), offset in file %s=0x%0x, addr =0x%0x, =%0x]\n",
reg_names[regno], regno, filename,
register_addr(regno, reg_offset),
regno * 4 + last_frame_address,
}
#if 1 || defined(PYRAMID_CONTROL_FRAME_DEBUGGING)
- printf ("Providing CSP (%s) as nominal address of current frame.\n",
+ printf_unfiltered ("Providing CSP (%s) as nominal address of current frame.\n",
local_hex_string(last_frame_address));
#endif PYRAMID_CONTROL_FRAME_DEBUGGING
/* FIXME: Which of the following is correct? */
validate_files ();
}
else if (from_tty)
- printf ("No core file now.\n");
+ printf_unfiltered ("No core file now.\n");
}
for (i = 0; i < buf.used; i++)
printchar (buf.buffer[i]);
- putchar ('\n');
+ putchar_unfiltered ('\n');
- printf ("%d allocated, %d used.\n", buf.allocated, buf.used);
+ printf_unfiltered ("%d allocated, %d used.\n", buf.allocated, buf.used);
re_compile_fastmap (&buf);
- printf ("Allowed by fastmap: ");
+ printf_unfiltered ("Allowed by fastmap: ");
for (i = 0; i < (1 << BYTEWIDTH); i++)
if (fastmap[i]) printchar (i);
- putchar ('\n');
+ putchar_unfiltered ('\n');
}
gets (pat); /* Now read the string to match against */
i = re_match (&buf, pat, strlen (pat), 0, 0);
- printf ("Match value %d.\n", i);
+ printf_unfiltered ("Match value %d.\n", i);
}
}
{
int i;
- printf ("buf is :\n----------------\n");
+ printf_unfiltered ("buf is :\n----------------\n");
for (i = 0; i < bufp->used; i++)
printchar (bufp->buffer[i]);
- printf ("\n%d allocated, %d used.\n", bufp->allocated, bufp->used);
+ printf_unfiltered ("\n%d allocated, %d used.\n", bufp->allocated, bufp->used);
- printf ("Allowed by fastmap: ");
+ printf_unfiltered ("Allowed by fastmap: ");
for (i = 0; i < (1 << BYTEWIDTH); i++)
if (bufp->fastmap[i])
printchar (i);
- printf ("\nAllowed by translate: ");
+ printf_unfiltered ("\nAllowed by translate: ");
if (bufp->translate)
for (i = 0; i < (1 << BYTEWIDTH); i++)
if (bufp->translate[i])
printchar (i);
- printf ("\nfastmap is%s accurate\n", bufp->fastmap_accurate ? "" : "n't");
- printf ("can %s be null\n----------", bufp->can_be_null ? "" : "not");
+ printf_unfiltered ("\nfastmap is%s accurate\n", bufp->fastmap_accurate ? "" : "n't");
+ printf_unfiltered ("can %s be null\n----------", bufp->can_be_null ? "" : "not");
}
#endif
{
if (c < 041 || c >= 0177)
{
- putchar ('\\');
- putchar (((c >> 6) & 3) + '0');
- putchar (((c >> 3) & 7) + '0');
- putchar ((c & 7) + '0');
+ putchar_unfiltered ('\\');
+ putchar_unfiltered (((c >> 6) & 3) + '0');
+ putchar_unfiltered (((c >> 3) & 7) + '0');
+ putchar_unfiltered ((c & 7) + '0');
}
else
- putchar (c);
+ putchar_unfiltered (c);
}
error (string)
char *string;
{
- puts (string);
+ puts_unfiltered (string);
exit (1);
}
error ("Timeout reading from remote system.");
if (!quiet)
- printf ("%c", buf);
+ printf_unfiltered ("%c", buf);
return buf & 0x7f;
}
if (buf == SERIAL_TIMEOUT)
buf = 0;
if (!quiet)
- printf ("%c", buf);
+ printf_unfiltered ("%c", buf);
return buf & 0x7f;
bfd_get_section_contents (abfd, s, buffer, i, delta);
hms_write_inferior_memory (s->vma + i, buffer, delta);
printf_filtered ("*");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
printf_filtered ("\n");
free (buffer);
/* Print out any characters which have been swallowed. */
for (p = swallowed; p < swallowed_p; ++p)
- putc (*p, stdout);
+ putc_unfiltered (*p, gdb_stdout);
swallowed_p = swallowed;
if ((ch != '\r' && ch != '\n') || swallowed_cr > 10)
{
- putc (ch, stdout);
+ putc_unfiltered (ch, gdb_stdout);
swallowed_cr = 10;
}
swallowed_cr++;
if (!quiet)
for (i = 0; i < l; i++)
{
- printf ("%c", a[i]);
+ printf_unfiltered ("%c", a[i]);
}
}
{
char ttyname[100];
char *p, *p2;
- extern FILE *instream;
+ extern GDB_FILE *instream;
push_target (&hms_ops);
}
}
else
{
- fprintf_filtered (stderr,
+ fprintf_filtered (gdb_stderr,
"Too many break points, break point not installed\n");
return (1);
}
should be filtered? */
if (! mips_initializing || sr_get_debug () > 0)
{
- putchar (ch);
- fflush (stdout);
+ putchar_unfiltered (ch);
+ gdb_flush (gdb_stdout);
}
++*pgarbage;
mips_initialize ();
if (from_tty)
- printf ("Remote MIPS debugging using %s\n", name);
+ printf_unfiltered ("Remote MIPS debugging using %s\n", name);
push_target (&mips_ops); /* Switch to using remote target now */
/* FIXME: Should we call start_remote here? */
pop_target ();
if (from_tty)
- printf ("Ending remote MIPS debugging.\n");
+ printf_unfiltered ("Ending remote MIPS debugging.\n");
}
/* Tell the target board to resume. This does not wait for a reply
mips_files_info (ignore)
struct target_ops *ignore;
{
- printf ("Debugging a MIPS board over a serial line.\n");
+ printf_unfiltered ("Debugging a MIPS board over a serial line.\n");
}
/* Kill the process running on the board. This will actually only
i=in_msg_buf->channel1_msg.length;
in_msg_buf->channel1_msg.data[i] = '\0';
printf("%s", in_msg_buf->channel1_msg.data);
- fflush(stdout);
+ gdb_flush(stdout);
/* Send CHANNEL1_ACK message */
out_msg_buf->channel1_ack_msg.code = CHANNEL1_ACK;
out_msg_buf->channel1_ack_msg.length = 0;
extern void generic_mourn_inferior ();
extern struct target_ops nindy_ops;
-extern FILE *instream;
+extern GDB_FILE *instream;
extern struct ext_format ext_format_i960; /* i960-tdep.c */
extern char ninStopWhy ();
static void
nindy_files_info ()
{
- printf("\tAttached to %s at %d bps%s%s.\n", savename,
+ printf_unfiltered("\tAttached to %s at %d bps%s%s.\n", savename,
sr_get_baud_rate(),
nindy_old_protocol? " in old protocol": "",
nindy_initial_brk? " with initial break": "");
}
/* Wait until the remote machine stops. While waiting, operate in passthrough
- * mode; i.e., pass everything NINDY sends to stdout, and everything from
+ * mode; i.e., pass everything NINDY sends to gdb_stdout, and everything from
* stdin to NINDY.
*
* Return to caller, storing status in 'status' just as `wait' would.
while (current_target != &nindy_ops) { /* remote tty not specified yet */
if ( instream == stdin ){
- printf("\nAttach /dev/ttyNN -- specify NN, or \"quit\" to quit: ");
- fflush( stdout );
+ printf_unfiltered("\nAttach /dev/ttyNN -- specify NN, or \"quit\" to quit: ");
+ gdb_flush( gdb_stdout );
}
fgets( ttyname, sizeof(ttyname)-1, stdin );
bfd_get_section_contents (abfd, s, buffer, i, sub_delta);
sim_write (s->vma + i, buffer, sub_delta);
printf_filtered ("*");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
printf_filtered ("\n");
free (buffer);
if (udi_session_id < 0)
{
- printf("UDI connection not open yet.\n");
+ printf_unfiltered("UDI connection not open yet.\n");
return;
}
ChipVersions, &NumberOfChips))
error ("UDIGetTargetConfig() failed");
if (NumberOfChips > 2)
- fprintf(stderr,"Target has more than one processor\n");
+ fprintf_unfiltered(gdb_stderr,"Target has more than one processor\n");
for (cnt=0; cnt < NumberOfRanges; cnt++)
{
switch(KnownMemory[cnt].Space)
{
default:
- fprintf(stderr, "UDIGetTargetConfig() unknown memory space\n");
+ fprintf_unfiltered(gdb_stderr, "UDIGetTargetConfig() unknown memory space\n");
break;
case UDI29KCP_S:
break;
a29k_get_processor_type ();
if (UDICreateProcess (&PId))
- fprintf(stderr, "UDICreateProcess() failed\n");
+ fprintf_unfiltered(gdb_stderr, "UDICreateProcess() failed\n");
/* Print out some stuff, letting the user now what's going on */
if (UDICapabilities (&TIPId, &TargetId, DFEId, DFE, &TIP, &DFEIPCId,
error ("UDI connection not opened yet, use the 'target udi' command.\n");
if (from_tty)
- printf ("Attaching to remote program %s...\n", prog_name);
+ printf_unfiltered ("Attaching to remote program %s...\n", prog_name);
UDIStop();
From.Space = UDI29KSpecialRegs;
From.Offset = 11;
if (err = UDIRead(From, &PC_adds, Count, Size, &CountDone, HostEndian))
error ("UDIRead failed in udi_attach");
- printf ("Remote process is now halted, pc1 = 0x%x.\n", PC_adds);
+ printf_unfiltered ("Remote process is now halted, pc1 = 0x%x.\n", PC_adds);
}
/************************************************************* UDI_DETACH */
/* Terminate the open connection to the TIP process.
pop_target(); /* calls udi_close to do the real work */
if (from_tty)
- printf ("Ending remote debugging\n");
+ printf_unfiltered ("Ending remote debugging\n");
}
if (!tip_error)
return;
- fprintf (stderr, "UDIStep() error = %d\n", tip_error);
+ fprintf_unfiltered (gdb_stderr, "UDIStep() error = %d\n", tip_error);
error ("failed in udi_resume");
}
switch (StopReason & UDIGrossState)
{
- case UDIStdoutReady:
- if (UDIGetStdout (sbuf, (UDISizeT)SBUF_MAX, &CountDone))
+ case UDIGdb_StdoutReady:
+ if (UDIGetGdb_Stdout (sbuf, (UDISizeT)SBUF_MAX, &CountDone))
/* This is said to happen if the program tries to output
a whole bunch of output (more than SBUF_MAX, I would
guess). It doesn't seem to happen with the simulator. */
- warning ("UDIGetStdout() failed in udi_wait");
- fwrite (sbuf, 1, CountDone, stdout);
- fflush(stdout);
+ warning ("UDIGetGdb_Stdout() failed in udi_wait");
+ fwrite (sbuf, 1, CountDone, gdb_stdout);
+ gdb_flush(gdb_stdout);
continue;
- case UDIStderrReady:
- UDIGetStderr (sbuf, (UDISizeT)SBUF_MAX, &CountDone);
- fwrite (sbuf, 1, CountDone, stderr);
- fflush(stderr);
+ case UDIGdb_StderrReady:
+ UDIGetGdb_Stderr (sbuf, (UDISizeT)SBUF_MAX, &CountDone);
+ fwrite (sbuf, 1, CountDone, gdb_stderr);
+ gdb_flush(gdb_stderr);
continue;
case UDIStdinNeeded:
switch (StopReason & UDIGrossState)
{
case UDITrapped:
- printf("Am290*0 received vector number %d\n", StopReason >> 24);
+ printf_unfiltered("Am290*0 received vector number %d\n", StopReason >> 24);
switch (StopReason >> 8)
{
case 0: /* Illegal opcode */
- printf(" (break point)\n");
+ printf_unfiltered(" (break point)\n");
WSETSTOP ((*status), SIGTRAP);
break;
case 1: /* Unaligned Access */
err = UDIRead(From, To, Count, Size, &CountDone, HostEndian);
- printf ("err = %d, CountDone = %d, pc[0] = 0x%x, pc[1] = 0x%x\n",
+ printf_unfiltered ("err = %d, CountDone = %d, pc[0] = 0x%x, pc[1] = 0x%x\n",
err, CountDone, pc[0], pc[1]);
udi_fetch_registers(-1);
- printf("other pc1 = 0x%x, pc0 = 0x%x\n", *(int *)®isters[4 * PC_REGNUM],
+ printf_unfiltered("other pc1 = 0x%x, pc0 = 0x%x\n", *(int *)®isters[4 * PC_REGNUM],
*(int *)®isters[4 * NPC_REGNUM]);
/* Now, read all the registers globally */
if (remote_debug)
{
- printf("Fetching all registers\n");
- printf("Fetching PC0 = 0x%x, PC1 = 0x%x, PC2 = 0x%x\n",
+ printf_unfiltered("Fetching all registers\n");
+ printf_unfiltered("Fetching PC0 = 0x%x, PC1 = 0x%x, PC2 = 0x%x\n",
read_register(NPC_REGNUM), read_register(PC_REGNUM),
read_register(PC2_REGNUM));
}
if (remote_debug)
{
- printf("Storing all registers\n");
- printf("PC0 = 0x%x, PC1 = 0x%x, PC2 = 0x%x\n", read_register(NPC_REGNUM),
+ printf_unfiltered("Storing all registers\n");
+ printf_unfiltered("PC0 = 0x%x, PC1 = 0x%x, PC2 = 0x%x\n", read_register(NPC_REGNUM),
read_register(PC_REGNUM), read_register(PC2_REGNUM));
}
static void
udi_files_info ()
{
- printf ("\tAttached to UDI socket to %s and running program %s.\n",
+ printf_unfiltered ("\tAttached to UDI socket to %s and running program %s.\n",
udi_config_id, prog_name);
}
inferior_pid = 0;
if (from_tty)
- printf("Target has been stopped.");
+ printf_unfiltered("Target has been stopped.");
#else
udi_close(0);
#endif
below starts writing before it even checks the size. */
continue;
- printf("[Loading section %s at %x (%d bytes)]\n",
+ printf_unfiltered("[Loading section %s at %x (%d bytes)]\n",
section_name,
To.Offset,
section_size);
xerr = UDIGetErrorMsg(err, 100, message, &Count);
if (!xerr)
- fprintf (stderr, "Error is %s\n", message);
+ fprintf_unfiltered (gdb_stderr, "Error is %s\n", message);
else
- fprintf (stderr, "xerr is %d\n", xerr);
+ fprintf_unfiltered (gdb_stderr, "xerr is %d\n", xerr);
error ("UDICopy failed, error = %d", err);
}
}
supply_register(regno, (char *) &To);
if (remote_debug)
- printf("Fetching register %s = 0x%x\n", reg_names[regno], To);
+ printf_unfiltered("Fetching register %s = 0x%x\n", reg_names[regno], To);
}
/*****************************************************************************/
/* Store a single register indicated by 'regno'.
From = read_register (regno); /* get data value */
if (remote_debug)
- printf("Storing register %s = 0x%x\n", reg_names[regno], From);
+ printf_unfiltered("Storing register %s = 0x%x\n", reg_names[regno], From);
if (regno == GR1_REGNUM)
{
void convert16() {;}
void convert32() {;}
-FILE* EchoFile = 0; /* used for debugging */
+GDB_FILE * EchoFile = 0; /* used for debugging */
int QuietMode = 0; /* used for debugging */
\f
#ifdef NO_HIF_SUPPORT
char *junk;
{
if (junk != NULL)
- fprintf(stderr, "Unrecognized arguments: `%s'.\n", junk);
+ fprintf_unfiltered(gdb_stderr, "Unrecognized arguments: `%s'.\n", junk);
/* FIXME-now: service@host? */
error ("Timeout reading from remote system.");
if (sr_get_debug() > 0)
- printf ("%c", buf);
+ printf_unfiltered ("%c", buf);
return buf & 0x7f;
}
buf = 0;
if (sr_get_debug() > 0)
if (buf)
- printf ("%c", buf);
+ printf_unfiltered ("%c", buf);
else
- printf ("<empty character poll>");
+ printf_unfiltered ("<empty character poll>");
return buf & 0x7f;
}
if (sr_get_debug() > 0)
for (i = 0; i < l; i++)
- printf ("%c", a[i]);
+ printf_unfiltered ("%c", a[i]);
return;
}
if (passthrough)
{
for (p = swallowed; p < swallowed_p; ++p)
- putc (*p, stdout);
+ putc_unfiltered (*p, gdb_stdout);
- putc (ch, stdout);
+ putc_unfiltered (ch, gdb_stdout);
}
swallowed_p = swallowed;
static void
vx_files_info ()
{
- printf ("\tAttached to host `%s'", vx_host);
- printf (", which has %sfloating point", target_has_fp? "": "no ");
- printf (".\n");
+ printf_unfiltered ("\tAttached to host `%s'", vx_host);
+ printf_unfiltered (", which has %sfloating point", target_has_fp? "": "no ");
+ printf_unfiltered (".\n");
}
static void
vx_run_files_info ()
{
- printf ("\tRunning %s VxWorks process %s",
+ printf_unfiltered ("\tRunning %s VxWorks process %s",
vx_running? "child": "attached",
local_hex_string((unsigned long) inferior_pid));
if (vx_running)
- printf (", function `%s'", vx_running);
- printf(".\n");
+ printf_unfiltered (", function `%s'", vx_running);
+ printf_unfiltered(".\n");
}
static void
{
struct ldfile *pLoadFile = (struct ldfile *)arg;
- printf("\t%s: ", pLoadFile->name);
+ printf_unfiltered("\t%s: ", pLoadFile->name);
symbol_file_add (pLoadFile->name, 0, pLoadFile->txt_addr, 0, 0, 0);
- printf ("ok\n");
+ printf_unfiltered ("ok\n");
return 1;
}
/* Target command for VxWorks target systems.
target_preopen (from_tty);
unpush_target (&vx_ops);
- printf ("Attaching remote machine across net...\n");
- fflush (stdout);
+ printf_unfiltered ("Attaching remote machine across net...\n");
+ gdb_flush (gdb_stdout);
/* Allow the user to kill the connect attempt by typing ^C.
Wait until the call to target_has_fp () completes before
"Error while reading symbols from boot file:\n", RETURN_MASK_ALL))
puts_filtered ("ok\n");
} else if (from_tty)
- printf ("VxWorks kernel symbols not loaded.\n");
+ printf_unfiltered ("VxWorks kernel symbols not loaded.\n");
}
else
error ("Can't retrieve boot file name from target machine.");
error ("Invalid process-id -- give a single number in decimal or 0xhex");
if (from_tty)
- printf ("Attaching pid %s.\n",
+ printf_unfiltered ("Attaching pid %s.\n",
local_hex_string((unsigned long) pid));
memset ((char *)&ptrace_in, '\0', sizeof (ptrace_in));
error ("Argument given to VxWorks \"detach\".");
if (from_tty)
- printf ("Detaching pid %s.\n",
+ printf_unfiltered ("Detaching pid %s.\n",
local_hex_string((unsigned long) inferior_pid));
if (args) /* FIXME, should be possible to leave suspended */
Ptrace_return ptrace_out;
int status;
- printf ("Killing pid %s.\n", local_hex_string((unsigned long) inferior_pid));
+ printf_unfiltered ("Killing pid %s.\n", local_hex_string((unsigned long) inferior_pid));
memset ((char *)&ptrace_in, '\0', sizeof (ptrace_in));
memset ((char *)&ptrace_out, '\0', sizeof (ptrace_out));
bfd_get_section_contents (abfd, s, buffer, i, sub_delta);
sim_write_inferior_memory (s->vma + i, buffer, sub_delta);
printf_filtered ("*");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
printf_filtered ("\n");
free (buffer);
signal (signo, remote_interrupt_twice);
if (remote_debug)
- printf ("remote_interrupt called\n");
+ printf_unfiltered ("remote_interrupt called\n");
SERIAL_WRITE (remote_desc, "\003", 1); /* Send a ^C */
}
&& (buf[0] < 'a' || buf[0] > 'f'))
{
if (remote_debug)
- printf ("Bad register packet; fetching a new packet\n");
+ printf_unfiltered ("Bad register packet; fetching a new packet\n");
getpkt (buf, 0);
}
if (remote_debug)
{
*p = '\0';
- printf ("Sending packet: %s...", buf2); fflush(stdout);
+ printf_unfiltered ("Sending packet: %s...", buf2); gdb_flush(gdb_stdout);
}
if (SERIAL_WRITE (remote_desc, buf2, p - buf2))
perror_with_name ("putpkt: write failed");
{
case '+':
if (remote_debug)
- printf("Ack\n");
+ printf_unfiltered("Ack\n");
return;
case SERIAL_TIMEOUT:
break; /* Retransmit buffer */
error ("putpkt: EOF while trying to read ACK");
default:
if (remote_debug)
- printf ("%02X %c ", ch&0xFF, ch);
+ printf_unfiltered ("%02X %c ", ch&0xFF, ch);
continue;
}
break; /* Here to retransmit */
}
else
{
- printf ("Ignoring packet error, continuing...\n");
+ printf_unfiltered ("Ignoring packet error, continuing...\n");
break;
}
}
SERIAL_WRITE (remote_desc, "+", 1);
if (remote_debug)
- fprintf (stderr,"Packet received: %s\n", buf);
+ fprintf_unfiltered (gdb_stderr,"Packet received: %s\n", buf);
}
\f
static void
(PTRACE_ARG3_TYPE) special_regs[regno-FIRST_SP_REGNUM], 0, 0);
}
else
- fprintf (stderr, "gdb error: register no %d not implemented.\n", regno);
+ fprintf_unfiltered (gdb_stderr, "gdb error: register no %d not implemented.\n", regno);
register_valid [regno] = 1;
}
}
else
- fprintf (stderr, "Gdb error: register no %d not implemented.\n", regno);
+ fprintf_unfiltered (gdb_stderr, "Gdb error: register no %d not implemented.\n", regno);
if ( errno ) {
perror ("ptrace write"); errno = 0;
memcpy (®isters [REGISTER_BYTE (FP0_REGNUM)], core_reg_sect, 32 * 8);
else
- fprintf (stderr, "Gdb error: unknown parameter to fetch_core_registers().\n");
+ fprintf_unfiltered (gdb_stderr, "Gdb error: unknown parameter to fetch_core_registers().\n");
}
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
int pop, eop, probable_eop; /* primary and extended opcodes */
int min, max;
return 4;
not_found:
- fprintf (stream, "0x%08x", the_insn);
+ fprintf_unfiltered (stream, "0x%08x", the_insn);
return 4;
}
}
*qq = '\0';
- fprintf (stream, "%s%s\t", rs6k_ops[insn_no].operator, buf);
+ fprintf_unfiltered (stream, "%s%s\t", rs6k_ops[insn_no].operator, buf);
/* parse the operand now. */
pp = rs6k_ops[insn_no].oprnd_format;
while (*pp != 0) {
switch (*pp) {
case TO :
- fprintf (stream, "%d", (insn_word >> 21) & 0x1f);
+ fprintf_unfiltered (stream, "%d", (insn_word >> 21) & 0x1f);
break;
case RT :
case RS :
- fprintf (stream, "r%d", (insn_word >> 21) & 0x1f);
+ fprintf_unfiltered (stream, "r%d", (insn_word >> 21) & 0x1f);
break;
case LI :
and disassembler is to switch to a match/lose style opcode
table like the sparc. */
if (tmp > 11) {
- fprintf (stream, "{unknown cond code: 0x%x}", insn_word);
+ fprintf_unfiltered (stream, "{unknown cond code: 0x%x}", insn_word);
tmp = 0;
}
- fprintf (stream, "%s", cond_code [tmp]);
+ fprintf_unfiltered (stream, "%s", cond_code [tmp]);
#else
/* So for just always use the "bbf/bbt" form. This is perfectly
correct, just not necessarily as legible.
If tmp is not in the range 0-3, we can't use an XX form anyway. */
- fprintf (stream, "%d", tmp);
+ fprintf_unfiltered (stream, "%d", tmp);
#endif
break;
nocomma = 1;
}
else
- fprintf (stream, "%d", (insn_word >> 5) & 0x7f);
+ fprintf_unfiltered (stream, "%d", (insn_word >> 5) & 0x7f);
break;
case FL1 : /* for svc only */
nocomma = 1;
}
else
- fprintf (stream, "%d", (insn_word >> 12) & 0xf);
+ fprintf_unfiltered (stream, "%d", (insn_word >> 12) & 0xf);
break;
case FL2 : /* for svc only */
nocomma = 0;
if (insn_word & 0x2) /* SA is set */
- fprintf (stream, "%d", (insn_word >> 2) & 0x3fff);
+ fprintf_unfiltered (stream, "%d", (insn_word >> 2) & 0x3fff);
else
- fprintf (stream, "%d", (insn_word >> 2) & 0x7);
+ fprintf_unfiltered (stream, "%d", (insn_word >> 2) & 0x7);
break;
case RA :
if (nocomma) {
- fprintf (stream, "r%d)", (insn_word >> 16) & 0x1f);
+ fprintf_unfiltered (stream, "r%d)", (insn_word >> 16) & 0x1f);
nocomma = 0;
}
else
- fprintf (stream, "r%d", (insn_word >> 16) & 0x1f);
+ fprintf_unfiltered (stream, "r%d", (insn_word >> 16) & 0x1f);
break;
case RB :
- fprintf (stream, "r%d", (insn_word >> 11) & 0x1f);
+ fprintf_unfiltered (stream, "r%d", (insn_word >> 11) & 0x1f);
break;
case SI :
tmp = insn_word & 0xffff;
if (tmp & 0x8000)
tmp -= 0x10000;
- fprintf (stream, "%d", tmp);
+ fprintf_unfiltered (stream, "%d", tmp);
break;
case UI :
- fprintf (stream, "%d", insn_word & 0xffff);
+ fprintf_unfiltered (stream, "%d", insn_word & 0xffff);
break;
case BF :
- fprintf (stream, "%d", (insn_word >> 23) & 0x7);
+ fprintf_unfiltered (stream, "%d", (insn_word >> 23) & 0x7);
break;
case BFA :
- fprintf (stream, "%d", (insn_word >> 18) & 0x7);
+ fprintf_unfiltered (stream, "%d", (insn_word >> 18) & 0x7);
break;
case BT :
- fprintf (stream, "%d", (insn_word >> 21) & 0x1f);
+ fprintf_unfiltered (stream, "%d", (insn_word >> 21) & 0x1f);
break;
case BA :
- fprintf (stream, "%d", (insn_word >> 16) & 0x1f);
+ fprintf_unfiltered (stream, "%d", (insn_word >> 16) & 0x1f);
break;
case BB :
- fprintf (stream, "%d", (insn_word >> 11) & 0x1f);
+ fprintf_unfiltered (stream, "%d", (insn_word >> 11) & 0x1f);
break;
case BO :
- fprintf (stream, "%d", (insn_word >> 21) & 0x1f);
+ fprintf_unfiltered (stream, "%d", (insn_word >> 21) & 0x1f);
break;
case BI :
- fprintf (stream, "%d", (insn_word >> 16) & 0x1f);
+ fprintf_unfiltered (stream, "%d", (insn_word >> 16) & 0x1f);
break;
case SH :
- fprintf (stream, "%d", (insn_word >> 11) & 0x1f);
+ fprintf_unfiltered (stream, "%d", (insn_word >> 11) & 0x1f);
break;
case MB :
- fprintf (stream, "0x%x", (insn_word >> 6) & 0x1f);
+ fprintf_unfiltered (stream, "0x%x", (insn_word >> 6) & 0x1f);
break;
case ME :
- fprintf (stream, "0x%x", (insn_word >> 1) & 0x1f);
+ fprintf_unfiltered (stream, "0x%x", (insn_word >> 1) & 0x1f);
break;
case SPR :
- fprintf (stream, "%d", (insn_word >> 16) & 0x1f);
+ fprintf_unfiltered (stream, "%d", (insn_word >> 16) & 0x1f);
break;
case DIS :
tmp = insn_word & 0xffff;
if (tmp & 0x8000)
tmp -= 0x10000;
- fprintf (stream, "%d(", tmp);
+ fprintf_unfiltered (stream, "%d(", tmp);
break;
case FXM :
- fprintf (stream, "0x%x", (insn_word >> 12) & 0xff);
+ fprintf_unfiltered (stream, "0x%x", (insn_word >> 12) & 0xff);
break;
case FRT :
case FRS :
- fprintf (stream, "f%d", (insn_word >> 21) & 0x1f);
+ fprintf_unfiltered (stream, "f%d", (insn_word >> 21) & 0x1f);
break;
case FRA :
- fprintf (stream, "f%d", (insn_word >> 16) & 0x1f);
+ fprintf_unfiltered (stream, "f%d", (insn_word >> 16) & 0x1f);
break;
case FRB :
- fprintf (stream, "f%d", (insn_word >> 11) & 0x1f);
+ fprintf_unfiltered (stream, "f%d", (insn_word >> 11) & 0x1f);
break;
case FRC :
- fprintf (stream, "f%d", (insn_word >> 6) & 0x1f);
+ fprintf_unfiltered (stream, "f%d", (insn_word >> 6) & 0x1f);
break;
case FLM :
- fprintf (stream, "0x%x", (insn_word >> 17) & 0xff);
+ fprintf_unfiltered (stream, "0x%x", (insn_word >> 17) & 0xff);
break;
case NB :
- fprintf (stream, "%d", (insn_word >> 11) & 0x1f);
+ fprintf_unfiltered (stream, "%d", (insn_word >> 11) & 0x1f);
break;
case I :
- fprintf (stream, "%d", (insn_word >> 12) & 0xf);
+ fprintf_unfiltered (stream, "%d", (insn_word >> 12) & 0xf);
break;
default :
- fprintf (stream,
+ fprintf_unfiltered (stream,
"{Internal error: Unknown operand format identifier %d}",
*pp);
}
++pp;
if (*pp != '\0' && !nocomma)
- fputc(',', stream);
+ fputc_unfiltered(',', stream);
}
}
if (tmp == 0x93e1) {
if (fdata->offset)
/* fatal ("Unrecognized prolog."); */
- printf ("Unrecognized prolog!\n");
+ printf_unfiltered ("Unrecognized prolog!\n");
fdata->saved_gpr = 31;
tmp2 = op & 0xffff;
CORE_ADDR saved_sp, pc;
if ( dummy_frame_count <= 0)
- printf ("FATAL ERROR -push_arguments()! frame not found!!\n");
+ printf_unfiltered ("FATAL ERROR -push_arguments()! frame not found!!\n");
/* The first eight words of ther arguments are passed in registers. Copy
them appropriately.
there is no way we would run out of them. */
if (len > 8)
- printf (
+ printf_unfiltered (
"Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno);
memcpy (®isters[REGISTER_BYTE(FP0_REGNUM + 1 + f_argno)], VALUE_CONTENTS (arg),
if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_FLT && f_argno < 13) {
if (len > 8)
- printf (
+ printf_unfiltered (
"Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno);
memcpy (®isters[REGISTER_BYTE(FP0_REGNUM + 1 + f_argno)], VALUE_CONTENTS (arg),
while (!dos_async_ready())
if (kbhit())
{
- printf("abort!\n");
+ printf_unfiltered("abort!\n");
return 0;
}
if (!hostent)
{
- fprintf (stderr, "%s: unknown host\n", hostname);
+ fprintf_unfiltered (gdb_stderr, "%s: unknown host\n", hostname);
errno = ENOENT;
return -1;
}
struct hardwire_ttystate state;
if (get_tty_state(scb, &state))
- fprintf(stderr, "get_tty_state failed: %s\n", safe_strerror(errno));
+ fprintf_unfiltered(gdb_stderr, "get_tty_state failed: %s\n", safe_strerror(errno));
#ifdef HAVE_TERMIOS
state.termios.c_iflag = 0;
scb->current_timeout = 0;
if (set_tty_state (scb, &state))
- fprintf(stderr, "set_tty_state failed: %s\n", safe_strerror(errno));
+ fprintf_unfiltered(gdb_stderr, "set_tty_state failed: %s\n", safe_strerror(errno));
}
/* Wait for input on scb, with timeout seconds. Returns 0 on success,
struct hardwire_ttystate state;
if (get_tty_state(scb, &state))
- fprintf(stderr, "get_tty_state failed: %s\n", safe_strerror(errno));
+ fprintf_unfiltered(gdb_stderr, "get_tty_state failed: %s\n", safe_strerror(errno));
#ifdef HAVE_TERMIOS
state.termios.c_cc[VTIME] = timeout * 10;
scb->current_timeout = timeout;
if (set_tty_state (scb, &state))
- fprintf(stderr, "set_tty_state failed: %s\n", safe_strerror(errno));
+ fprintf_unfiltered(gdb_stderr, "set_tty_state failed: %s\n", safe_strerror(errno));
return 0;
}
cleanup_tty(ttystate)
serial_ttystate ttystate;
{
- printf ("\r\n[Exiting connect mode]\r\n");
+ printf_unfiltered ("\r\n[Exiting connect mode]\r\n");
SERIAL_SET_TTY_STATE (tty_desc, ttystate);
free (ttystate);
SERIAL_CLOSE (tty_desc);
dont_repeat();
if (args)
- fprintf(stderr, "This command takes no args. They have been ignored.\n");
+ fprintf_unfiltered(gdb_stderr, "This command takes no args. They have been ignored.\n");
- printf("[Entering connect mode. Use ~. or ~^D to escape]\n");
+ printf_unfiltered("[Entering connect mode. Use ~. or ~^D to escape]\n");
tty_desc = SERIAL_FDOPEN (0);
port_desc = last_serial_opened;
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
GDB_INIT_DISASSEMBLE_INFO (info, stream);
if (stat (name, &st) < 0)
{
int save_errno = errno;
- fprintf (stderr, "Warning: ");
+ fprintf_unfiltered (gdb_stderr, "Warning: ");
print_sys_errmsg (name, save_errno);
}
else if ((st.st_mode & S_IFMT) != S_IFDIR)
if (line > s->nlines)
/* Don't index off the end of the line_charpos array. */
return 0;
- printf ("\032\032%s:%d:%d:%s:0x%x\n", s->fullname,
+ printf_unfiltered ("\032\032%s:%d:%d:%s:0x%lx\n", s->fullname,
line, s->line_charpos[line - 1],
mid_statement ? "middle" : "beg",
- pc);
+ (unsigned long) pc);
current_source_line = line;
first_line_listed = line;
last_line_listed = line;
dummy_beg = 1;
else
{
- sals = decode_line_1 (&arg1, 0, 0, 0);
+ sals = decode_line_1 (&arg1, 0, 0, 0, 0);
if (! sals.nelts) return; /* C++ */
if (sals.nelts > 1)
else
{
if (dummy_beg)
- sals_end = decode_line_1 (&arg1, 0, 0, 0);
+ sals_end = decode_line_1 (&arg1, 0, 0, 0, 0);
else
- sals_end = decode_line_1 (&arg1, 0, sal.symtab, sal.line);
+ sals_end = decode_line_1 (&arg1, 0, sal.symtab, sal.line, 0);
if (sals_end.nelts == 0)
return;
if (sals_end.nelts > 1)
if (*arg == '*')
{
if (sal.symtab == 0)
- error ("No source file for address %s.", local_hex_string(sal.pc));
+ error ("No source file for address %s.",
+ local_hex_string((unsigned long) sal.pc));
sym = find_pc_function (sal.pc);
if (sym)
{
- printf_filtered ("%s is in ", local_hex_string(sal.pc));
- fputs_filtered (SYMBOL_SOURCE_NAME (sym), stdout);
+ printf_filtered ("%s is in ",
+ local_hex_string((unsigned long) sal.pc));
+ fputs_filtered (SYMBOL_SOURCE_NAME (sym), gdb_stdout);
printf_filtered (" (%s:%d).\n", sal.symtab->filename, sal.line);
}
else
printf_filtered ("%s is at %s:%d.\n",
- local_hex_string(sal.pc),
+ local_hex_string((unsigned long) sal.pc),
sal.symtab->filename, sal.line);
}
address. */
printf_filtered (" for address ");
wrap_here (" ");
- print_address (sal.pc, stdout);
+ print_address (sal.pc, gdb_stdout);
}
else
printf_filtered (".");
sal.line, sal.symtab->filename);
wrap_here (" ");
printf_filtered (" is at address ");
- print_address (start_pc, stdout);
+ print_address (start_pc, gdb_stdout);
wrap_here (" ");
printf_filtered (" but contains no code.\n");
}
sal.line, sal.symtab->filename);
wrap_here (" ");
printf_filtered (" starts at address ");
- print_address (start_pc, stdout);
+ print_address (start_pc, gdb_stdout);
wrap_here (" ");
printf_filtered (" and ends at ");
- print_address (end_pc, stdout);
+ print_address (end_pc, gdb_stdout);
printf_filtered (".\n");
}
printf_filtered ("Line number %d is out of range for \"%s\".\n",
sal.line, sal.symtab->filename);
}
+ free (sals.sals);
}
\f
/* Commands to search the source file for a regexp. */
current_source_symtab = 0;
init_source_path ();
+ /* The intention is to use POSIX Basic Regular Expressions.
+ Always use the GNU regex routine for consistency across all hosts.
+ Our current GNU regex.c does not have all the POSIX features, so this is
+ just an approximation. */
+ re_set_syntax (RE_SYNTAX_GREP);
+
c = add_cmd ("directory", class_files, directory_command,
"Add directory DIR to beginning of search path for source files.\n\
Forget cached info on source file locations and line positions.\n\
npc4 = next_pc + 4; /* branch not taken */
target_insert_breakpoint (next_pc, break_mem[0]);
- /* printf ("set break at %x\n",next_pc); */
+ /* printf_unfiltered ("set break at %x\n",next_pc); */
pc = read_register (PC_REGNUM);
pc_instruction = read_memory_integer (pc, sizeof(pc_instruction));
char *reg;
int val;
{
- printf ("%s:%s,%s,%s,%s", reg,
+ printf_unfiltered ("%s:%s,%s,%s,%s", reg,
val & 8 ? "N" : "NN",
val & 4 ? "Z" : "NZ",
val & 2 ? "O" : "NO",
char doublereg[8]; /* two float regs */
if (!read_relative_register_raw_bytes ((regno), doublereg))
{
- printf("\t");
- print_floating (doublereg, builtin_type_double, stdout);
+ printf_unfiltered("\t");
+ print_floating (doublereg, builtin_type_double, gdb_stdout);
}
}
else if ((regno) == CCR_REGNUM)
{
int ccr = read_register (CCR_REGNUM);
- printf("\t");
+ printf_unfiltered("\t");
dump_ccreg ("xcc", ccr >> 4);
- printf(", ");
+ printf_unfiltered(", ");
dump_ccreg ("icc", ccr & 15);
}
}
CORE_ADDR sp = *(CORE_ADDR*)®isters[REGISTER_BYTE (SP_REGNUM)];
i = REGISTER_BYTE (regno);
if (register_valid[regno])
- printf("register %d valid and read\n", regno);
+ printf_unfiltered("register %d valid and read\n", regno);
target_xfer_memory (sp + i - REGISTER_BYTE (L0_REGNUM),
®isters[i], REGISTER_RAW_SIZE (regno), 0);
register_valid[regno] = 1;
if (0 != target_read_memory (sp, ®isters[REGISTER_BYTE (L0_REGNUM)],
16 * REGISTER_RAW_SIZE (L0_REGNUM)))
{
- /* fprintf so user can still use gdb */
- fprintf (stderr,
+ /* fprintf_unfiltered so user can still use gdb */
+ fprintf_unfiltered (gdb_stderr,
"Couldn't read input and local registers from core file\n");
}
}
sizeof (FPU_FSR_TYPE));
}
else
- fprintf (stderr, "Couldn't read float regs from core file\n");
+ fprintf_unfiltered (gdb_stderr, "Couldn't read float regs from core file\n");
}
}
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
args_info PARAMS ((char *, int));
static void
-print_frame_arg_vars PARAMS ((FRAME, FILE *));
+print_frame_arg_vars PARAMS ((FRAME, GDB_FILE *));
static void
catch_info PARAMS ((char *, int));
locals_info PARAMS ((char *, int));
static void
-print_frame_label_vars PARAMS ((FRAME, int, FILE *));
+print_frame_label_vars PARAMS ((FRAME, int, GDB_FILE *));
static void
-print_frame_local_vars PARAMS ((FRAME, FILE *));
+print_frame_local_vars PARAMS ((FRAME, GDB_FILE *));
static int
-print_block_frame_labels PARAMS ((struct block *, int *, FILE *));
+print_block_frame_labels PARAMS ((struct block *, int *, GDB_FILE *));
static int
-print_block_frame_locals PARAMS ((struct block *, FRAME, FILE *));
+print_block_frame_locals PARAMS ((struct block *, FRAME, GDB_FILE *));
static void
backtrace_command PARAMS ((char *, int));
int frame_file_full_name = 0;
\f
+struct print_stack_frame_args {
+ struct frame_info *fi;
+ int level;
+ int source;
+ int args;
+};
+
+static int print_stack_frame_stub PARAMS ((char *));
+
+/* Pass the args the way catch_errors wants them. */
+static int
+print_stack_frame_stub (args)
+ char *args;
+{
+ struct print_stack_frame_args *p = (struct print_stack_frame_args *)args;
+ print_frame_info (p->fi, p->level, p->source, p->args);
+ return 0;
+}
+
/* Print a stack frame briefly. FRAME should be the frame id
and LEVEL should be its level in the stack (or -1 for level not defined).
This prints the level, the function executing, the arguments,
int level;
int source;
{
- struct frame_info *fi;
+ struct print_stack_frame_args args;
- fi = get_frame_info (frame);
+ args.fi = get_frame_info (frame);
+ args.level = level;
+ args.source = source;
+ args.args = 1;
- print_frame_info (fi, level, source, 1);
+ catch_errors (print_stack_frame_stub, (char *)&args, "", RETURN_MASK_ERROR);
}
struct print_args_args {
int numargs;
struct print_args_args *p = (struct print_args_args *)args;
FRAME_NUM_ARGS (numargs, (p->fi));
- print_frame_args (p->func, p->fi, numargs, stdout);
+ print_frame_args (p->func, p->fi, numargs, gdb_stdout);
return 0;
}
if (addressprint)
if (fi->pc != sal.pc || !sal.symtab)
printf_filtered ("%s in ", local_hex_string((unsigned long) fi->pc));
- fprintf_symbol_filtered (stdout, funname ? funname : "??", funlang,
+ fprintf_symbol_filtered (gdb_stdout, funname ? funname : "??", funlang,
DMGL_NO_OPTS);
wrap_here (" ");
- fputs_filtered (" (", stdout);
+ fputs_filtered (" (", gdb_stdout);
if (args)
{
struct print_args_args args;
if (source != 0)
set_default_breakpoint (1, fi->pc, sal.symtab, sal.line);
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
/*
if (funname)
{
printf_filtered (" in ");
- fprintf_symbol_filtered (stdout, funname, funlang,
+ fprintf_symbol_filtered (gdb_stdout, funname, funlang,
DMGL_ANSI | DMGL_PARAMS);
}
wrap_here (" ");
puts_filtered (" 1 arg: ");
else
printf_filtered (" %d args: ", numargs);
- print_frame_args (func, fi, numargs, stdout);
+ print_frame_args (func, fi, numargs, gdb_stdout);
puts_filtered ("\n");
}
}
if (arg)
error ("\"Info backtrace-limit\" takes no arguments.");
- printf ("Backtrace limit: %d.\n", backtrace_limit);
+ printf_unfiltered ("Backtrace limit: %d.\n", backtrace_limit);
}
#endif
{
QUIT;
fi = get_frame_info (frame);
+
+ /* Don't use print_stack_frame; if an error() occurs it probably
+ means further attempts to backtrace would fail (on the other
+ hand, perhaps the code does or could be fixed to make sure
+ the frame->prev field gets set to NULL in that case). */
print_frame_info (fi, trailing_level + i, 0, 1);
}
print_block_frame_locals (b, frame, stream)
struct block *b;
register FRAME frame;
- register FILE *stream;
+ register GDB_FILE *stream;
{
int nsyms;
register int i;
print_block_frame_labels (b, have_default, stream)
struct block *b;
int *have_default;
- register FILE *stream;
+ register GDB_FILE *stream;
{
int nsyms;
register int i;
static void
print_frame_local_vars (frame, stream)
register FRAME frame;
- register FILE *stream;
+ register GDB_FILE *stream;
{
register struct block *block = get_frame_block (frame);
register int values_printed = 0;
print_frame_label_vars (frame, this_level_only, stream)
register FRAME frame;
int this_level_only;
- register FILE *stream;
+ register GDB_FILE *stream;
{
register struct blockvector *bl;
register struct block *block = get_frame_block (frame);
{
if (!selected_frame)
error ("No frame selected.");
- print_frame_local_vars (selected_frame, stdout);
+ print_frame_local_vars (selected_frame, gdb_stdout);
}
static void
{
if (!selected_frame)
error ("No frame selected.");
- print_frame_label_vars (selected_frame, 0, stdout);
+ print_frame_label_vars (selected_frame, 0, gdb_stdout);
}
static void
print_frame_arg_vars (frame, stream)
register FRAME frame;
- register FILE *stream;
+ register GDB_FILE *stream;
{
struct symbol *func = get_frame_function (frame);
register struct block *b;
{
if (!selected_frame)
error ("No frame selected.");
- print_frame_arg_vars (selected_frame, stdout);
+ print_frame_arg_vars (selected_frame, gdb_stdout);
}
\f
/* Select frame FRAME, and note that its stack level is LEVEL.
va_start (args);
string = va_arg (args, char *);
- vfprintf (stderr, string, args);
+ vfprintf (gdb_stderr, string, args);
va_end (args);
exit (-1);
}
#endif
}
else
- fprintf (stderr, "Couldn't read float regs from core file\n");
+ fprintf_unfiltered (gdb_stderr, "Couldn't read float regs from core file\n");
}
}
core_aouthdr.magic = corestr.c_aouthdr.a_info;
core_aouthdr.vstamp = /*SUNVERSION*/ 31252;
#endif
- printf ("Core file is from \"%s\".\n", corestr.c_cmdname);
+ printf_unfiltered ("Core file is from \"%s\".\n", corestr.c_cmdname);
if (corestr.c_signo > 0)
- printf ("Program terminated with signal %d, %s.\n",
+ printf_unfiltered ("Program terminated with signal %d, %s.\n",
corestr.c_signo, safe_strsignal (corestr.c_signo));
}
if (filename[0] == '/')
validate_files ();
}
else if (from_tty)
- printf ("No core file now.\n");
+ printf_unfiltered ("No core file now.\n");
}
i387_to_double (from, to)
{
printf_filtered ("Mapped symbols for %s...", name);
wrap_here ("");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
init_entry_point_info (objfile);
find_sym_fns (objfile);
{
printf_filtered ("Reading symbols from %s...", name);
wrap_here ("");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
syms_from_objfile (objfile, addr, mainline, from_tty);
}
{
printf_filtered ("expanding to full symbols...");
wrap_here ("");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
for (psymtab = objfile -> psymtabs;
if (from_tty || info_verbose)
{
printf_filtered ("done.\n");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
new_symfile_objfile (objfile, mainline, from_tty);
symfile_objfile = NULL;
if (from_tty)
{
- printf ("No symbol file now.\n");
+ printf_unfiltered ("No symbol file now.\n");
}
}
else
int fpreg;
unsigned char *p;
- printf("80387:");
+ printf_unfiltered("80387:");
if (ep.pr_fpu.fpu_ip == 0) {
- printf(" not in use.\n");
+ printf_unfiltered(" not in use.\n");
return;
} else {
- printf("\n");
+ printf_unfiltered("\n");
}
if (ep.pr_fpu.fpu_status != 0) {
print_387_status_word (ep.pr_fpu.fpu_status);
}
print_387_control_word (ep.pr_fpu.fpu_control);
- printf ("last exception: ");
- printf ("opcode 0x%x; ", ep.pr_fpu.fpu_rsvd4);
- printf ("pc 0x%x:0x%x; ", ep.pr_fpu.fpu_cs, ep.pr_fpu.fpu_ip);
- printf ("operand 0x%x:0x%x\n", ep.pr_fpu.fpu_data_offset, ep.pr_fpu.fpu_op_sel);
+ printf_unfiltered ("last exception: ");
+ printf_unfiltered ("opcode 0x%x; ", ep.pr_fpu.fpu_rsvd4);
+ printf_unfiltered ("pc 0x%x:0x%x; ", ep.pr_fpu.fpu_cs, ep.pr_fpu.fpu_ip);
+ printf_unfiltered ("operand 0x%x:0x%x\n", ep.pr_fpu.fpu_data_offset, ep.pr_fpu.fpu_op_sel);
top = (ep.pr_fpu.fpu_status >> 11) & 7;
- printf ("regno tag msb lsb value\n");
+ printf_unfiltered ("regno tag msb lsb value\n");
for (fpreg = 7; fpreg >= 0; fpreg--)
{
double val;
- printf ("%s %d: ", fpreg == top ? "=>" : " ", fpreg);
+ printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : " ", fpreg);
switch ((ep.pr_fpu.fpu_tag >> (fpreg * 2)) & 3)
{
- case 0: printf ("valid "); break;
- case 1: printf ("zero "); break;
- case 2: printf ("trap "); break;
- case 3: printf ("empty "); break;
+ case 0: printf_unfiltered ("valid "); break;
+ case 1: printf_unfiltered ("zero "); break;
+ case 2: printf_unfiltered ("trap "); break;
+ case 3: printf_unfiltered ("empty "); break;
}
for (i = 9; i >= 0; i--)
- printf ("%02x", ep.pr_fpu.fpu_stack[fpreg][i]);
+ printf_unfiltered ("%02x", ep.pr_fpu.fpu_stack[fpreg][i]);
i387_to_double (ep.pr_fpu.fpu_stack[fpreg], (char *)&val);
- printf (" %g\n", val);
+ printf_unfiltered (" %g\n", val);
}
if (ep.pr_fpu.fpu_rsvd1)
warning ("rsvd1 is 0x%x\n", ep.pr_fpu.fpu_rsvd1);
int pcr_tmp;
pcr_tmp = pcr & FPA_PCR_MODE;
- printf("\tMODE= %#x; RND= %#x ", pcr_tmp, pcr_tmp & 12);
+ printf_unfiltered("\tMODE= %#x; RND= %#x ", pcr_tmp, pcr_tmp & 12);
switch (pcr_tmp & 12) {
case 0:
- printf("RN (Nearest Value)");
+ printf_unfiltered("RN (Nearest Value)");
break;
case 1:
- printf("RZ (Zero)");
+ printf_unfiltered("RZ (Zero)");
break;
case 2:
- printf("RP (Positive Infinity)");
+ printf_unfiltered("RP (Positive Infinity)");
break;
case 3:
- printf("RM (Negative Infinity)");
+ printf_unfiltered("RM (Negative Infinity)");
break;
}
- printf("; IRND= %d ", pcr_tmp & 2);
+ printf_unfiltered("; IRND= %d ", pcr_tmp & 2);
if (0 == pcr_tmp & 2) {
- printf("(same as RND)\n");
+ printf_unfiltered("(same as RND)\n");
} else {
- printf("(toward zero)\n");
+ printf_unfiltered("(toward zero)\n");
}
pcr_tmp = pcr & FPA_PCR_EM;
- printf("\tEM= %#x", pcr_tmp);
- if (pcr_tmp & FPA_PCR_EM_DM) printf(" DM");
- if (pcr_tmp & FPA_PCR_EM_UOM) printf(" UOM");
- if (pcr_tmp & FPA_PCR_EM_PM) printf(" PM");
- if (pcr_tmp & FPA_PCR_EM_UM) printf(" UM");
- if (pcr_tmp & FPA_PCR_EM_OM) printf(" OM");
- if (pcr_tmp & FPA_PCR_EM_ZM) printf(" ZM");
- if (pcr_tmp & FPA_PCR_EM_IM) printf(" IM");
- printf("\n");
+ printf_unfiltered("\tEM= %#x", pcr_tmp);
+ if (pcr_tmp & FPA_PCR_EM_DM) printf_unfiltered(" DM");
+ if (pcr_tmp & FPA_PCR_EM_UOM) printf_unfiltered(" UOM");
+ if (pcr_tmp & FPA_PCR_EM_PM) printf_unfiltered(" PM");
+ if (pcr_tmp & FPA_PCR_EM_UM) printf_unfiltered(" UM");
+ if (pcr_tmp & FPA_PCR_EM_OM) printf_unfiltered(" OM");
+ if (pcr_tmp & FPA_PCR_EM_ZM) printf_unfiltered(" ZM");
+ if (pcr_tmp & FPA_PCR_EM_IM) printf_unfiltered(" IM");
+ printf_unfiltered("\n");
pcr_tmp = FPA_PCR_CC;
- printf("\tCC= %#x", pcr_tmp);
- if (pcr_tmp & FPA_PCR_20MHZ) printf(" 20MHZ");
- if (pcr_tmp & FPA_PCR_CC_Z) printf(" Z");
- if (pcr_tmp & FPA_PCR_CC_C2) printf(" C2");
- if (pcr_tmp & FPA_PCR_CC_C1) printf(" C1");
+ printf_unfiltered("\tCC= %#x", pcr_tmp);
+ if (pcr_tmp & FPA_PCR_20MHZ) printf_unfiltered(" 20MHZ");
+ if (pcr_tmp & FPA_PCR_CC_Z) printf_unfiltered(" Z");
+ if (pcr_tmp & FPA_PCR_CC_C2) printf_unfiltered(" C2");
+ if (pcr_tmp & FPA_PCR_CC_C1) printf_unfiltered(" C1");
switch (pcr_tmp) {
case FPA_PCR_CC_Z:
- printf(" (Equal)");
+ printf_unfiltered(" (Equal)");
break;
case FPA_PCR_CC_C1:
- printf(" (Less than)");
+ printf_unfiltered(" (Less than)");
break;
case 0:
- printf(" (Greater than)");
+ printf_unfiltered(" (Greater than)");
break;
case FPA_PCR_CC_Z | FPA_PCR_CC_C1 | FPA_PCR_CC_C2:
- printf(" (Unordered)");
+ printf_unfiltered(" (Unordered)");
break;
default:
- printf(" (Undefined)");
+ printf_unfiltered(" (Undefined)");
break;
}
- printf("\n");
+ printf_unfiltered("\n");
pcr_tmp = pcr & FPA_PCR_AE;
- printf("\tAE= %#x", pcr_tmp);
- if (pcr_tmp & FPA_PCR_AE_DE) printf(" DE");
- if (pcr_tmp & FPA_PCR_AE_UOE) printf(" UOE");
- if (pcr_tmp & FPA_PCR_AE_PE) printf(" PE");
- if (pcr_tmp & FPA_PCR_AE_UE) printf(" UE");
- if (pcr_tmp & FPA_PCR_AE_OE) printf(" OE");
- if (pcr_tmp & FPA_PCR_AE_ZE) printf(" ZE");
- if (pcr_tmp & FPA_PCR_AE_EE) printf(" EE");
- if (pcr_tmp & FPA_PCR_AE_IE) printf(" IE");
- printf("\n");
+ printf_unfiltered("\tAE= %#x", pcr_tmp);
+ if (pcr_tmp & FPA_PCR_AE_DE) printf_unfiltered(" DE");
+ if (pcr_tmp & FPA_PCR_AE_UOE) printf_unfiltered(" UOE");
+ if (pcr_tmp & FPA_PCR_AE_PE) printf_unfiltered(" PE");
+ if (pcr_tmp & FPA_PCR_AE_UE) printf_unfiltered(" UE");
+ if (pcr_tmp & FPA_PCR_AE_OE) printf_unfiltered(" OE");
+ if (pcr_tmp & FPA_PCR_AE_ZE) printf_unfiltered(" ZE");
+ if (pcr_tmp & FPA_PCR_AE_EE) printf_unfiltered(" EE");
+ if (pcr_tmp & FPA_PCR_AE_IE) printf_unfiltered(" IE");
+ printf_unfiltered("\n");
}
print_1167_regs(regs)
for (i = 0; i < FPA_NREGS; i++) {
xf.l = regs[i];
- printf("%%fp%d: raw= %#x, single= %f", i+1, regs[i], xf.f);
+ printf_unfiltered("%%fp%d: raw= %#x, single= %f", i+1, regs[i], xf.f);
if (!(i & 1)) {
- printf("\n");
+ printf_unfiltered("\n");
} else {
xd.l[1] = regs[i];
xd.l[0] = regs[i+1];
- printf(", double= %f\n", xd.d);
+ printf_unfiltered(", double= %f\n", xd.d);
}
}
}
{
- printf("WTL 1167:");
+ printf_unfiltered("WTL 1167:");
if (ep.pr_fpa.fpa_pcr !=0) {
- printf("\n");
+ printf_unfiltered("\n");
print_1167_control_word(ep.pr_fpa.fpa_pcr);
print_1167_regs(ep.pr_fpa.fpa_regs);
} else {
- printf(" not in use.\n");
+ printf_unfiltered(" not in use.\n");
}
}
cplusplus_hint (name)
char *name;
{
- printf ("Hint: try '%s<TAB> or '%s<ESC-?>\n", name, name);
- printf ("(Note leading single quote.)\n");
+ printf_unfiltered ("Hint: try '%s<TAB> or '%s<ESC-?>\n", name, name);
+ printf_unfiltered ("(Note leading single quote.)\n");
}
/* Check for a symtab of a specific name; first in symtabs, then in
char *volatile_prefix = method->is_volatile ? "V" : "";
char buf[20];
int len = (newname == NULL ? 0 : strlen (newname));
- char *opname;
is_constructor = newname && STREQ(field_name, newname);
if (!is_constructor)
work with the normal mechanisms. */
if (OPNAME_PREFIX_P (field_name))
{
+ char *opname;
opname = cplus_mangle_opname (field_name + 3, 0);
if (opname == NULL)
{
if (sym_arr[i1]) i1++;
else
{
- fputs_filtered("(Cannot find method ", stdout);
- fprintf_symbol_filtered (stdout, phys_name,
+ fputs_filtered("(Cannot find method ", gdb_stdout);
+ fprintf_symbol_filtered (gdb_stdout, phys_name,
language_cplus, DMGL_PARAMS);
- fputs_filtered(" - possibly inlined.)\n", stdout);
+ fputs_filtered(" - possibly inlined.)\n", gdb_stdout);
}
}
}
}
i = 0;
- printf("[0] cancel\n[1] all\n");
+ printf_unfiltered("[0] cancel\n[1] all\n");
while (i < nelts)
{
if (sym_arr[i] && SYMBOL_CLASS (sym_arr[i]) == LOC_BLOCK)
values.sals[i] = find_pc_line (pc, 0);
values.sals[i].pc = (values.sals[i].end && values.sals[i].pc != pc) ?
values.sals[i].end : pc;
- printf("[%d] %s at %s:%d\n", (i+2), SYMBOL_SOURCE_NAME (sym_arr[i]),
+ printf_unfiltered("[%d] %s at %s:%d\n", (i+2), SYMBOL_SOURCE_NAME (sym_arr[i]),
values.sals[i].symtab->filename, values.sals[i].line);
}
- else printf ("?HERE\n");
+ else printf_unfiltered ("?HERE\n");
i++;
}
{
prompt = ">";
}
- printf("%s ",prompt);
- fflush(stdout);
+ printf_unfiltered("%s ",prompt);
+ gdb_flush(gdb_stdout);
args = command_line_input ((char *) NULL, 0);
if (num > nelts + 2)
{
- printf ("No choice number %d.\n", num);
+ printf_unfiltered ("No choice number %d.\n", num);
}
else
{
}
else
{
- printf ("duplicate request for %d ignored.\n", num);
+ printf_unfiltered ("duplicate request for %d ignored.\n", num);
}
}
}
wrap_here ("");
- fputs_filtered (name, stdout);
+ fputs_filtered (name, gdb_stdout);
}
static void
}
else if (!found_in_file)
{
- fputs_filtered ("\nFile ", stdout);
- fputs_filtered (s->filename, stdout);
- fputs_filtered (":\n", stdout);
+ fputs_filtered ("\nFile ", gdb_stdout);
+ fputs_filtered (s->filename, gdb_stdout);
+ fputs_filtered (":\n", gdb_stdout);
}
found_in_file = 1;
/* Typedef that is not a C++ class */
if (class == 2
&& SYMBOL_NAMESPACE (sym) != STRUCT_NAMESPACE)
- c_typedef_print (SYMBOL_TYPE(sym), sym, stdout);
+ c_typedef_print (SYMBOL_TYPE(sym), sym, gdb_stdout);
/* variable, func, or typedef-that-is-c++-class */
else if (class < 2 ||
(class == 2 &&
type_print (SYMBOL_TYPE (sym),
(SYMBOL_CLASS (sym) == LOC_TYPEDEF
? "" : SYMBOL_SOURCE_NAME (sym)),
- stdout, 0);
+ gdb_stdout, 0);
printf_filtered (";\n");
}
# if 0 /* FIXME, why is this zapped out? */
char buf[1024];
c_type_print_base (TYPE_FN_FIELD_TYPE(t, i),
- stdout, 0, 0);
+ gdb_stdout, 0, 0);
c_type_print_varspec_prefix (TYPE_FN_FIELD_TYPE(t, i),
- stdout, 0);
+ gdb_stdout, 0);
sprintf (buf, " %s::", type_name_no_tag (t));
cp_type_print_method_args (TYPE_FN_FIELD_ARGS (t, i),
- buf, name, stdout);
+ buf, name, gdb_stdout);
# endif
}
}
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
unsigned char buffer[MAXLEN];
register int i;
/* Handle undefined instructions. */
if (i == NOPCODES)
{
- fprintf (stream, "0%o", buffer[0]);
+ fprintf_unfiltered (stream, "0%o", buffer[0]);
return 1;
}
- fprintf (stream, "%s", votstrs[i].name);
+ fprintf_unfiltered (stream, "%s", votstrs[i].name);
/* Point at first byte of argument data,
and at descriptor for first argument. */
d = votstrs[i].detail.args;
if (*d)
- fputc ('\t', stream);
+ fputc_unfiltered ('\t', stream);
while (*d)
{
p = print_insn_arg (d, p, memaddr + (p - buffer), stream);
d += 2;
if (*d)
- fprintf (stream, ",");
+ fprintf_unfiltered (stream, ",");
}
return p - buffer;
}
char *d;
register char *p;
CORE_ADDR addr;
- FILE *stream;
+ GDB_FILE *stream;
{
int temp1 = 0;
register int regnum = *p & 0xf;
if (*d == 'b')
{
if (d[1] == 'b')
- fprintf (stream, "0x%x", addr + *p++ + 1);
+ fprintf_unfiltered (stream, "0x%x", addr + *p++ + 1);
else
{
temp1 = *p;
temp1 <<= 8;
temp1 |= *(p + 1);
- fprintf (stream, "0x%x", addr + temp1 + 2);
+ fprintf_unfiltered (stream, "0x%x", addr + temp1 + 2);
p += 2;
}
}
if (d[1] == 'd' || d[1] == 'f' || d[1] == 'g' || d[1] == 'h')
{
*(int *)&floatlitbuf = 0x4000 + ((p[-1] & 0x3f) << 4);
- fprintf (stream, "$%f", floatlitbuf);
+ fprintf_unfiltered (stream, "$%f", floatlitbuf);
}
else
- fprintf (stream, "$%d", p[-1] & 0x3f);
+ fprintf_unfiltered (stream, "$%d", p[-1] & 0x3f);
break;
case 4: /* Indexed */
p = (char *) print_insn_arg (d, p, addr + 1, stream);
- fprintf (stream, "[%s]", reg_names[regnum]);
+ fprintf_unfiltered (stream, "[%s]", reg_names[regnum]);
break;
case 5: /* Register */
- fprintf (stream, reg_names[regnum]);
+ fprintf_unfiltered (stream, reg_names[regnum]);
break;
case 7: /* Autodecrement */
- fputc ('-', stream);
+ fputc_unfiltered ('-', stream);
case 6: /* Register deferred */
- fprintf (stream, "(%s)", reg_names[regnum]);
+ fprintf_unfiltered (stream, "(%s)", reg_names[regnum]);
break;
case 9: /* Absolute Address & Autoincrement deferred */
- fputc ('*', stream);
+ fputc_unfiltered ('*', stream);
if (regnum == PC_REGNUM)
{
temp1 = *p;
temp1 <<= 8;
temp1 |= *(p +1);
- fputc ('$', stream);
+ fputc_unfiltered ('$', stream);
print_address (temp1, stream);
p += 4;
break;
}
case 8: /*Immediate & Autoincrement SP */
if (regnum == 8) /*88 is Immediate Byte Mode*/
- fprintf (stream, "$%d", *p++);
+ fprintf_unfiltered (stream, "$%d", *p++);
else if (regnum == 9) /*89 is Immediate Word Mode*/
{
temp1 = *p;
temp1 <<= 8;
temp1 |= *(p +1);
- fprintf (stream, "$%d", temp1);
+ fprintf_unfiltered (stream, "$%d", temp1);
p += 2;
}
temp1 |= *(p +2);
temp1 <<= 8;
temp1 |= *(p +3);
- fprintf (stream, "$%d", temp1);
+ fprintf_unfiltered (stream, "$%d", temp1);
p += 4;
}
else /*8E is Autoincrement SP Mode*/
- fprintf (stream, "(%s)+", reg_names[regnum]);
+ fprintf_unfiltered (stream, "(%s)+", reg_names[regnum]);
break;
case 11: /* Register + Byte Displacement Deferred Mode*/
- fputc ('*', stream);
+ fputc_unfiltered ('*', stream);
case 10: /* Register + Byte Displacement Mode*/
if (regnum == PC_REGNUM)
print_address (addr + *p + 2, stream);
else
- fprintf (stream, "%d(%s)", *p, reg_names[regnum]);
+ fprintf_unfiltered (stream, "%d(%s)", *p, reg_names[regnum]);
p += 1;
break;
case 13: /* Register + Word Displacement Deferred Mode*/
- fputc ('*', stream);
+ fputc_unfiltered ('*', stream);
case 12: /* Register + Word Displacement Mode*/
temp1 = *p;
temp1 <<= 8;
if (regnum == PC_REGNUM)
print_address (addr + temp1 + 3, stream);
else
- fprintf (stream, "%d(%s)", temp1, reg_names[regnum]);
+ fprintf_unfiltered (stream, "%d(%s)", temp1, reg_names[regnum]);
p += 2;
break;
case 15: /* Register + Long Displacement Deferred Mode*/
- fputc ('*', stream);
+ fputc_unfiltered ('*', stream);
case 14: /* Register + Long Displacement Mode*/
temp1 = *p;
temp1 <<= 8;
if (regnum == PC_REGNUM)
print_address (addr + temp1 + 5, stream);
else
- fprintf (stream, "%d(%s)", temp1, reg_names[regnum]);
+ fprintf_unfiltered (stream, "%d(%s)", temp1, reg_names[regnum]);
p += 4;
}
type_print (type, varstring, stream, show)
struct type *type;
char *varstring;
- FILE *stream;
+ GDB_FILE *stream;
int show;
{
LA_PRINT_TYPE (type, varstring, stream, show, 0);
val = access_value_history (0);
printf_filtered ("type = ");
- type_print (VALUE_TYPE (val), "", stdout, show);
+ type_print (VALUE_TYPE (val), "", gdb_stdout, show);
printf_filtered ("\n");
if (exp)
{
/* User did "ptype <typename>" */
printf_filtered ("type = ");
- type_print (type, "", stdout, 1);
+ type_print (type, "", gdb_stdout, 1);
printf_filtered ("\n");
do_cleanups (old_chain);
}
print_type_scalar (type, val, stream)
struct type *type;
LONGEST val;
- FILE *stream;
+ GDB_FILE *stream;
{
unsigned int i;
unsigned len;
default:
error ("Invalid type code in symbol table.");
}
- fflush (stream);
+ gdb_flush (stream);
}
#if MAINTENANCE_CMDS
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
void
-print_type_scalar PARAMS ((struct type *type, LONGEST, FILE *));
+print_type_scalar PARAMS ((struct type *type, LONGEST, GDB_FILE *));
case BP_REGNUM: return(offsetof(struct ptrace_user,pt_bp));
case FC_REGNUM: return(offsetof(struct ptrace_user,pt_fc));
default:
- fprintf_filtered(stderr,"register_addr():Bad register %s (%d)\n",
+ fprintf_filtered(gdb_stderr,"register_addr():Bad register %s (%d)\n",
reg_names[regno],regno);
return(0xffffffff); /* Should make ptrace() fail */
}
switch (cmd) {
case F_GETFL: return(O_RDONLY); break;
default:
- printf("Ultra3's fcntl() failing, cmd = %d.\n",cmd);
+ printf_unfiltered("Ultra3's fcntl() failing, cmd = %d.\n",cmd);
return(-1);
}
}
reg_offset = 0;
memcpy (&core_aouthdr, &u.pt_aouthdr, sizeof (AOUTHDR));
- printf ("Core file is from \"%s\".\n", u.pt_comm);
+ printf_unfiltered ("Core file is from \"%s\".\n", u.pt_comm);
if (u.pt_signal > 0)
- printf ("Program terminated with signal %d, %s.\n",
+ printf_unfiltered ("Program terminated with signal %d, %s.\n",
u.pt_signal, safe_strsignal (u.pt_signal));
/* Read the register values out of the core file and store
validate_files ();
}
else if (from_tty)
- printf ("No core file now.\n");
+ printf_unfiltered ("No core file now.\n");
}
#include "signals.h"
#include "gdbcmd.h"
#include "serial.h"
-#if 0
-/* No longer needed, I suspect. */
-#include "terminal.h"
-#endif
+#include "terminal.h" /* For job_control */
#include "bfd.h"
#include "target.h"
#include "demangle.h"
{
target_terminal_ours ();
wrap_here(""); /* Force out any buffered output */
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
/* Print a warning message.
va_start (args);
target_terminal_ours ();
wrap_here(""); /* Force out any buffered output */
- fflush (stdout);
+ gdb_flush (gdb_stdout);
if (warning_pre_print)
- fprintf (stderr, warning_pre_print);
+ fprintf_unfiltered (gdb_stderr, warning_pre_print);
string = va_arg (args, char *);
- vfprintf (stderr, string, args);
- fprintf (stderr, "\n");
+ vfprintf_unfiltered (gdb_stderr, string, args);
+ fprintf_unfiltered (gdb_stderr, "\n");
va_end (args);
}
va_start (args);
target_terminal_ours ();
wrap_here(""); /* Force out any buffered output */
- fflush (stdout);
+ gdb_flush (gdb_stdout);
if (error_pre_print)
- fprintf_filtered (stderr, error_pre_print);
+ fprintf_filtered (gdb_stderr, error_pre_print);
string = va_arg (args, char *);
- vfprintf_filtered (stderr, string, args);
- fprintf_filtered (stderr, "\n");
+ vfprintf_filtered (gdb_stderr, string, args);
+ fprintf_filtered (gdb_stderr, "\n");
va_end (args);
return_to_top_level (RETURN_ERROR);
}
va_start (args);
string = va_arg (args, char *);
- fprintf (stderr, "\ngdb: ");
- vfprintf (stderr, string, args);
- fprintf (stderr, "\n");
+ fprintf_unfiltered (gdb_stderr, "\ngdb: ");
+ vfprintf_unfiltered (gdb_stderr, string, args);
+ fprintf_unfiltered (gdb_stderr, "\n");
va_end (args);
exit (1);
}
string = va_arg (args, char *);
/* "internal error" is always correct, since GDB should never dump
core, no matter what the input. */
- fprintf (stderr, "\ngdb internal error: ");
- vfprintf (stderr, string, args);
- fprintf (stderr, "\n");
+ fprintf_unfiltered (gdb_stderr, "\ngdb internal error: ");
+ vfprintf_unfiltered (gdb_stderr, string, args);
+ fprintf_unfiltered (gdb_stderr, "\n");
va_end (args);
signal (SIGQUIT, SIG_DFL);
strcat (combined, ": ");
strcat (combined, err);
- fprintf (stderr, "%s.\n", combined);
+ fprintf_unfiltered (gdb_stderr, "%s.\n", combined);
}
/* Control C eventually causes this to be called, at a convenient time. */
void
quit ()
{
- serial_t stdout_serial = serial_fdopen (1);
+ serial_t gdb_stdout_serial = serial_fdopen (1);
target_terminal_ours ();
wrap_here ((char *)0); /* Force out any pending output */
- SERIAL_FLUSH_OUTPUT (stdout_serial);
+ SERIAL_FLUSH_OUTPUT (gdb_stdout_serial);
- SERIAL_UN_FDOPEN (stdout_serial);
+ SERIAL_UN_FDOPEN (gdb_stdout_serial);
/* Don't use *_filtered; we don't want to prompt the user to continue. */
if (error_pre_print)
- fprintf (stderr, error_pre_print);
+ fprintf_unfiltered (gdb_stderr, error_pre_print);
if (job_control
/* If there is no terminal switching for this target, then we can't
possibly get screwed by the lack of job control. */
|| current_target->to_terminal_ours == NULL)
- fprintf (stderr, "Quit\n");
+ fprintf_unfiltered (gdb_stderr, "Quit\n");
else
- fprintf (stderr,
+ fprintf_unfiltered (gdb_stderr,
"Quit (expect signal SIGINT when the program is resumed)\n");
return_to_top_level (RETURN_QUIT);
}
xmalloc (size)
long size;
{
- return (xmmalloc ((void *) NULL, size));
+ return (xmmalloc ((PTR) NULL, size));
}
/* Like mrealloc but get error if no storage available. */
PTR ptr;
long size;
{
- return (xmrealloc ((void *) NULL, ptr, size));
+ return (xmrealloc ((PTR) NULL, ptr, size));
}
\f
char *
msavestring (md, ptr, size)
- void *md;
+ PTR md;
const char *ptr;
int size;
{
char *
mstrsave (md, ptr)
- void *md;
+ PTR md;
const char *ptr;
{
return (msavestring (md, ptr, strlen (ptr)));
while (1)
{
wrap_here (""); /* Flush any buffered output */
- fflush (stdout);
+ gdb_flush (gdb_stdout);
va_start (args);
ctlstr = va_arg (args, char *);
- vfprintf_filtered (stdout, ctlstr, args);
+ vfprintf_filtered (gdb_stdout, ctlstr, args);
va_end (args);
printf_filtered ("(y or n) ");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
answer = fgetc (stdin);
clearerr (stdin); /* in case of C-d */
if (answer == EOF) /* C-d */
if (wrap_buffer[0])
{
*wrap_pointer = '\0';
- fputs (wrap_buffer, stdout);
+ fputs (wrap_buffer, gdb_stdout);
}
wrap_pointer = wrap_buffer;
wrap_buffer[0] = '\0';
}
}
+
+GDB_FILE *
+gdb_fopen (name, mode)
+ char * name;
+ char * mode;
+{
+ return fopen (name, mode);
+}
+
/* Like fputs but pause after every screenful, and can wrap at points
other than the final character of a line.
Unlike fputs, fputs_filtered does not return a value.
called when cleanups are not in place. */
void
-fputs_filtered (linebuffer, stream)
+gdb_flush (stream)
+ FILE *stream;
+{
+ fflush (stream);
+}
+
+static void
+fputs_maybe_filtered (linebuffer, stream, filter)
const char *linebuffer;
FILE *stream;
+ int filter;
{
const char *lineptr;
return;
/* Don't do any filtering if it is disabled. */
- if (stream != stdout
+ if (stream != gdb_stdout
|| (lines_per_page == UINT_MAX && chars_per_line == UINT_MAX))
{
fputs (linebuffer, stream);
while (*lineptr)
{
/* Possible new page. */
- if (lines_printed >= lines_per_page - 1)
+ if (filter &&
+ (lines_printed >= lines_per_page - 1))
prompt_for_continue ();
while (*lineptr && *lineptr != '\n')
}
}
+void
+fputs_filtered (linebuffer, stream)
+ const char *linebuffer;
+ FILE *stream;
+{
+ fputs_maybe_filtered (linebuffer, stream, 1);
+}
+
+void
+fputs_unfiltered (linebuffer, stream)
+ const char *linebuffer;
+ FILE *stream;
+{
+ fputs_maybe_filtered (linebuffer, stream, 0);
+}
+
+void
+putc_unfiltered (c)
+ int c;
+{
+ char buf[2];
+ buf[0] = c;
+ buf[1] = 0;
+ fputs_unfiltered (buf, gdb_stdout);
+}
+
+void
+fputc_unfiltered (c, stream)
+ int c;
+ FILE * stream;
+{
+ char buf[2];
+ buf[0] = c;
+ buf[1] = 0;
+ fputs_unfiltered (buf, stream);
+}
+
+
/* Print a variable number of ARGS using format FORMAT. If this
information is going to put the amount written (since the last call
to REINITIALIZE_MORE_FILTER or the last page break) over the page size,
#define MIN_LINEBUF 255
-void
-vfprintf_filtered (stream, format, args)
+static void
+vfprintf_maybe_filtered (stream, format, args, filter)
FILE *stream;
char *format;
va_list args;
+ int filter;
{
char line_buf[MIN_LINEBUF+10];
char *linebuffer = line_buf;
followed. */
vsprintf (linebuffer, format, args);
- fputs_filtered (linebuffer, stream);
+ fputs_maybe_filtered (linebuffer, stream, filter);
+}
+
+
+void
+vfprintf_filtered (stream, format, args)
+ FILE *stream;
+ char *format;
+ va_list args;
+{
+ vfprintf_maybe_filtered (stream, format, args, 1);
+}
+
+void
+vfprintf_unfiltered (stream, format, args)
+ FILE *stream;
+ char *format;
+ va_list args;
+{
+ vfprintf_maybe_filtered (stream, format, args, 0);
}
void
char *format;
va_list args;
{
- vfprintf_filtered (stdout, format, args);
+ vfprintf_maybe_filtered (gdb_stdout, format, args, 1);
+}
+
+void
+vprintf_unfiltered (format, args)
+ char *format;
+ va_list args;
+{
+ vfprintf_maybe_filtered (gdb_stdout, format, args, 0);
}
/* VARARGS */
va_end (args);
}
+/* VARARGS */
+void
+fprintf_unfiltered (va_alist)
+ va_dcl
+{
+ va_list args;
+ FILE *stream;
+ char *format;
+
+ va_start (args);
+ stream = va_arg (args, FILE *);
+ format = va_arg (args, char *);
+
+ /* This won't blow up if the restrictions described above are
+ followed. */
+ vfprintf_unfiltered (stream, format, args);
+ va_end (args);
+}
+
/* Like fprintf_filtered, but prints it's result indent.
- Called as fprintfi_filtered (spaces, format, arg1, arg2, ...); */
+ Called as fprintfi_filtered (spaces, stream, format, ...); */
/* VARARGS */
void
va_end (args);
}
+
/* VARARGS */
void
printf_filtered (va_alist)
va_start (args);
format = va_arg (args, char *);
- vfprintf_filtered (stdout, format, args);
+ vfprintf_filtered (gdb_stdout, format, args);
+ va_end (args);
+}
+
+
+/* VARARGS */
+void
+printf_unfiltered (va_alist)
+ va_dcl
+{
+ va_list args;
+ char *format;
+
+ va_start (args);
+ format = va_arg (args, char *);
+
+ vfprintf_unfiltered (gdb_stdout, format, args);
va_end (args);
}
/* Like printf_filtered, but prints it's result indented.
- Called as printfi_filtered (spaces, format, arg1, arg2, ...); */
+ Called as printfi_filtered (spaces, format, ...); */
/* VARARGS */
void
va_start (args);
spaces = va_arg (args, int);
format = va_arg (args, char *);
- print_spaces_filtered (spaces, stdout);
- vfprintf_filtered (stdout, format, args);
+ print_spaces_filtered (spaces, gdb_stdout);
+ vfprintf_filtered (gdb_stdout, format, args);
va_end (args);
}
puts_filtered (string)
char *string;
{
- fputs_filtered (string, stdout);
+ fputs_filtered (string, gdb_stdout);
+}
+
+void
+puts_unfiltered (string)
+ char *string;
+{
+ fputs_unfiltered (string, gdb_stdout);
}
/* Return a pointer to N spaces and a null. The pointer is good
#endif
#endif
/* If the output is not a terminal, don't paginate it. */
- if (!ISATTY (stdout))
+ if (!ISATTY (gdb_stdout))
lines_per_page = UINT_MAX;
set_width_command ((char *)NULL, 0, c);
/* Prototypes for local functions */
static void
-print_hex_chars PARAMS ((FILE *, unsigned char *, unsigned int));
+print_hex_chars PARAMS ((GDB_FILE *, unsigned char *, unsigned int));
static void
show_print PARAMS ((char *, int));
set_output_radix_1 PARAMS ((int, unsigned));
static void
-value_print_array_elements PARAMS ((value, FILE *, int, enum val_prettyprint));
+value_print_array_elements PARAMS ((value, GDB_FILE *, int, enum val_prettyprint));
/* Maximum number of chars to print for a string pointer value or vector
contents, or UINT_MAX for no limit. Note that "set print elements 0"
struct type *type;
char *valaddr;
CORE_ADDR address;
- FILE *stream;
+ GDB_FILE *stream;
int format;
int deref_ref;
int recurse;
if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
{
fprintf_filtered (stream, "<incomplete type>");
- fflush (stream);
+ gdb_flush (stream);
return (0);
}
int
value_print (val, stream, format, pretty)
value val;
- FILE *stream;
+ GDB_FILE *stream;
int format;
enum val_prettyprint pretty;
{
val_print_type_code_int (type, valaddr, stream)
struct type *type;
char *valaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
char *p;
/* Pointer to first (i.e. lowest address) nonzero character. */
p++)
#else /* Little endian. */
first_addr = valaddr;
- for (p = valaddr + TYPE_LENGTH (type);
+ for (p = valaddr + TYPE_LENGTH (type) - 1;
len > sizeof (LONGEST) && p >= valaddr;
p--)
#endif /* Little endian. */
void
print_longest (stream, format, use_local, val_long)
- FILE *stream;
+ GDB_FILE *stream;
int format;
int use_local;
LONGEST val_long;
if ((format == 'd' && (val_long < INT_MIN || val_long > INT_MAX))
|| ((format == 'u' || format == 'x') && val_long > UINT_MAX))
{
- fprintf_filtered (stream, "0x%x%08x", vtop, vbot);
+ fprintf_filtered (stream, "0x%lx%08lx", vtop, vbot);
return;
}
#endif
print_floating (valaddr, type, stream)
char *valaddr;
struct type *type;
- FILE *stream;
+ GDB_FILE *stream;
{
double doub;
int inv;
representation, but is not IEEE conforming. */
{
- long low, high;
+ unsigned long low, high;
/* Is the sign bit 0? */
int nonnegative;
/* Is it is a NaN (i.e. the exponent is all ones and
the fraction is nonzero)? */
int is_nan;
- if (len == sizeof (float))
+ if (len == 4)
{
- /* It's single precision. */
- memcpy ((char *) &low, valaddr, sizeof (low));
- /* target -> host. */
- SWAP_TARGET_AND_HOST (&low, sizeof (float));
+ /* It's single precision. */
+ /* Assume that floating point byte order is the same as
+ integer byte order. */
+ low = extract_unsigned_integer (valaddr, 4);
nonnegative = low >= 0;
is_nan = ((((low >> 23) & 0xFF) == 0xFF)
&& 0 != (low & 0x7FFFFF));
low &= 0x7fffff;
high = 0;
}
- else
+ else if (len == 8)
{
/* It's double precision. Get the high and low words. */
+ /* Assume that floating point byte order is the same as
+ integer byte order. */
#if TARGET_BYTE_ORDER == BIG_ENDIAN
- memcpy (&low, valaddr+4, sizeof (low));
- memcpy (&high, valaddr+0, sizeof (high));
+ low = extract_unsigned_integer (valaddr + 4, 4);
+ high = extract_unsigned_integer (valaddr, 4);
#else
- memcpy (&low, valaddr+0, sizeof (low));
- memcpy (&high, valaddr+4, sizeof (high));
+ low = extract_unsigned_integer (valaddr, 4);
+ high = extract_unsigned_integer (valaddr + 4, 4);
#endif
- SWAP_TARGET_AND_HOST (&low, sizeof (low));
- SWAP_TARGET_AND_HOST (&high, sizeof (high));
nonnegative = high >= 0;
is_nan = (((high >> 20) & 0x7ff) == 0x7ff
&& ! ((((high & 0xfffff) == 0)) && (low == 0)));
high &= 0xfffff;
}
+ else
+ /* Extended. We can't detect NaNs for extendeds yet. Also note
+ that currently extendeds get nuked to double in
+ REGISTER_CONVERTIBLE. */
+ is_nan = 0;
if (is_nan)
{
static void
print_hex_chars (stream, valaddr, len)
- FILE *stream;
+ GDB_FILE *stream;
unsigned char *valaddr;
unsigned len;
{
struct type *type;
char *valaddr;
CORE_ADDR address;
- FILE *stream;
+ GDB_FILE *stream;
int format;
int deref_ref;
int recurse;
static void
value_print_array_elements (val, stream, format, pretty)
value val;
- FILE *stream;
+ GDB_FILE *stream;
int format;
enum val_prettyprint pretty;
{
val_print (VALUE_TYPE (val), VALUE_CONTENTS (val) + typelen * i,
VALUE_ADDRESS (val) + typelen * i, stream, format, 1,
0, pretty);
- fprintf (stream, " <repeats %u times>", reps);
+ fprintf_unfiltered (stream, " <repeats %u times>", reps);
i = rep1 - 1;
things_printed += repeat_count_threshold;
}
val_print_string (addr, len, stream)
CORE_ADDR addr;
unsigned int len;
- FILE *stream;
+ GDB_FILE *stream;
{
- int first_addr_err = 0; /* Nonzero if first address out of bounds. */
int force_ellipsis = 0; /* Force ellipsis to be printed if nonzero. */
int errcode; /* Errno returned from bad reads. */
unsigned int fetchlimit; /* Maximum number of bytes to fetch. */
char *buffer = NULL; /* Dynamically growable fetch buffer. */
char *bufptr; /* Pointer to next available byte in buffer. */
char *limit; /* First location past end of fetch buffer. */
- struct cleanup *old_chain; /* Top of the old cleanup chain. */
+ struct cleanup *old_chain = NULL; /* Top of the old cleanup chain. */
char peekchar; /* Place into which we can read one char. */
/* First we need to figure out the limit on the number of characters we are
{
if (errcode == EIO)
{
- fprintf_filtered (stream, " <Address 0x%x out of bounds>", addr);
+ fprintf_filtered (stream,
+ " <Address 0x%lx out of bounds>",
+ (unsigned long) addr);
}
else
{
- error ("Error reading memory address 0x%x: %s.", addr,
+ error ("Error reading memory address 0x%lx: %s.",
+ (unsigned long) addr,
safe_strerror (errcode));
}
}
- fflush (stream);
+ gdb_flush (stream);
do_cleanups (old_chain);
return (bufptr - buffer);
}
char *arg;
int from_tty;
{
- printf (
+ printf_unfiltered (
"\"set print\" must be followed by the name of a print subcommand.\n");
- help_list (setprintlist, "set print ", -1, stdout);
+ help_list (setprintlist, "set print ", -1, gdb_stdout);
}
/*ARGSUSED*/
"Generic command for setting how things print.",
&setprintlist, "set print ", 0, &setlist);
add_alias_cmd ("p", "print", no_class, 1, &setlist);
- add_alias_cmd ("pr", "print", no_class, 1, &setlist); /* prefer set print
- to set prompt */
+ /* prefer set print to set prompt */
+ add_alias_cmd ("pr", "print", no_class, 1, &setlist);
+
add_prefix_cmd ("print", no_class, show_print,
"Generic command for showing print settings.",
&showprintlist, "show print ", 0, &showlist);
"Set default input radix for entering numbers.",
&setlist);
add_show_from_set (c, &showlist);
- c->function = set_input_radix;
+ c->function.sfunc = set_input_radix;
c = add_set_cmd ("output-radix", class_support, var_uinteger,
(char *)&output_radix,
"Set default output radix for printing of values.",
&setlist);
add_show_from_set (c, &showlist);
- c->function = set_output_radix;
+ c->function.sfunc = set_output_radix;
/* The "set radix" and "show radix" commands are special in that they are
like normal set and show commands but allow two normally independent
extern int output_format;
extern void
-val_print_array_elements PARAMS ((struct type *, char *, CORE_ADDR, FILE *,
+val_print_array_elements PARAMS ((struct type *, char *, CORE_ADDR, GDB_FILE *,
int, int, int, enum val_prettyprint, int));
extern void
-val_print_type_code_int PARAMS ((struct type *, char *, FILE *));
+val_print_type_code_int PARAMS ((struct type *, char *, GDB_FILE *));
{
val = access_value_history (i);
printf_filtered ("$%d = ", i);
- value_print (val, stdout, 0, Val_pretty_default);
+ value_print (val, gdb_stdout, 0, Val_pretty_default);
printf_filtered ("\n");
}
varseen = 1;
}
printf_filtered ("$%s = ", var->name);
- value_print (var->value, stdout, 0, Val_pretty_default);
+ value_print (var->value, gdb_stdout, 0, Val_pretty_default);
printf_filtered ("\n");
}
if (!varseen)
- printf ("No debugger convenience variables now defined.\n\
+ printf_unfiltered ("No debugger convenience variables now defined.\n\
Convenience variables have names starting with \"$\";\n\
use \"set\" as in \"set $foo = 5\" to define them.\n");
}
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
unsigned char buffer[MAXLEN];
register int i;
/* Handle undefined instructions. */
if (i == NOPCODES)
{
- fprintf (stream, "0%o", buffer[0]);
+ fprintf_unfiltered (stream, "0%o", buffer[0]);
return 1;
}
- fprintf (stream, "%s", votstrs[i].name);
+ fprintf_unfiltered (stream, "%s", votstrs[i].name);
/* Point at first byte of argument data,
and at descriptor for first argument. */
d = votstrs[i].detail.args;
if (*d)
- fputc (' ', stream);
+ fputc_unfiltered (' ', stream);
while (*d)
{
p = print_insn_arg (d, p, memaddr + (p - buffer), stream);
d += 2;
if (*d)
- fprintf (stream, ",");
+ fprintf_unfiltered (stream, ",");
}
return p - buffer;
}
char *d;
register char *p;
CORE_ADDR addr;
- FILE *stream;
+ GDB_FILE *stream;
{
register int regnum = *p & 0xf;
float floatlitbuf;
if (*d == 'b')
{
if (d[1] == 'b')
- fprintf (stream, "0x%x", addr + *p++ + 1);
+ fprintf_unfiltered (stream, "0x%x", addr + *p++ + 1);
else
{
- fprintf (stream, "0x%x", addr + *(short *)p + 2);
+ fprintf_unfiltered (stream, "0x%x", addr + *(short *)p + 2);
p += 2;
}
}
if (d[1] == 'd' || d[1] == 'f' || d[1] == 'g' || d[1] == 'h')
{
*(int *)&floatlitbuf = 0x4000 + ((p[-1] & 0x3f) << 4);
- fprintf (stream, "$%f", floatlitbuf);
+ fprintf_unfiltered (stream, "$%f", floatlitbuf);
}
else
- fprintf (stream, "$%d", p[-1] & 0x3f);
+ fprintf_unfiltered (stream, "$%d", p[-1] & 0x3f);
break;
case 4: /* Indexed */
p = (char *) print_insn_arg (d, p, addr + 1, stream);
- fprintf (stream, "[%s]", reg_names[regnum]);
+ fprintf_unfiltered (stream, "[%s]", reg_names[regnum]);
break;
case 5: /* Register */
- fprintf (stream, reg_names[regnum]);
+ fprintf_unfiltered (stream, reg_names[regnum]);
break;
case 7: /* Autodecrement */
- fputc ('-', stream);
+ fputc_unfiltered ('-', stream);
case 6: /* Register deferred */
- fprintf (stream, "(%s)", reg_names[regnum]);
+ fprintf_unfiltered (stream, "(%s)", reg_names[regnum]);
break;
case 9: /* Autoincrement deferred */
- fputc ('@', stream);
+ fputc_unfiltered ('@', stream);
if (regnum == PC_REGNUM)
{
- fputc ('#', stream);
+ fputc_unfiltered ('#', stream);
print_address (*(long *)p, stream);
p += 4;
break;
case 8: /* Autoincrement */
if (regnum == PC_REGNUM)
{
- fputc ('#', stream);
+ fputc_unfiltered ('#', stream);
switch (d[1])
{
case 'b':
- fprintf (stream, "%d", *p++);
+ fprintf_unfiltered (stream, "%d", *p++);
break;
case 'w':
- fprintf (stream, "%d", *(short *)p);
+ fprintf_unfiltered (stream, "%d", *(short *)p);
p += 2;
break;
case 'l':
- fprintf (stream, "%d", *(long *)p);
+ fprintf_unfiltered (stream, "%d", *(long *)p);
p += 4;
break;
case 'q':
- fprintf (stream, "0x%x%08x", ((long *)p)[1], ((long *)p)[0]);
+ fprintf_unfiltered (stream, "0x%x%08x", ((long *)p)[1], ((long *)p)[0]);
p += 8;
break;
case 'o':
- fprintf (stream, "0x%x%08x%08x%08x",
+ fprintf_unfiltered (stream, "0x%x%08x%08x%08x",
((long *)p)[3], ((long *)p)[2],
((long *)p)[1], ((long *)p)[0]);
p += 16;
case 'f':
if (INVALID_FLOAT (p, 4))
- fprintf (stream, "<<invalid float 0x%x>>", *(int *) p);
+ fprintf_unfiltered (stream, "<<invalid float 0x%x>>", *(int *) p);
else
- fprintf (stream, "%f", *(float *) p);
+ fprintf_unfiltered (stream, "%f", *(float *) p);
p += 4;
break;
case 'd':
if (INVALID_FLOAT (p, 8))
- fprintf (stream, "<<invalid float 0x%x%08x>>",
+ fprintf_unfiltered (stream, "<<invalid float 0x%x%08x>>",
((long *)p)[1], ((long *)p)[0]);
else
- fprintf (stream, "%f", *(double *) p);
+ fprintf_unfiltered (stream, "%f", *(double *) p);
p += 8;
break;
case 'g':
- fprintf (stream, "g-float");
+ fprintf_unfiltered (stream, "g-float");
p += 8;
break;
case 'h':
- fprintf (stream, "h-float");
+ fprintf_unfiltered (stream, "h-float");
p += 16;
break;
}
}
else
- fprintf (stream, "(%s)+", reg_names[regnum]);
+ fprintf_unfiltered (stream, "(%s)+", reg_names[regnum]);
break;
case 11: /* Byte displacement deferred */
- fputc ('@', stream);
+ fputc_unfiltered ('@', stream);
case 10: /* Byte displacement */
if (regnum == PC_REGNUM)
print_address (addr + *p + 2, stream);
else
- fprintf (stream, "%d(%s)", *p, reg_names[regnum]);
+ fprintf_unfiltered (stream, "%d(%s)", *p, reg_names[regnum]);
p += 1;
break;
case 13: /* Word displacement deferred */
- fputc ('@', stream);
+ fputc_unfiltered ('@', stream);
case 12: /* Word displacement */
if (regnum == PC_REGNUM)
print_address (addr + *(short *)p + 3, stream);
else
- fprintf (stream, "%d(%s)", *(short *)p, reg_names[regnum]);
+ fprintf_unfiltered (stream, "%d(%s)", *(short *)p, reg_names[regnum]);
p += 2;
break;
case 15: /* Long displacement deferred */
- fputc ('@', stream);
+ fputc_unfiltered ('@', stream);
case 14: /* Long displacement */
if (regnum == PC_REGNUM)
print_address (addr + *(long *)p + 5, stream);
else
- fprintf (stream, "%d(%s)", *(long *)p, reg_names[regnum]);
+ fprintf_unfiltered (stream, "%d(%s)", *(long *)p, reg_names[regnum]);
p += 4;
}
else {
exec_close(0); /* just in case */
if (from_tty)
- printf("No exec file now.\n");
+ printf_unfiltered("No exec file now.\n");
}
}
}
else if (STREQ(bfd_section_name(bf, sex), ".bss")) /* FIXMEmgo */
- printf ("bss section in exec! Don't know what the heck to do!\n");
+ printf_unfiltered ("bss section in exec! Don't know what the heck to do!\n");
}
/* Make a vmap for the BFD "bf", which might be a member of the archive
if (!vp)
return;
- printf("\tMapping info for file `%s'.\n", vp->name);
+ printf_unfiltered("\tMapping info for file `%s'.\n", vp->name);
- printf("\t %8.8s %8.8s %8.8s %8.8s %8.8s %s\n",
+ printf_unfiltered("\t %8.8s %8.8s %8.8s %8.8s %8.8s %s\n",
"tstart", "tend", "dstart", "dend", "section", "file(member)");
for (; vp; vp = vp->nxt)
- printf("\t0x%8.8x 0x%8.8x 0x%8.8x 0x%8.8x %s%s%s%s\n",
+ printf_unfiltered("\t0x%8.8x 0x%8.8x 0x%8.8x 0x%8.8x %s%s%s%s\n",
vp->tstart,
vp->tend,
vp->dstart,
if (ldinfo_sec == NULL)
{
bfd_err:
- fprintf_filtered (stderr, "Couldn't get ldinfo from core file: %s\n",
+ fprintf_filtered (gdb_stderr, "Couldn't get ldinfo from core file: %s\n",
bfd_errmsg (bfd_error));
do_cleanups (old);
return;
abfd, textsec, buffer,
(file_ptr)(functionstart +
bytesread - (buffer + bufferbytes - (char*)pinsn)),MIN_TBTABSIZ))
- { printf ("Abnormal return!..\n"); return NULL; }
+ { printf_unfiltered ("Abnormal return!..\n"); return NULL; }
ptb = (struct tbtable *)buffer;
}
abfd, textsec, buffer,
(file_ptr)(functionstart +
bytesread - (buffer + bufferbytes - pinsn)),MIN_TBTABSIZ))
- /* abort (); */ { printf ("abort!!!\n"); return NULL; }
+ /* abort (); */ { printf_unfiltered ("abort!!!\n"); return NULL; }
return (struct tbtable *)buffer;
}
textsec = bfd_get_section_by_name (abfd, ".text");
if (!textsec) {
- printf ("Unable to locate text section!\n");
+ printf_unfiltered ("Unable to locate text section!\n");
}
while (symnum < nsyms) {
case C_STRTAG :
case C_UNTAG :
case C_ENTAG :
- printf ("ERROR: Unimplemented storage class: %d.\n", cs->c_sclass);
+ printf_unfiltered ("ERROR: Unimplemented storage class: %d.\n", cs->c_sclass);
break;
case C_HIDEXT : /* ignore these.. */
break;
case C_REG:
- printf ("ERROR! C_REG is not fully implemented!\n");
+ printf_unfiltered ("ERROR! C_REG is not fully implemented!\n");
SYMBOL_CLASS (sym) = LOC_REGISTER;
SYMBOL_NAME (sym) = SYMNAME_ALLOC (name, symname_alloced);
SYMBOL_SECTION (sym) = cs->c_secnum;
#undef next_symbol_text
#define next_symbol_text() \
- printf ("Gdb Error: symbol names on multiple lines not implemented.\n")
+ printf_unfiltered ("Gdb Error: symbol names on multiple lines not implemented.\n")
static void
return -1;
if (!bfd_get_section_contents(abfd, secp, debugsec, (file_ptr) 0, length)) {
- printf ("Can't read .debug section from symbol file\n");
+ printf_unfiltered ("Can't read .debug section from symbol file\n");
return -1;
}
return 0;
/* if already loaded, continue with the next one. */
if (vp->loaded) {
- printf ("%s%s%s%s: already loaded.\n",
+ printf_unfiltered ("%s%s%s%s: already loaded.\n",
*vp->member ? "(" : "",
vp->member,
*vp->member ? ") " : "",
continue;
}
- printf ("Loading %s%s%s%s...",
+ printf_unfiltered ("Loading %s%s%s%s...",
*vp->member ? "(" : "",
vp->member,
*vp->member ? ") " : "",
vp->name);
- fflush (stdout);
+ gdb_flush (gdb_stdout);
/* This is gross and doesn't work. If this code is re-enabled,
just stick a objfile member into the struct vmap; that's the
syms_from_objfile (obj, 0, 0, 0);
new_symfile_objfile (obj, 0, 0);
vmap_symtab (vp, 0, 0);
- printf ("Done.\n");
+ printf_unfiltered ("Done.\n");
loaded = vp->loaded = 1;
}
}
/* reinit_frame_cache(); */
}
else if (!matched)
- printf ("No matching shared object found.\n");
+ printf_unfiltered ("No matching shared object found.\n");
}
#endif /* SOLIB_SYMBOLS_MANUAL */
struct vmap *vp = vmap;
if (!vp || !vp->nxt) {
- printf("No shared libraries loaded at this time.\n");
+ printf_unfiltered("No shared libraries loaded at this time.\n");
return;
}
/* skip over the first vmap, it is the main program, always loaded. */
vp = vp->nxt;
- printf ("\
+ printf_unfiltered ("\
Text Range Data Range Syms Shared Object Library\n");
for (; vp; vp = vp->nxt) {
- printf ("0x%08x-0x%08x 0x%08x-0x%08x %s %s%s%s%s\n",
+ printf_unfiltered ("0x%08x-0x%08x 0x%08x-0x%08x %s %s%s%s%s\n",
vp->tstart, vp->tend,
vp->dstart, vp->dend,
vp->loaded ? "Yes" : "No ",
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
read_relative_register_raw_bytes (regno, (char *) (l + 0));
read_relative_register_raw_bytes (regno + 1, (char *) (l + 1));
- printf ("\t");
- printf ("%04x%04x", l[0], l[1]);
+ printf_unfiltered ("\t");
+ printf_unfiltered ("%04x%04x", l[0], l[1]);
}
if ((regno & 3) == 0 && regno < 16)
read_relative_register_raw_bytes (regno + 2, (char *) (l + 2));
read_relative_register_raw_bytes (regno + 3, (char *) (l + 3));
- printf ("\t");
- printf ("%04x%04x%04x%04x", l[0], l[1], l[2], l[3]);
+ printf_unfiltered ("\t");
+ printf_unfiltered ("%04x%04x%04x%04x", l[0], l[1], l[2], l[3]);
}
if (regno == 15)
{
read_relative_register_raw_bytes (regno, (char *) (&rval));
- printf ("\n");
+ printf_unfiltered ("\n");
for (i = 0; i < 10; i += 2)
{
- printf ("(sp+%d=%04x)", i, read_memory_short (rval + i));
+ printf_unfiltered ("(sp+%d=%04x)", i, read_memory_short (rval + i));
}
}
if (oldsize != newsize)
{
- printf ("pointer size set to %d bits\n", newsize);
+ printf_unfiltered ("pointer size set to %d bits\n", newsize);
oldsize = newsize;
if (newsize == 32)
{
char *args;
int from_tty;
{
- printf ("\"set memory\" must be followed by the name of a memory subcommand.\n");
- help_list (setmemorylist, "set memory ", -1, stdout);
+ printf_unfiltered ("\"set memory\" must be followed by the name of a memory subcommand.\n");
+ help_list (setmemorylist, "set memory ", -1, gdb_stdout);
}
void