aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/.gdbinit1
-rw-r--r--gdb/ChangeLog26
-rw-r--r--gdb/a29k-pinsn.c2
-rw-r--r--gdb/a29k-tdep.c20
-rw-r--r--gdb/a68v-nat.c2
-rw-r--r--gdb/alpha-tdep.c2
-rw-r--r--gdb/altos-xdep.c4
-rw-r--r--gdb/breakpoint.c142
-rw-r--r--gdb/c-lang.c8
-rw-r--r--gdb/c-lang.h4
-rw-r--r--gdb/c-typeprint.c30
-rw-r--r--gdb/c-valprint.c14
-rw-r--r--gdb/ch-exp.y2
-rw-r--r--gdb/ch-lang.c4
-rw-r--r--gdb/ch-lang.h4
-rw-r--r--gdb/ch-typeprint.c6
-rw-r--r--gdb/ch-valprint.c8
-rw-r--r--gdb/command.c56
-rw-r--r--gdb/complaints.c2
-rw-r--r--gdb/corelow.c4
-rw-r--r--gdb/cp-valprint.c20
-rw-r--r--gdb/dbxread.c12
-rw-r--r--gdb/delta68-nat.c2
-rw-r--r--gdb/demangle.c6
-rw-r--r--gdb/doc/ChangeLog2
-rw-r--r--gdb/doc/libgdb.texinfo2
-rw-r--r--gdb/dstread.c8
-rw-r--r--gdb/dwarfread.c12
-rwxr-xr-xgdb/energize-patches2
-rw-r--r--gdb/energize.c2
-rw-r--r--gdb/fork-child.c8
-rw-r--r--gdb/gdbtypes.c16
-rw-r--r--gdb/gdbtypes.h2
-rw-r--r--gdb/go32-xdep.c2
-rw-r--r--gdb/h8300-tdep.c40
-rw-r--r--gdb/h8500-tdep.c40
-rw-r--r--gdb/hppa-pinsn.c2
-rw-r--r--gdb/hppa-tdep.c18
-rw-r--r--gdb/i386-nlmstub.c28
-rw-r--r--gdb/i386-pinsn.c2
-rw-r--r--gdb/i386aix-nat.c36
-rw-r--r--gdb/i386lynx-nat.c284
-rw-r--r--gdb/i386m3-nat.c40
-rw-r--r--gdb/i386v-nat.c2
-rw-r--r--gdb/i387-tdep.c64
-rw-r--r--gdb/i960-pinsn.c2
-rw-r--r--gdb/i960-tdep.c6
-rw-r--r--gdb/infcmd.c18
-rw-r--r--gdb/inflow.c12
-rw-r--r--gdb/infrun.c29
-rw-r--r--gdb/infrun.hacked.c10
-rw-r--r--gdb/language.c48
-rw-r--r--gdb/language.h8
-rw-r--r--gdb/m2-exp.y2
-rw-r--r--gdb/m2-lang.c8
-rw-r--r--gdb/m2-lang.h4
-rw-r--r--gdb/m2-typeprint.c4
-rw-r--r--gdb/m2-valprint.c4
-rw-r--r--gdb/m3-nat.c26
-rw-r--r--gdb/m68k-pinsn.c2
-rw-r--r--gdb/m88k-nat.c2
-rw-r--r--gdb/m88k-pinsn.c2
-rw-r--r--gdb/m88k-tdep.c2
-rw-r--r--gdb/main.c81
-rw-r--r--gdb/maint.c18
-rw-r--r--gdb/mips-pinsn.c2
-rw-r--r--gdb/mips-tdep.c19
-rw-r--r--gdb/objfiles.c4
-rw-r--r--gdb/osfsolib.c16
-rw-r--r--gdb/parse.c4
-rw-r--r--gdb/partial-stab.h4
-rw-r--r--gdb/printcmd.c395
-rw-r--r--gdb/procfs.c40
-rw-r--r--gdb/pyr-pinsn.c48
-rw-r--r--gdb/pyr-tdep.c8
-rw-r--r--gdb/pyr-xdep.c20
-rw-r--r--gdb/regex.c34
-rw-r--r--gdb/remote-hms.c16
-rw-r--r--gdb/remote-mips.c10
-rw-r--r--gdb/remote-mm.c2
-rw-r--r--gdb/remote-nindy.c10
-rw-r--r--gdb/remote-sim.c2
-rw-r--r--gdb/remote-udi.c66
-rw-r--r--gdb/remote-utils.c14
-rw-r--r--gdb/remote-vx.c28
-rw-r--r--gdb/remote-z8k.c2
-rw-r--r--gdb/remote.c14
-rw-r--r--gdb/rs6000-nat.c6
-rw-r--r--gdb/rs6000-pinsn.c78
-rw-r--r--gdb/rs6000-tdep.c8
-rw-r--r--gdb/ser-go32.c2
-rw-r--r--gdb/ser-tcp.c2
-rw-r--r--gdb/ser-unix.c8
-rw-r--r--gdb/serial.c6
-rw-r--r--gdb/sh-tdep.c2
-rw-r--r--gdb/source.c37
-rw-r--r--gdb/sp64-tdep.c12
-rw-r--r--gdb/sparc-nat.c8
-rw-r--r--gdb/sparc-pinsn.c2
-rw-r--r--gdb/stack.c73
-rw-r--r--gdb/stuff.c2
-rw-r--r--gdb/sun3-nat.c2
-rw-r--r--gdb/sun386-nat.c6
-rw-r--r--gdb/symfile.c10
-rw-r--r--gdb/symm-nat.c118
-rw-r--r--gdb/symtab.c44
-rw-r--r--gdb/tahoe-pinsn.c52
-rw-r--r--gdb/typeprint.c10
-rw-r--r--gdb/typeprint.h2
-rw-r--r--gdb/ultra3-nat.c2
-rw-r--r--gdb/ultra3-xdep.c2
-rw-r--r--gdb/umax-xdep.c6
-rw-r--r--gdb/utils.c220
-rw-r--r--gdb/valprint.c86
-rw-r--r--gdb/valprint.h4
-rw-r--r--gdb/values.c6
-rw-r--r--gdb/vax-pinsn.c70
-rw-r--r--gdb/xcoffexec.c12
-rw-r--r--gdb/xcoffread.c14
-rw-r--r--gdb/xcoffsolib.c16
-rw-r--r--gdb/z8k-tdep.c20
121 files changed, 1751 insertions, 1236 deletions
diff --git a/gdb/.gdbinit b/gdb/.gdbinit
index 0bf56a6..51d03a4 100644
--- a/gdb/.gdbinit
+++ b/gdb/.gdbinit
@@ -14,3 +14,4 @@ dir ../mmalloc
dir ../libiberty
dir ../bfd
set prompt (top-gdb)
+source /.gdbinit
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 26e82d6..a3b59d6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -217,6 +217,32 @@ Mon Oct 25 14:57:45 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* 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
diff --git a/gdb/a29k-pinsn.c b/gdb/a29k-pinsn.c
index 867a1d0..a90cdc0 100644
--- a/gdb/a29k-pinsn.c
+++ b/gdb/a29k-pinsn.c
@@ -27,7 +27,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
diff --git a/gdb/a29k-tdep.c b/gdb/a29k-tdep.c
index f5843b4..88b630a 100644
--- a/gdb/a29k-tdep.c
+++ b/gdb/a29k-tdep.c
@@ -830,36 +830,36 @@ a29k_get_processor_type ()
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
diff --git a/gdb/a68v-nat.c b/gdb/a68v-nat.c
index 8e4000e..1829812 100644
--- a/gdb/a68v-nat.c
+++ b/gdb/a68v-nat.c
@@ -129,7 +129,7 @@ fetch_core_registers (core_reg_sect, core_reg_size, which)
#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. */
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index adaec4b..51f167b 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -919,7 +919,7 @@ alpha_store_return_value (valtype, valbuf)
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
diff --git a/gdb/altos-xdep.c b/gdb/altos-xdep.c
index ce2a5a7..4284860 100644
--- a/gdb/altos-xdep.c
+++ b/gdb/altos-xdep.c
@@ -116,7 +116,7 @@ core_file_command (filename, from_tty)
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. */
@@ -161,5 +161,5 @@ core_file_command (filename, from_tty)
validate_files ();
}
else if (from_tty)
- printf ("No core file now.\n");
+ printf_unfiltered ("No core file now.\n");
}
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 2db3753..e078064 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -30,6 +30,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "ctype.h"
#include "command.h"
#include "inferior.h"
+#include "thread.h"
#include "target.h"
#include "language.h"
#include <string.h>
@@ -449,7 +450,7 @@ insert_breakpoints ()
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");
}
@@ -459,9 +460,9 @@ insert_breakpoints ()
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 */
@@ -482,7 +483,7 @@ remove_breakpoints ()
int val;
#ifdef BREAKPOINT_DEBUG
- printf ("Removing breakpoints.\n");
+ printf_unfiltered ("Removing breakpoints.\n");
#endif /* BREAKPOINT_DEBUG */
ALL_BREAKPOINTS (b)
@@ -493,11 +494,11 @@ remove_breakpoints ()
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 */
}
@@ -552,6 +553,29 @@ breakpoint_here_p (pc)
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;
+}
+
/* bpstat stuff. External routines' interfaces are documented
in breakpoint.h. */
@@ -740,11 +764,11 @@ print_it_normal (bs)
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);
@@ -1406,7 +1430,7 @@ breakpoint_1 (bnum, allflag)
switch (b->type)
{
case bp_watchpoint:
- print_expression (b->exp, stdout);
+ print_expression (b->exp, gdb_stdout);
break;
case bp_breakpoint:
@@ -1425,16 +1449,16 @@ breakpoint_1 (bnum, allflag)
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;
}
@@ -1446,7 +1470,7 @@ breakpoint_1 (bnum, allflag)
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)
@@ -1454,9 +1478,9 @@ breakpoint_1 (bnum, allflag)
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;
}
}
@@ -1521,17 +1545,17 @@ describe_other_breakpoints (pc)
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));
}
}
@@ -1597,6 +1621,7 @@ set_raw_breakpoint (sal)
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;
@@ -1761,7 +1786,7 @@ mention (b)
{
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,
@@ -1775,6 +1800,7 @@ mention (b)
case bp_longjmp:
case bp_longjmp_resume:
case bp_step_resume:
+ case bp_call_dummy:
break;
}
printf_filtered ("\n");
@@ -1841,8 +1867,8 @@ break_command_1 (arg, tempflag, from_tty)
struct cleanup *old_chain;
struct cleanup *canonical_strings_chain = NULL;
char **canonical = (char **)NULL;
-
int i;
+ int thread;
sals.sals = NULL;
sals.nelts = 0;
@@ -1904,21 +1930,48 @@ break_command_1 (arg, tempflag, from_tty)
}
}
+ 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.");
@@ -1942,6 +1995,7 @@ break_command_1 (arg, tempflag, from_tty)
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. */
@@ -1960,8 +2014,8 @@ break_command_1 (arg, tempflag, from_tty)
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);
}
@@ -2182,7 +2236,7 @@ map_catch_names (args, function)
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
@@ -2388,8 +2442,8 @@ catch_command_1 (arg, tempflag, from_tty)
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);
}
@@ -2503,15 +2557,15 @@ clear_command (arg, from_tty)
}
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);
}
@@ -2565,7 +2619,7 @@ delete_breakpoint (bpt)
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
@@ -2586,7 +2640,7 @@ delete_breakpoint (bpt)
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. */
@@ -2860,7 +2914,7 @@ map_breakpoint_numbers (args, function)
function (b);
goto win;
}
- printf ("No breakpoint number %d.\n", num);
+ printf_unfiltered ("No breakpoint number %d.\n", num);
win:
p = p1;
}
@@ -2876,7 +2930,7 @@ enable_breakpoint (bpt)
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)
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index ea07959..e152aa2 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -32,7 +32,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static void
emit_char (c, stream, quoter)
register int c;
- FILE *stream;
+ GDB_FILE *stream;
int quoter;
{
@@ -81,7 +81,7 @@ emit_char (c, stream, quoter)
static void
c_printchar (c, stream)
int c;
- FILE *stream;
+ GDB_FILE *stream;
{
fputs_filtered ("'", stream);
emit_char (c, stream, '\'');
@@ -95,7 +95,7 @@ c_printchar (c, stream)
static void
c_printstr (stream, string, length, force_ellipses)
- FILE *stream;
+ GDB_FILE *stream;
char *string;
unsigned int length;
int force_ellipses;
@@ -116,7 +116,7 @@ c_printstr (stream, string, length, force_ellipses)
if (length == 0)
{
- fputs_filtered ("\"\"", stdout);
+ fputs_filtered ("\"\"", gdb_stdout);
return;
}
diff --git a/gdb/c-lang.h b/gdb/c-lang.h
index 4c343a9..f176060 100644
--- a/gdb/c-lang.h
+++ b/gdb/c-lang.h
@@ -24,8 +24,8 @@ extern void
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));
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index fa4035b..33e6742 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -39,19 +39,19 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
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));
/* Print a description of a type in the format of a
@@ -62,7 +62,7 @@ void
c_typedef_print (type, new, stream)
struct type *type;
struct symbol *new;
- FILE *stream;
+ GDB_FILE *stream;
{
switch (current_language->la_language)
{
@@ -104,7 +104,7 @@ void
c_print_type (type, varstring, stream, show, level)
struct type *type;
char *varstring;
- FILE *stream;
+ GDB_FILE *stream;
int show;
int level;
{
@@ -145,7 +145,7 @@ cp_type_print_method_args (args, prefix, varstring, staticp, stream)
char *prefix;
char *varstring;
int staticp;
- FILE *stream;
+ GDB_FILE *stream;
{
int i;
@@ -199,7 +199,7 @@ cp_type_print_method_args (args, prefix, varstring, staticp, stream)
static void
cp_type_print_derivation_info (stream, type)
- FILE *stream;
+ GDB_FILE *stream;
struct type *type;
{
char *name;
@@ -231,7 +231,7 @@ cp_type_print_derivation_info (stream, type)
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;
{
@@ -266,7 +266,7 @@ c_type_print_varspec_prefix (type, stream, show, 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)
{
@@ -316,7 +316,7 @@ c_type_print_varspec_prefix (type, stream, show, passed_a_ptr)
static void
c_type_print_args (type, stream)
struct type *type;
- FILE *stream;
+ GDB_FILE *stream;
{
int i;
struct type **args;
@@ -358,7 +358,7 @@ c_type_print_args (type, stream)
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;
@@ -456,7 +456,7 @@ c_type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args)
void
c_type_print_base (type, stream, show, level)
struct type *type;
- FILE *stream;
+ GDB_FILE *stream;
int show;
int level;
{
@@ -665,7 +665,7 @@ c_type_print_base (type, stream, show, 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;
}
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index bcf0a28..be498df 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -32,13 +32,13 @@ extern int vtblprint; /* Controls printing of vtbl's */
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
@@ -53,11 +53,11 @@ cp_is_vtbl_member PARAMS ((struct type *));
/* 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 */
@@ -83,7 +83,7 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
struct type *type;
char *valaddr;
CORE_ADDR address;
- FILE *stream;
+ GDB_FILE *stream;
int format;
int deref_ref;
int recurse;
@@ -411,6 +411,6 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
default:
error ("Invalid C/C++ type code %d in symbol table.", TYPE_CODE (type));
}
- fflush (stream);
+ gdb_flush (stream);
return (0);
}
diff --git a/gdb/ch-exp.y b/gdb/ch-exp.y
index c544a4e..3900f77 100644
--- a/gdb/ch-exp.y
+++ b/gdb/ch-exp.y
@@ -1988,7 +1988,7 @@ void
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);
diff --git a/gdb/ch-lang.c b/gdb/ch-lang.c
index 2f74061..7779268 100644
--- a/gdb/ch-lang.c
+++ b/gdb/ch-lang.c
@@ -52,7 +52,7 @@ chill_demangle (mangled)
static void
chill_printchar (c, stream)
register int c;
- FILE *stream;
+ GDB_FILE *stream;
{
c &= 0xFF; /* Avoid sign bit follies */
@@ -79,7 +79,7 @@ chill_printchar (c, stream)
static void
chill_printstr (stream, string, length, force_ellipses)
- FILE *stream;
+ GDB_FILE *stream;
char *string;
unsigned int length;
int force_ellipses;
diff --git a/gdb/ch-lang.h b/gdb/ch-lang.h
index 13579d9..6646b05 100644
--- a/gdb/ch-lang.h
+++ b/gdb/ch-lang.h
@@ -24,8 +24,8 @@ extern void
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));
diff --git a/gdb/ch-typeprint.c b/gdb/ch-typeprint.c
index 06318b4..c6a3b30 100644
--- a/gdb/ch-typeprint.c
+++ b/gdb/ch-typeprint.c
@@ -37,13 +37,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#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;
{
@@ -70,7 +70,7 @@ chill_print_type (type, varstring, stream, show, level)
static void
chill_type_print_base (type, stream, show, level)
struct type *type;
- FILE *stream;
+ GDB_FILE *stream;
int show;
int level;
{
diff --git a/gdb/ch-valprint.c b/gdb/ch-valprint.c
index 3e7f18e..5f29b31 100644
--- a/gdb/ch-valprint.c
+++ b/gdb/ch-valprint.c
@@ -29,7 +29,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#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 **));
@@ -52,7 +52,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
struct type *type;
char *valaddr;
CORE_ADDR address;
- FILE *stream;
+ GDB_FILE *stream;
int format;
int deref_ref;
int recurse;
@@ -246,7 +246,7 @@ chill_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
c_val_print (type, valaddr, address, stream, format,
deref_ref, recurse, pretty);
}
- fflush (stream);
+ gdb_flush (stream);
return (0);
}
@@ -264,7 +264,7 @@ chill_print_value_fields (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;
diff --git a/gdb/command.c b/gdb/command.c
index abc2d84..de8bd2a 100644
--- a/gdb/command.c
+++ b/gdb/command.c
@@ -31,7 +31,7 @@ static void
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));
@@ -43,7 +43,7 @@ static 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
@@ -247,7 +247,7 @@ add_show_from_set (setcmd, list)
&& 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;
@@ -303,7 +303,7 @@ delete_cmd (name, list)
void
help_cmd (command, stream)
char *command;
- FILE *stream;
+ GDB_FILE *stream;
{
struct cmd_list_element *c;
extern struct cmd_list_element *cmdlist;
@@ -368,7 +368,7 @@ help_list (list, cmdtype, class, stream)
struct cmd_list_element *list;
char *cmdtype;
enum command_class class;
- FILE *stream;
+ GDB_FILE *stream;
{
int len;
char *cmdtype1, *cmdtype2;
@@ -409,7 +409,7 @@ Command name abbreviations are allowed if unambiguous.\n",
/* 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;
@@ -460,7 +460,7 @@ help_cmd_list (list, class, prefix, recurse, stream)
enum command_class class;
char *prefix;
int recurse;
- FILE *stream;
+ GDB_FILE *stream;
{
register struct cmd_list_element *c;
@@ -1111,52 +1111,52 @@ do_setshow_command (arg, from_tty, 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");
@@ -1178,9 +1178,9 @@ cmd_show_list (list, from_tty, prefix)
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);
}
}
@@ -1216,7 +1216,7 @@ shell_escape (arg, from_tty)
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);
}
@@ -1250,7 +1250,7 @@ make_command (arg, from_tty)
static void
show_user_1 (c, stream)
struct cmd_list_element *c;
- FILE *stream;
+ GDB_FILE *stream;
{
register struct command_line *cmdlines;
@@ -1283,14 +1283,14 @@ show_user (args, from_tty)
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);
}
}
}
diff --git a/gdb/complaints.c b/gdb/complaints.c
index 079ca5a..e441db4 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -112,7 +112,7 @@ complain (va_alist)
/* 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);
}
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 717a6ee..77a4d17 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -261,7 +261,7 @@ get_core_registers (regno)
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));
}
@@ -278,7 +278,7 @@ cant:
}
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));
}
}
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 47b38f8..cce1f19 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -33,20 +33,20 @@ int objectprint; /* Controls looking up an object's derived type
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;
@@ -56,7 +56,7 @@ 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 */
@@ -65,7 +65,7 @@ void
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;
@@ -136,7 +136,7 @@ cp_print_class_method (valaddr, type, stream)
{
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)
{
@@ -212,7 +212,7 @@ cp_print_value_fields (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;
@@ -325,7 +325,7 @@ static void
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;
@@ -411,7 +411,7 @@ void
cp_print_class_member (valaddr, domain, stream, prefix)
char *valaddr;
struct type *domain;
- FILE *stream;
+ GDB_FILE *stream;
char *prefix;
{
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index b3c08d1..2642b62 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -1254,7 +1254,7 @@ dbx_psymtab_to_symtab_1 (pst)
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;
}
@@ -1266,13 +1266,13 @@ dbx_psymtab_to_symtab_1 (pst)
/* 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]);
}
@@ -1311,7 +1311,7 @@ dbx_psymtab_to_symtab (pst)
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;
}
@@ -1323,7 +1323,7 @@ dbx_psymtab_to_symtab (pst)
if (info_verbose)
{
printf_filtered ("Reading in symbols for %s...", pst->filename);
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
sym_bfd = pst->objfile->obfd;
diff --git a/gdb/delta68-nat.c b/gdb/delta68-nat.c
index ab5fa80..65e303c 100644
--- a/gdb/delta68-nat.c
+++ b/gdb/delta68-nat.c
@@ -52,7 +52,7 @@ register_addr (regno, blockend)
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;
diff --git a/gdb/demangle.c b/gdb/demangle.c
index a134bb7..bf7ee47 100644
--- a/gdb/demangle.c
+++ b/gdb/demangle.c
@@ -127,13 +127,13 @@ set_demangling_command (ignore, from_tty)
{
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)
{
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index a3bd273..40800af 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -14,6 +14,8 @@ Wed Oct 27 00:25:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
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.
diff --git a/gdb/doc/libgdb.texinfo b/gdb/doc/libgdb.texinfo
index d699ec8..4fadcb2 100644
--- a/gdb/doc/libgdb.texinfo
+++ b/gdb/doc/libgdb.texinfo
@@ -436,7 +436,7 @@ place. The default vectors are called @code{default-input-vector},
@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
diff --git a/gdb/dstread.c b/gdb/dstread.c
index 64b68c6..38ea398 100644
--- a/gdb/dstread.c
+++ b/gdb/dstread.c
@@ -330,7 +330,7 @@ dst_symfile_read (objfile, section_offsets, mainline)
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);
@@ -707,10 +707,10 @@ get_dst_entry(buffer, ret_entry)
}
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
@@ -1115,7 +1115,7 @@ decode_dst_locstring(locstr, sym)
{
if (count++ == 100)
{
- fprintf(stderr, "Error reading locstring\n");
+ fprintf_unfiltered(gdb_stderr, "Error reading locstring\n");
break;
}
entry = (dst_loc_entry_t *) locstr;
diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c
index 5d19bf8..1d8931a 100644
--- a/gdb/dwarfread.c
+++ b/gdb/dwarfread.c
@@ -2364,14 +2364,14 @@ psymtab_to_symtab_1 (pst)
/* 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]);
}
@@ -2385,7 +2385,7 @@ psymtab_to_symtab_1 (pst)
{
printf_filtered ("%d DIE's, sorting...", diecount);
wrap_here ("");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
sort_symtab_syms (pst -> symtab);
do_cleanups (old_chain);
@@ -2435,7 +2435,7 @@ dwarf_psymtab_to_symtab (pst)
{
printf_filtered ("Reading in symbols for %s...",
pst -> filename);
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
psymtab_to_symtab_1 (pst);
@@ -2453,7 +2453,7 @@ dwarf_psymtab_to_symtab (pst)
if (info_verbose)
{
printf_filtered ("done.\n");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
}
}
diff --git a/gdb/energize-patches b/gdb/energize-patches
index 026f6e9..1797701 100755
--- a/gdb/energize-patches
+++ b/gdb/energize-patches
@@ -1619,7 +1619,7 @@
{
val_print (elttype, valaddr + i * eltlen,
***************
-*** 841,846 ****
+Sun Oct 24 23:48:55 1993*** 841,846 ****
--- 856,862 ----
recurse + 1, pretty);
things_printed++;
diff --git a/gdb/energize.c b/gdb/energize.c
index efee08e..afbfb04 100644
--- a/gdb/energize.c
+++ b/gdb/energize.c
@@ -693,7 +693,7 @@ execute_command_1(va_alist)
}
#ifdef KERNEL_RECORD
-FILE *kerout;
+GDB_FILE *kerout;
static int
kernel_record(fd, ptr, num)
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 62c7a3a..1529516 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -170,8 +170,8 @@ fork_inferior (exec_file, allargs, env, traceme_fun, init_trace_fun)
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 ();
@@ -228,9 +228,9 @@ fork_inferior (exec_file, allargs, env, traceme_fun, init_trace_fun)
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);
}
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index f346469..233cb7f 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -693,9 +693,9 @@ lookup_struct_elt_type (type, name, noerr)
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.");
}
@@ -743,11 +743,11 @@ lookup_struct_elt_type (type, name, noerr)
}
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 */
}
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 89cad6c..2ab0406 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -695,7 +695,7 @@ extern void recursive_dump_type PARAMS ((struct type *, int));
/* 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));
diff --git a/gdb/go32-xdep.c b/gdb/go32-xdep.c
index 884a437..c3a6374 100644
--- a/gdb/go32-xdep.c
+++ b/gdb/go32-xdep.c
@@ -21,7 +21,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static void uerror(char *s)
{
- fprintf(stderr, "Fatal: %s!\n");
+ fprintf_unfiltered(gdb_stderr, "Fatal: %s!\n");
exit(1);
}
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index e139174..862d1af 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -100,7 +100,7 @@ h8300_skip_prologue (start_pc)
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
GDB_INIT_DISASSEMBLE_INFO(info, stream);
@@ -415,8 +415,8 @@ set_machine (args, from_tty)
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
@@ -448,37 +448,37 @@ print_register_hook (regno)
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 ("<= ");
}
}
diff --git a/gdb/h8500-tdep.c b/gdb/h8500-tdep.c
index cda468c..75301e2 100644
--- a/gdb/h8500-tdep.c
+++ b/gdb/h8500-tdep.c
@@ -109,7 +109,7 @@ h8500_skip_prologue (start_pc)
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
GDB_INIT_DISASSEMBLE_INFO (info, stream);
@@ -397,36 +397,36 @@ print_register_hook (regno)
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 ("<= ");
}
}
@@ -600,7 +600,7 @@ h8500_set_pointer_size (newsize)
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)
{
@@ -639,8 +639,8 @@ set_memory (args, from_tty)
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] */
diff --git a/gdb/hppa-pinsn.c b/gdb/hppa-pinsn.c
index 00b6e47..cfb4c9a 100644
--- a/gdb/hppa-pinsn.c
+++ b/gdb/hppa-pinsn.c
@@ -28,7 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 92199ed..186a080 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -880,9 +880,9 @@ restore_pc_queue (fsr)
{
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;
}
}
@@ -1061,7 +1061,7 @@ pa_do_registers_info (regnum, fpregs)
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);
@@ -1075,7 +1075,7 @@ pa_print_registers (raw_regs, regnum, fpregs)
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],
@@ -1101,10 +1101,10 @@ pa_print_fp_reg (i)
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");
}
@@ -1211,11 +1211,11 @@ unwind_command (exp, from_tty)
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 */
diff --git a/gdb/i386-nlmstub.c b/gdb/i386-nlmstub.c
index 174a00b..e6d7355 100644
--- a/gdb/i386-nlmstub.c
+++ b/gdb/i386-nlmstub.c
@@ -321,7 +321,7 @@ getpacket (buffer)
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);
}
@@ -413,8 +413,8 @@ debug_error (format, parm)
{
if (remote_debug)
{
- fprintf (stderr, format, parm);
- fprintf (stderr, "\n");
+ fprintf_unfiltered (gdb_stderr, format, parm);
+ fprintf_unfiltered (gdb_stderr, "\n");
}
}
@@ -834,11 +834,11 @@ main (argc, argv)
/* 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);
}
@@ -853,16 +853,16 @@ main (argc, argv)
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;
}
@@ -874,7 +874,7 @@ main (argc, argv)
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);
}
@@ -887,7 +887,7 @@ main (argc, argv)
DebuggerSignature));
if (s.DDSResourceTag == 0)
{
- fprintf (stderr, "AllocateResourceTag failed\n");
+ fprintf_unfiltered (gdb_stderr, "AllocateResourceTag failed\n");
AIOReleasePort (AIOhandle);
exit (1);
}
@@ -897,7 +897,7 @@ main (argc, argv)
err = RegisterDebuggerRTag (&s, AT_FIRST);
if (err != 0)
{
- fprintf (stderr, "RegisterDebuggerRTag failed\n");
+ fprintf_unfiltered (gdb_stderr, "RegisterDebuggerRTag failed\n");
AIOReleasePort (AIOhandle);
exit (1);
}
@@ -917,7 +917,7 @@ main (argc, argv)
"$?#xx") sitting there. */
if (! putDebugChar ('+'))
{
- fprintf (stderr, "putDebugChar failed\n");
+ fprintf_unfiltered (gdb_stderr, "putDebugChar failed\n");
UnRegisterDebugger (&s);
AIOReleasePort (AIOhandle);
exit (1);
@@ -936,7 +936,7 @@ main (argc, argv)
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);
@@ -952,7 +952,7 @@ main (argc, argv)
/* 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);
diff --git a/gdb/i386-pinsn.c b/gdb/i386-pinsn.c
index b6d7fe9..c11ee49 100644
--- a/gdb/i386-pinsn.c
+++ b/gdb/i386-pinsn.c
@@ -27,7 +27,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
diff --git a/gdb/i386aix-nat.c b/gdb/i386aix-nat.c
index 6b4297f..0c26c8f 100644
--- a/gdb/i386aix-nat.c
+++ b/gdb/i386aix-nat.c
@@ -127,46 +127,46 @@ print_387_status (status, ep)
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);
}
}
@@ -195,7 +195,7 @@ i386_float_info ()
if (fpsaved == 0)
{
- printf ("no floating point status saved\n");
+ printf_unfiltered ("no floating point status saved\n");
return;
}
@@ -333,6 +333,6 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
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");
}
}
diff --git a/gdb/i386lynx-nat.c b/gdb/i386lynx-nat.c
new file mode 100644
index 0000000..27c605b
--- /dev/null
+++ b/gdb/i386lynx-nat.c
@@ -0,0 +1,284 @@
+<<<<<<< 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 *) &registers[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);
+ }
+}
diff --git a/gdb/i386m3-nat.c b/gdb/i386m3-nat.c
index df42662..2ab37c5 100644
--- a/gdb/i386m3-nat.c
+++ b/gdb/i386m3-nat.c
@@ -275,56 +275,56 @@ print_387_status (status, ep)
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));
}
/*
diff --git a/gdb/i386v-nat.c b/gdb/i386v-nat.c
index e2ab3f3..3e16d31 100644
--- a/gdb/i386v-nat.c
+++ b/gdb/i386v-nat.c
@@ -132,7 +132,7 @@ i386_float_info ()
if (fpvalid == 0)
{
- printf ("no floating point status saved\n");
+ printf_unfiltered ("no floating point status saved\n");
return;
}
diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
index 5600507..6c2b6f9 100644
--- a/gdb/i387-tdep.c
+++ b/gdb/i387-tdep.c
@@ -52,35 +52,35 @@ void
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));
}
@@ -89,20 +89,20 @@ void
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,
@@ -111,5 +111,5 @@ print_387_status_word (status)
/* 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);
}
diff --git a/gdb/i960-pinsn.c b/gdb/i960-pinsn.c
index 81fd8b2..ef363fa 100644
--- a/gdb/i960-pinsn.c
+++ b/gdb/i960-pinsn.c
@@ -26,7 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
diff --git a/gdb/i960-tdep.c b/gdb/i960-tdep.c
index 728474b..38e5916 100644
--- a/gdb/i960-tdep.c
+++ b/gdb/i960-tdep.c
@@ -62,7 +62,7 @@ check_host()
*/
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 );
}
@@ -619,7 +619,7 @@ print_fault( siggnal )
# 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"
@@ -628,7 +628,7 @@ print_fault( siggnal )
"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 );
}
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 28ecc1a..f4de3ab 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -252,7 +252,7 @@ Start it from the beginning? "))
puts_filtered(" ");
puts_filtered(inferior_args);
puts_filtered("\n");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
target_create_inferior (exec_file, inferior_args,
@@ -382,7 +382,7 @@ step_1 (skip_subroutines, single_inst, count_string)
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
@@ -749,7 +749,7 @@ finish_command (arg, from_tty)
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);
@@ -1067,8 +1067,8 @@ do_registers_info (regnum, fpregs)
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))
@@ -1086,7 +1086,7 @@ do_registers_info (regnum, fpregs)
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++)
@@ -1109,10 +1109,10 @@ do_registers_info (regnum, fpregs)
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
@@ -1280,7 +1280,7 @@ unset_command (args, from_tty)
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
diff --git a/gdb/inflow.c b/gdb/inflow.c
index bf79541..cd0105e 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -25,6 +25,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "serial.h"
#include "terminal.h"
#include "target.h"
+#include "thread.h"
#include <signal.h>
#include <fcntl.h>
@@ -146,6 +147,9 @@ gdb_has_a_terminal ()
}
return gdb_has_a_terminal_flag == yes;
+ default:
+ /* "Can't happen". */
+ return 0;
}
}
@@ -153,7 +157,7 @@ gdb_has_a_terminal ()
#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));
@@ -331,7 +335,7 @@ terminal_ours_1 (output_only)
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 */
@@ -528,12 +532,14 @@ kill_command (arg, from_tty)
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);
}
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 6e75dc1..88755ad 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -335,7 +335,6 @@ The same program may be running in another process.");
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;
@@ -393,7 +392,6 @@ wait_for_inferior ()
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;
@@ -441,7 +439,7 @@ wait_for_inferior ()
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;
@@ -471,7 +469,7 @@ wait_for_inferior ()
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
@@ -520,7 +518,7 @@ wait_for_inferior ()
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);
@@ -542,7 +540,7 @@ wait_for_inferior ()
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
@@ -604,12 +602,11 @@ switch_thread:
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);
@@ -739,7 +736,7 @@ switch_thread:
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])
@@ -980,11 +977,9 @@ switch_thread:
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
@@ -1201,7 +1196,6 @@ step_into_function:
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;
@@ -1276,7 +1270,6 @@ step_into_function:
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;
}
@@ -1573,8 +1566,8 @@ handle_command (args, from_tty)
}
else
{
- printf ("Not confirmed, unchanged.\n");
- fflush (stdout);
+ printf_unfiltered ("Not confirmed, unchanged.\n");
+ gdb_flush (gdb_stdout);
}
}
break;
diff --git a/gdb/infrun.hacked.c b/gdb/infrun.hacked.c
index 9cf2fcf..777a286 100644
--- a/gdb/infrun.hacked.c
+++ b/gdb/infrun.hacked.c
@@ -513,7 +513,7 @@ child_create_inferior (exec_file, allargs, env)
fprintf (stderr, "Cannot exec %s: %s.\n", shell_file,
errno < sys_nerr ? sys_errlist[errno] : "unknown error");
- fflush (stderr);
+ gdb_flush (stderr);
_exit (0177);
}
@@ -649,7 +649,7 @@ child_open (args, from_tty)
{
printf ("Attaching program: %s pid %d\n",
exec_file, pid);
- fflush (stdout);
+ gdb_flush (stdout);
}
attach (pid);
@@ -716,7 +716,7 @@ wait_for_inferior ()
else
if (!batch_mode())
printf ("\nProgram exited normally.\n");
- fflush (stdout);
+ gdb_flush (stdout);
target_mourn_inferior ();
#ifdef NO_SINGLE_STEP
one_stepped = 0;
@@ -736,7 +736,7 @@ wait_for_inferior ()
? 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
@@ -899,7 +899,7 @@ wait_for_inferior ()
? sys_siglist[stop_signal]
: "(undocumented)");
#endif /* PRINT_RANDOM_SIGNAL */
- fflush (stdout);
+ gdb_flush (stdout);
}
if (stop_signal >= NSIG
|| signal_stop[stop_signal])
diff --git a/gdb/language.c b/gdb/language.c
index be51953..b74e428 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -161,12 +161,12 @@ set_language_command (ignore, from_tty)
/* 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;
@@ -212,7 +212,7 @@ show_type_command(ignore, from_tty)
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");
}
@@ -258,7 +258,7 @@ show_range_command(ignore, from_tty)
{
if (range_check != current_language->la_range_check)
- printf(
+ printf_unfiltered(
"Warning: the current range check setting does not match the language.\n");
}
@@ -411,14 +411,14 @@ language_info (quietly)
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);
}
}
@@ -1012,14 +1012,14 @@ type_error (va_alist)
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);
@@ -1033,14 +1033,14 @@ range_error (va_alist)
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);
@@ -1085,9 +1085,9 @@ set_check (ignore, from_tty)
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
@@ -1106,7 +1106,7 @@ add_language (lang)
{
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();
}
@@ -1144,14 +1144,14 @@ unk_lang_error (msg)
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;
@@ -1171,7 +1171,7 @@ void
unk_lang_print_type (type, varstring, stream, show, level)
struct type *type;
char *varstring;
- FILE *stream;
+ GDB_FILE *stream;
int show;
int level;
{
@@ -1184,7 +1184,7 @@ unk_lang_val_print (type, valaddr, address, stream, format, deref_ref,
struct type *type;
char *valaddr;
CORE_ADDR address;
- FILE *stream;
+ GDB_FILE *stream;
int format;
int deref_ref;
int recurse;
diff --git a/gdb/language.h b/gdb/language.h
index 9df5345..e197aaa 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -126,19 +126,19 @@ struct language_defn
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 */
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index 518f11a..e566c67 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -1153,7 +1153,7 @@ void
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
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index 0b678fd..260bf13 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -35,7 +35,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static void
emit_char (c, stream, quoter)
register int c;
- FILE *stream;
+ GDB_FILE *stream;
int quoter;
{
@@ -87,7 +87,7 @@ emit_char (c, stream, quoter)
static void
m2_printchar (c, stream)
int c;
- FILE *stream;
+ GDB_FILE *stream;
{
fputs_filtered ("'", stream);
emit_char (c, stream, '\'');
@@ -103,7 +103,7 @@ m2_printchar (c, stream)
static void
m2_printstr (stream, string, length, force_ellipses)
- FILE *stream;
+ GDB_FILE *stream;
char *string;
unsigned int length;
int force_ellipses;
@@ -118,7 +118,7 @@ m2_printstr (stream, string, length, force_ellipses)
if (length == 0)
{
- fputs_filtered ("\"\"", stdout);
+ fputs_filtered ("\"\"", gdb_stdout);
return;
}
diff --git a/gdb/m2-lang.h b/gdb/m2-lang.h
index 4bc57f5..38f4687 100644
--- a/gdb/m2-lang.h
+++ b/gdb/m2-lang.h
@@ -24,8 +24,8 @@ extern void
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));
diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c
index ef66a80..c9ee800 100644
--- a/gdb/m2-typeprint.c
+++ b/gdb/m2-typeprint.c
@@ -39,11 +39,11 @@ void
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 */
}
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index fc17ea5..4a314b9 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -31,14 +31,14 @@ m2_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
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));
diff --git a/gdb/m3-nat.c b/gdb/m3-nat.c
index f0707d4..60659b9f 100644
--- a/gdb/m3-nat.c
+++ b/gdb/m3-nat.c
@@ -2377,7 +2377,7 @@ map_cprocs_to_kernel_threads (cprocs, mthreads, thread_count)
void
print_tl_address (stream, pc)
- FILE *stream;
+ GDB_FILE *stream;
CORE_ADDR pc;
{
if (! lookup_minimal_symbol_by_pc (pc))
@@ -2687,7 +2687,7 @@ thread_list_command()
buf,
translate_cstate (scan->state),
wired);
- print_tl_address (stdout, kthread->pc);
+ print_tl_address (gdb_stdout, kthread->pc);
}
else
{
@@ -2720,7 +2720,7 @@ thread_list_command()
if (FETCH_CPROC_STATE (&state) == -1)
puts_filtered ("???");
else
- print_tl_address (stdout, state.pc);
+ print_tl_address (gdb_stdout, state.pc);
neworder++;
}
@@ -2787,7 +2787,7 @@ thread_list_command()
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");
}
}
@@ -3623,8 +3623,8 @@ thread_command (arg, from_tty)
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*/
@@ -3633,8 +3633,8 @@ task_command (arg, from_tty)
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 ()
@@ -4082,11 +4082,11 @@ m3_attach (args, from_tty)
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);
@@ -4210,9 +4210,9 @@ m3_detach (args, from_tty)
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);
diff --git a/gdb/m68k-pinsn.c b/gdb/m68k-pinsn.c
index 321ff5d..0eeb9ef 100644
--- a/gdb/m68k-pinsn.c
+++ b/gdb/m68k-pinsn.c
@@ -26,7 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
diff --git a/gdb/m88k-nat.c b/gdb/m88k-nat.c
index 18781d6..619d865 100644
--- a/gdb/m88k-nat.c
+++ b/gdb/m88k-nat.c
@@ -146,7 +146,7 @@ store_inferior_registers (regno)
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
{
diff --git a/gdb/m88k-pinsn.c b/gdb/m88k-pinsn.c
index 336dd38..0bf2f33 100644
--- a/gdb/m88k-pinsn.c
+++ b/gdb/m88k-pinsn.c
@@ -28,7 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c
index 3e0351d..0ef524c 100644
--- a/gdb/m88k-tdep.c
+++ b/gdb/m88k-tdep.c
@@ -415,7 +415,7 @@ examine_prologue (ip, limit, frame_sp, fsr, fi)
/* (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);
diff --git a/gdb/main.c b/gdb/main.c
index deaf624..5a629ab 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -73,7 +73,7 @@ static void
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));
@@ -687,7 +687,7 @@ main (argc, argv)
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);
@@ -707,7 +707,7 @@ main (argc, argv)
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;
@@ -727,7 +727,7 @@ main (argc, argv)
after initialize_all_files. */
if (print_version)
{
- print_gdb_version (stdout);
+ print_gdb_version (gdb_stdout);
wrap_here ("");
printf_filtered ("\n");
exit (0);
@@ -739,14 +739,14 @@ main (argc, argv)
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\
@@ -767,13 +767,13 @@ 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);
}
@@ -782,11 +782,11 @@ GDB manual (available as on-line info or a printed manual).\n", stdout);
/* 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";
@@ -1119,8 +1119,8 @@ gdb_readline (prrompt)
/* 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);
@@ -1593,8 +1593,8 @@ int signo;
#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 ();
@@ -1679,12 +1679,12 @@ command_line_input (prrompt, 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
@@ -1741,7 +1741,7 @@ command_line_input (prrompt, repeat)
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)
@@ -1939,8 +1939,8 @@ info_command (arg, from_tty)
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. */
@@ -1991,7 +1991,7 @@ help_command (command, from_tty)
char *command;
int from_tty; /* Ignored */
{
- help_cmd (command, stdout);
+ help_cmd (command, gdb_stdout);
}
static void
@@ -2077,9 +2077,9 @@ define_command (comname, from_tty)
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 ();
@@ -2118,7 +2118,7 @@ document_command (comname, from_tty)
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 ();
@@ -2149,7 +2149,7 @@ End with a line saying just \"end\".\n", comname);
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\
@@ -2158,7 +2158,7 @@ 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);
@@ -2179,7 +2179,7 @@ show_version (args, from_tty)
{
immediate_quit++;
print_gnu_advertisement ();
- print_gdb_version (stdout);
+ print_gdb_version (gdb_stdout);
printf_filtered ("\n");
immediate_quit--;
}
@@ -2189,8 +2189,8 @@ show_version (args, from_tty)
void
print_prompt ()
{
- printf ("%s", prompt);
- fflush (stdout);
+ printf_unfiltered ("%s", prompt);
+ gdb_flush (gdb_stdout);
}
static void
@@ -2240,10 +2240,10 @@ pwd_command (args, from_tty)
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
@@ -2386,7 +2386,7 @@ echo_command (text, from_tty)
/* Force this output to appear now. */
wrap_here ("");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
@@ -2497,8 +2497,8 @@ set_history (args, from_tty)
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 */
@@ -2790,6 +2790,15 @@ the previous command number shown.",
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\
diff --git a/gdb/maint.c b/gdb/maint.c
index 35da83f..fe7fdbf5 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -61,8 +61,8 @@ maintenance_command (args, from_tty)
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);
}
@@ -96,19 +96,19 @@ maintenance_demangle (args, from_tty)
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);
}
}
}
@@ -123,8 +123,8 @@ maintenance_info_command (arg, from_tty)
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
@@ -213,8 +213,8 @@ maintenance_print_command (arg, from_tty)
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 */
diff --git a/gdb/mips-pinsn.c b/gdb/mips-pinsn.c
index 199e335..fff36d8 100644
--- a/gdb/mips-pinsn.c
+++ b/gdb/mips-pinsn.c
@@ -27,7 +27,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 82371aa..f7b4f28 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -347,12 +347,9 @@ mips_frame_chain(frame)
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))
@@ -640,7 +637,7 @@ mips_pop_frame()
/* 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;
@@ -695,10 +692,10 @@ mips_print_register (regnum, all)
#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
@@ -713,7 +710,7 @@ mips_print_register (regnum, all)
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
@@ -730,7 +727,7 @@ mips_print_register (regnum, all)
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);
}
}
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index dfac45e..12a3c47 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -639,7 +639,7 @@ open_existing_mapped_file (symsfilename, mtime, mapped)
{
if (error_pre_print)
{
- printf (error_pre_print);
+ printf_unfiltered (error_pre_print);
}
print_sys_errmsg (symsfilename, errno);
}
@@ -709,7 +709,7 @@ open_mapped_file (filename, mtime, mapped)
{
if (error_pre_print)
{
- printf (error_pre_print);
+ printf_unfiltered (error_pre_print);
}
print_sys_errmsg (symsfilename, errno);
}
diff --git a/gdb/osfsolib.c b/gdb/osfsolib.c
index bf272d1..4e8cb32 100644
--- a/gdb/osfsolib.c
+++ b/gdb/osfsolib.c
@@ -535,7 +535,7 @@ solib_add (arg_string, from_tty, target)
{
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
@@ -576,7 +576,7 @@ info_sharedlibrary_command (ignore, from_tty)
if (exec_bfd == NULL)
{
- printf ("No exec file.\n");
+ printf_unfiltered ("No exec file.\n");
return;
}
while ((so = find_solib (so)) != NULL)
@@ -588,7 +588,7 @@ info_sharedlibrary_command (ignore, from_tty)
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++;
}
@@ -597,15 +597,15 @@ info_sharedlibrary_command (ignore, from_tty)
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");
}
}
diff --git a/gdb/parse.c b/gdb/parse.c
index 0f3d351..ca9bcc8 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -741,9 +741,9 @@ parse_exp_1 (stringptr, block, comma)
/* 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;
diff --git a/gdb/partial-stab.h b/gdb/partial-stab.h
index 3be0be6..d7a9b42 100644
--- a/gdb/partial-stab.h
+++ b/gdb/partial-stab.h
@@ -563,8 +563,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
(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
}
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index f6820c4..ce6b966 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -31,6 +31,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#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 " */
@@ -127,7 +128,7 @@ printf_command PARAMS ((char *, int));
static void
print_frame_nameless_args PARAMS ((struct frame_info *, long, int, int,
- FILE *));
+ GDB_FILE *));
static void
display_info PARAMS ((char *, int));
@@ -273,7 +274,7 @@ decode_format (string_ptr, oformat, osize)
return val;
}
-/* 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.
@@ -294,7 +295,7 @@ print_formatted (val, format, size)
{
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':
@@ -305,7 +306,7 @@ print_formatted (val, format, size)
/* 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:
@@ -315,10 +316,10 @@ print_formatted (val, format, size)
|| 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);
}
}
@@ -335,7 +336,7 @@ print_scalar_formatted (valaddr, type, format, size, stream)
struct type *type;
int format;
int size;
- FILE *stream;
+ GDB_FILE *stream;
{
LONGEST val_long;
int len = TYPE_LENGTH (type);
@@ -504,7 +505,7 @@ set_next_address (addr)
void
print_address_symbolic (addr, stream, do_demangle, leadin)
CORE_ADDR addr;
- FILE *stream;
+ GDB_FILE *stream;
int do_demangle;
char *leadin;
{
@@ -576,7 +577,7 @@ print_address_symbolic (addr, stream, do_demangle, 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
@@ -597,7 +598,7 @@ print_address (addr, stream)
void
print_address_demangle (addr, stream, do_demangle)
CORE_ADDR addr;
- FILE *stream;
+ GDB_FILE *stream;
int do_demangle;
{
if (addr == 0) {
@@ -611,8 +612,16 @@ print_address_demangle (addr, stream, do_demangle)
}
+/* 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)
@@ -636,17 +645,14 @@ 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')
@@ -661,7 +667,7 @@ do_examine (fmt, addr)
while (count > 0)
{
- print_address (next_address, stdout);
+ print_address (next_address, gdb_stdout);
printf_filtered (":");
for (i = maxelts;
i > 0 && count > 0;
@@ -675,9 +681,8 @@ do_examine (fmt, addr)
print_formatted (last_examine_value, format, size);
}
printf_filtered ("\n");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
- free (val_type);
}
static void
@@ -767,14 +772,14 @@ print_command_1 (exp, inspect, voidprint)
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)
@@ -878,14 +883,14 @@ address_info (exp, from_tty)
{
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
@@ -893,7 +898,7 @@ address_info (exp, from_tty)
return;
}
- printf ("Symbol \"%s\" is ", SYMBOL_NAME (sym));
+ printf_unfiltered ("Symbol \"%s\" is ", SYMBOL_NAME (sym));
val = SYMBOL_VALUE (sym);
basereg = SYMBOL_BASEREG (sym);
@@ -901,63 +906,63 @@ address_info (exp, from_tty)
{
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;
@@ -966,10 +971,10 @@ address_info (exp, from_tty)
break;
default:
- printf ("of unknown (botched) type");
+ printf_unfiltered ("of unknown (botched) type");
break;
}
- printf (".\n");
+ printf_unfiltered (".\n");
}
static void
@@ -1220,7 +1225,7 @@ do_one_display (d)
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
@@ -1236,14 +1241,14 @@ do_one_display (d)
{
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;
}
@@ -1274,7 +1279,7 @@ disable_display (num)
d->status = disabled;
return;
}
- printf ("No display number %d.\n", num);
+ printf_unfiltered ("No display number %d.\n", num);
}
void
@@ -1283,7 +1288,7 @@ disable_current_display ()
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;
@@ -1297,7 +1302,7 @@ display_info (ignore, from_tty)
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");
@@ -1310,11 +1315,11 @@ 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);
}
}
@@ -1350,7 +1355,7 @@ enable_display (args, from_tty)
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')
@@ -1398,7 +1403,7 @@ void
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);
@@ -1417,7 +1422,7 @@ print_frame_args (func, fi, num, stream)
struct symbol *func;
struct frame_info *fi;
int num;
- FILE *stream;
+ GDB_FILE *stream;
{
struct block *b = NULL;
int nsyms = 0;
@@ -1551,7 +1556,7 @@ print_frame_nameless_args (fi, start, num, first, stream)
long start;
int num;
int first;
- FILE *stream;
+ GDB_FILE *stream;
{
int i;
CORE_ADDR argsaddr;
@@ -1587,90 +1592,6 @@ print_frame_nameless_args (fi, start, num, first, stream)
}
}
-/* 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
-}
-
/* ARGSUSED */
static void
printf_command (arg, from_tty)
@@ -1681,11 +1602,14 @@ 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");
@@ -1701,6 +1625,7 @@ printf_command (arg, from_tty)
processing some kinds of escape sequence. */
f = string = (char *) alloca (strlen (s) + 1);
+
while (*s != '"')
{
int c = *s++;
@@ -1708,7 +1633,6 @@ printf_command (arg, from_tty)
{
case '\0':
error ("Bad format string, non-terminated '\"'.");
- /* doesn't return */
case '\\':
switch (c = *s++)
@@ -1750,26 +1674,27 @@ printf_command (arg, from_tty)
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++ == '%')
{
@@ -1780,15 +1705,44 @@ printf_command (arg, from_tty)
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.
@@ -1823,69 +1777,85 @@ printf_command (arg, from_tty)
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);
}
/* Dump a specified section of assembly code. With no command line
@@ -1946,13 +1916,13 @@ disassemble_command (arg, from_tty)
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);
}
@@ -2100,4 +2070,9 @@ environment, the value is printed in its own window.");
"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);
}
diff --git a/gdb/procfs.c b/gdb/procfs.c
index 1c3b6d9..844f812 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -1624,7 +1624,7 @@ proc_set_exec_trap ()
if ((fd = open (procname, O_RDWR)) < 0)
{
perror (procname);
- fflush (stderr);
+ gdb_flush (gdb_stderr);
_exit (127);
}
premptyset (&exitset);
@@ -1648,7 +1648,7 @@ proc_set_exec_trap ()
if (ioctl (fd, PIOCSEXIT, &exitset) < 0)
{
perror (procname);
- fflush (stderr);
+ gdb_flush (gdb_stderr);
_exit (127);
}
@@ -1657,7 +1657,7 @@ proc_set_exec_trap ()
if (ioctl (fd, PIOCSENTRY, &entryset) < 0)
{
perror (procname);
- fflush (stderr);
+ gdb_flush (gdb_stderr);
_exit (126);
}
@@ -1859,11 +1859,11 @@ procfs_attach (args, from_tty)
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);
@@ -1892,9 +1892,9 @@ procfs_detach (args, from_tty)
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);
@@ -1924,7 +1924,7 @@ static void
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));
}
@@ -2032,7 +2032,7 @@ do_attach (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));
}
}
@@ -2109,32 +2109,32 @@ do_detach (signal)
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
{
@@ -2147,7 +2147,7 @@ do_detach (signal)
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. */
@@ -2165,7 +2165,7 @@ do_detach (signal)
if (result)
{
print_sys_errmsg (pi->pathname, errno);
- printf ("PIOCSRLC or PIOCSET failed.\n");
+ printf_unfiltered ("PIOCSRLC or PIOCSET failed.\n");
}
}
}
@@ -2409,7 +2409,7 @@ wait_again:
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;
}
@@ -2593,7 +2593,7 @@ procfs_resume (pid, step, signo)
{
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");
diff --git a/gdb/pyr-pinsn.c b/gdb/pyr-pinsn.c
index 3b85aca..3ba23d8 100644
--- a/gdb/pyr-pinsn.c
+++ b/gdb/pyr-pinsn.c
@@ -38,7 +38,7 @@ CORE_ADDR pyr_frame_chain(frame)
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;
}
@@ -47,7 +47,7 @@ CORE_ADDR pyr_saved_pc(frame)
{
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;
}
@@ -96,7 +96,7 @@ print_insn (memaddr, stream)
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);
}
@@ -106,7 +106,7 @@ print_insn (memaddr, stream)
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
{
@@ -122,7 +122,7 @@ print_insn (memaddr, stream)
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).
@@ -139,24 +139,24 @@ print_insn (memaddr, stream)
/* 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;
@@ -165,12 +165,12 @@ print_insn (memaddr, stream)
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;
@@ -179,7 +179,7 @@ print_insn (memaddr, stream)
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]);
@@ -187,7 +187,7 @@ print_insn (memaddr, stream)
/* 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],
@@ -196,7 +196,7 @@ print_insn (memaddr, stream)
break;
case 6:
- fprintf (stream,
+ fprintf_unfiltered (stream,
((index_reg_regno) ? " $%#0x,(%s)[%s*%1d]"
: " $%#0x,(%s)"),
op_1_regno,
@@ -209,7 +209,7 @@ print_insn (memaddr, stream)
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,
@@ -219,7 +219,7 @@ print_insn (memaddr, stream)
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],
@@ -231,7 +231,7 @@ print_insn (memaddr, stream)
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)"),
@@ -247,7 +247,7 @@ print_insn (memaddr, stream)
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,
@@ -259,7 +259,7 @@ print_insn (memaddr, stream)
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,
@@ -275,7 +275,7 @@ print_insn (memaddr, stream)
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,
@@ -289,7 +289,7 @@ print_insn (memaddr, stream)
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)"),
@@ -306,7 +306,7 @@ print_insn (memaddr, stream)
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,
@@ -318,13 +318,13 @@ print_insn (memaddr, stream)
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;
diff --git a/gdb/pyr-tdep.c b/gdb/pyr-tdep.c
index 69b84eb..f635b55 100644
--- a/gdb/pyr-tdep.c
+++ b/gdb/pyr-tdep.c
@@ -30,7 +30,7 @@ pyr_print_registers(reg_buf, regnum)
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],
@@ -42,7 +42,7 @@ pyr_print_registers(reg_buf, regnum)
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);
@@ -89,7 +89,7 @@ CORE_ADDR frame_locals_address (frame)
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],
@@ -115,7 +115,7 @@ CORE_ADDR frame_args_addr (frame)
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],
diff --git a/gdb/pyr-xdep.c b/gdb/pyr-xdep.c
index b850f5a..bdfdd5f 100644
--- a/gdb/pyr-xdep.c
+++ b/gdb/pyr-xdep.c
@@ -49,13 +49,13 @@ fetch_inferior_registers (regno)
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;
}
@@ -104,7 +104,7 @@ fetch_inferior_registers (regno)
(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++;
@@ -115,7 +115,7 @@ fetch_inferior_registers (regno)
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]);
}
@@ -277,16 +277,16 @@ core_file_command (filename, from_tty)
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 */
@@ -332,7 +332,7 @@ core_file_command (filename, from_tty)
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,
@@ -350,7 +350,7 @@ core_file_command (filename, from_tty)
}
#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? */
@@ -366,5 +366,5 @@ core_file_command (filename, from_tty)
validate_files ();
}
else if (from_tty)
- printf ("No core file now.\n");
+ printf_unfiltered ("No core file now.\n");
}
diff --git a/gdb/regex.c b/gdb/regex.c
index 75bf4e9..d83740f 100644
--- a/gdb/regex.c
+++ b/gdb/regex.c
@@ -1657,21 +1657,21 @@ main (argc, argv)
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);
}
}
@@ -1681,23 +1681,23 @@ print_buf (bufp)
{
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
@@ -1706,19 +1706,19 @@ printchar (c)
{
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);
}
diff --git a/gdb/remote-hms.c b/gdb/remote-hms.c
index 32ca1c9..1ffcff7 100644
--- a/gdb/remote-hms.c
+++ b/gdb/remote-hms.c
@@ -261,7 +261,7 @@ readchar ()
error ("Timeout reading from remote system.");
if (!quiet)
- printf ("%c", buf);
+ printf_unfiltered ("%c", buf);
return buf & 0x7f;
}
@@ -275,7 +275,7 @@ readchar_nofail ()
if (buf == SERIAL_TIMEOUT)
buf = 0;
if (!quiet)
- printf ("%c", buf);
+ printf_unfiltered ("%c", buf);
return buf & 0x7f;
@@ -446,7 +446,7 @@ hms_load (args, fromtty)
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);
@@ -744,12 +744,12 @@ hms_wait (pid, status)
/* 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++;
@@ -847,7 +847,7 @@ hms_write (a, l)
if (!quiet)
for (i = 0; i < l; i++)
{
- printf ("%c", a[i]);
+ printf_unfiltered ("%c", a[i]);
}
}
@@ -1215,7 +1215,7 @@ hms_before_main_loop ()
{
char ttyname[100];
char *p, *p2;
- extern FILE *instream;
+ extern GDB_FILE *instream;
push_target (&hms_ops);
}
@@ -1241,7 +1241,7 @@ hms_insert_breakpoint (addr, save)
}
else
{
- fprintf_filtered (stderr,
+ fprintf_filtered (gdb_stderr,
"Too many break points, break point not installed\n");
return (1);
}
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 8559749..5322e76 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -378,8 +378,8 @@ mips_receive_header (hdr, pgarbage, ch, timeout)
should be filtered? */
if (! mips_initializing || sr_get_debug () > 0)
{
- putchar (ch);
- fflush (stdout);
+ putchar_unfiltered (ch);
+ gdb_flush (gdb_stdout);
}
++*pgarbage;
@@ -911,7 +911,7 @@ device is attached to the target board (e.g., /dev/ttya).");
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? */
@@ -948,7 +948,7 @@ mips_detach (args, from_tty)
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
@@ -1212,7 +1212,7 @@ static void
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
diff --git a/gdb/remote-mm.c b/gdb/remote-mm.c
index 3387ee5..b7d3916 100644
--- a/gdb/remote-mm.c
+++ b/gdb/remote-mm.c
@@ -541,7 +541,7 @@ mm_wait (status)
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;
diff --git a/gdb/remote-nindy.c b/gdb/remote-nindy.c
index 4050ff4..b9b120c 100644
--- a/gdb/remote-nindy.c
+++ b/gdb/remote-nindy.c
@@ -128,7 +128,7 @@ extern char *mktemp();
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 ();
@@ -227,7 +227,7 @@ nindy_detach (name, from_tty)
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": "");
@@ -292,7 +292,7 @@ You may need to reset the 80960 and/or reload your program.\n");
}
/* 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.
@@ -698,8 +698,8 @@ nindy_before_main_loop ()
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 );
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index c87761c..7dc384b 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -192,7 +192,7 @@ sim_load_standard (abfd)
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);
diff --git a/gdb/remote-udi.c b/gdb/remote-udi.c
index ee207dc..7f7d0d3 100644
--- a/gdb/remote-udi.c
+++ b/gdb/remote-udi.c
@@ -143,7 +143,7 @@ udi_create_inferior (execfile, args, env)
if (udi_session_id < 0)
{
- printf("UDI connection not open yet.\n");
+ printf_unfiltered("UDI connection not open yet.\n");
return;
}
@@ -235,13 +235,13 @@ udi_open (name, from_tty)
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;
@@ -263,7 +263,7 @@ udi_open (name, from_tty)
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,
@@ -325,14 +325,14 @@ udi_attach (args, from_tty)
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.
@@ -352,7 +352,7 @@ udi_detach (args,from_tty)
pop_target(); /* calls udi_close to do the real work */
if (from_tty)
- printf ("Ending remote debugging\n");
+ printf_unfiltered ("Ending remote debugging\n");
}
@@ -374,7 +374,7 @@ udi_resume (pid, step, sig)
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");
}
@@ -416,19 +416,19 @@ udi_wait (pid, status)
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:
@@ -460,12 +460,12 @@ udi_wait (pid, status)
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 */
@@ -565,12 +565,12 @@ udi_pc()
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 *)&registers[4 * PC_REGNUM],
+ printf_unfiltered("other pc1 = 0x%x, pc0 = 0x%x\n", *(int *)&registers[4 * PC_REGNUM],
*(int *)&registers[4 * NPC_REGNUM]);
/* Now, read all the registers globally */
@@ -697,8 +697,8 @@ int regno;
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));
}
@@ -738,8 +738,8 @@ int regno;
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));
}
@@ -890,7 +890,7 @@ udi_xfer_inferior_memory (memaddr, myaddr, len, write)
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);
}
@@ -968,7 +968,7 @@ just invoke udi_close, which seems to get things right.
inferior_pid = 0;
if (from_tty)
- printf("Target has been stopped.");
+ printf_unfiltered("Target has been stopped.");
#else
udi_close(0);
#endif
@@ -1109,7 +1109,7 @@ download(load_arg_string, from_tty)
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);
@@ -1198,9 +1198,9 @@ download(load_arg_string, from_tty)
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);
}
}
@@ -1371,7 +1371,7 @@ fetch_register (regno)
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'.
@@ -1392,7 +1392,7 @@ store_register (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)
{
@@ -1526,7 +1526,7 @@ CORE_ADDR addr;
void convert16() {;}
void convert32() {;}
-FILE* EchoFile = 0; /* used for debugging */
+GDB_FILE * EchoFile = 0; /* used for debugging */
int QuietMode = 0; /* used for debugging */
#ifdef NO_HIF_SUPPORT
diff --git a/gdb/remote-utils.c b/gdb/remote-utils.c
index 47365eb..af4d431 100644
--- a/gdb/remote-utils.c
+++ b/gdb/remote-utils.c
@@ -76,7 +76,7 @@ usage(proto, junk)
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? */
@@ -217,7 +217,7 @@ sr_readchar ()
error ("Timeout reading from remote system.");
if (sr_get_debug() > 0)
- printf ("%c", buf);
+ printf_unfiltered ("%c", buf);
return buf & 0x7f;
}
@@ -232,9 +232,9 @@ sr_pollchar()
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;
}
@@ -276,7 +276,7 @@ sr_write (a, l)
if (sr_get_debug() > 0)
for (i = 0; i < l; i++)
- printf ("%c", a[i]);
+ printf_unfiltered ("%c", a[i]);
return;
}
@@ -573,9 +573,9 @@ gr_multi_scan (list, passthrough)
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;
diff --git a/gdb/remote-vx.c b/gdb/remote-vx.c
index c8c52c0..e49d0ed 100644
--- a/gdb/remote-vx.c
+++ b/gdb/remote-vx.c
@@ -557,20 +557,20 @@ vx_xfer_memory (memaddr, myaddr, len, write, target)
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
@@ -974,9 +974,9 @@ add_symbol_stub (arg)
{
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.
@@ -1004,8 +1004,8 @@ vx_open (args, from_tty)
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
@@ -1039,7 +1039,7 @@ vx_open (args, from_tty)
"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.");
@@ -1103,7 +1103,7 @@ vx_attach (args, from_tty)
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));
@@ -1149,7 +1149,7 @@ vx_detach (args, from_tty)
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 */
@@ -1181,7 +1181,7 @@ vx_kill ()
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));
diff --git a/gdb/remote-z8k.c b/gdb/remote-z8k.c
index 6c1b286..ff076ad 100644
--- a/gdb/remote-z8k.c
+++ b/gdb/remote-z8k.c
@@ -125,7 +125,7 @@ sim_load (args, fromtty)
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);
diff --git a/gdb/remote.c b/gdb/remote.c
index 6fffc54..87437a1 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -417,7 +417,7 @@ remote_interrupt (signo)
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 */
}
@@ -656,7 +656,7 @@ remote_fetch_registers (regno)
&& (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);
}
@@ -997,7 +997,7 @@ putpkt (buf)
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");
@@ -1011,7 +1011,7 @@ putpkt (buf)
{
case '+':
if (remote_debug)
- printf("Ack\n");
+ printf_unfiltered("Ack\n");
return;
case SERIAL_TIMEOUT:
break; /* Retransmit buffer */
@@ -1021,7 +1021,7 @@ putpkt (buf)
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 */
@@ -1133,7 +1133,7 @@ whole:
}
else
{
- printf ("Ignoring packet error, continuing...\n");
+ printf_unfiltered ("Ignoring packet error, continuing...\n");
break;
}
}
@@ -1143,7 +1143,7 @@ out:
SERIAL_WRITE (remote_desc, "+", 1);
if (remote_debug)
- fprintf (stderr,"Packet received: %s\n", buf);
+ fprintf_unfiltered (gdb_stderr,"Packet received: %s\n", buf);
}
static void
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index f9f322e..4ffc48c 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -102,7 +102,7 @@ fetch_inferior_registers (regno)
(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;
}
@@ -181,7 +181,7 @@ store_inferior_registers (regno)
}
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;
@@ -244,5 +244,5 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
memcpy (&registers [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");
}
diff --git a/gdb/rs6000-pinsn.c b/gdb/rs6000-pinsn.c
index 08e9125..28e1ee8 100644
--- a/gdb/rs6000-pinsn.c
+++ b/gdb/rs6000-pinsn.c
@@ -27,7 +27,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
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;
@@ -108,7 +108,7 @@ insn_found:
return 4;
not_found:
- fprintf (stream, "0x%08x", the_insn);
+ fprintf_unfiltered (stream, "0x%08x", the_insn);
return 4;
}
@@ -184,7 +184,7 @@ int insn_no;
}
*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;
@@ -192,12 +192,12 @@ int insn_no;
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 :
@@ -212,16 +212,16 @@ int insn_no;
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;
@@ -253,7 +253,7 @@ int insn_no;
nocomma = 1;
}
else
- fprintf (stream, "%d", (insn_word >> 5) & 0x7f);
+ fprintf_unfiltered (stream, "%d", (insn_word >> 5) & 0x7f);
break;
case FL1 : /* for svc only */
@@ -261,83 +261,83 @@ int insn_no;
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 :
@@ -345,50 +345,50 @@ int insn_no;
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);
}
}
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 012f53b..fd68f53 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -645,7 +645,7 @@ function_frame_info (pc, fdata)
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;
@@ -719,7 +719,7 @@ push_arguments (nargs, args, sp, struct_return, struct_addr)
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.
@@ -743,7 +743,7 @@ push_arguments (nargs, args, sp, struct_return, struct_addr)
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 (&registers[REGISTER_BYTE(FP0_REGNUM + 1 + f_argno)], VALUE_CONTENTS (arg),
@@ -834,7 +834,7 @@ ran_out_of_registers_for_arguments:
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 (&registers[REGISTER_BYTE(FP0_REGNUM + 1 + f_argno)], VALUE_CONTENTS (arg),
diff --git a/gdb/ser-go32.c b/gdb/ser-go32.c
index 68c43b0..ff7c0a7 100644
--- a/gdb/ser-go32.c
+++ b/gdb/ser-go32.c
@@ -183,7 +183,7 @@ dos_async_rx()
while (!dos_async_ready())
if (kbhit())
{
- printf("abort!\n");
+ printf_unfiltered("abort!\n");
return 0;
}
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index c038149..9eb9647 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -73,7 +73,7 @@ tcp_open(scb, name)
if (!hostent)
{
- fprintf (stderr, "%s: unknown host\n", hostname);
+ fprintf_unfiltered (gdb_stderr, "%s: unknown host\n", hostname);
errno = ENOENT;
return -1;
}
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c
index b306e8a..c777895 100644
--- a/gdb/ser-unix.c
+++ b/gdb/ser-unix.c
@@ -354,7 +354,7 @@ hardwire_raw(scb)
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;
@@ -384,7 +384,7 @@ hardwire_raw(scb)
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,
@@ -440,7 +440,7 @@ wait_for(scb, timeout)
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;
@@ -453,7 +453,7 @@ wait_for(scb, timeout)
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;
}
diff --git a/gdb/serial.c b/gdb/serial.c
index 70f4323..be4aa65 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -152,7 +152,7 @@ static void
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);
@@ -171,9 +171,9 @@ connect_command (args, fromtty)
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;
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 3b04d54..42e79cb 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -75,7 +75,7 @@ sh_skip_prologue (start_pc)
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
GDB_INIT_DISASSEMBLE_INFO (info, stream);
diff --git a/gdb/source.c b/gdb/source.c
index 581eabc..5a4733f 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -363,7 +363,7 @@ mod_path (dirname, which_path)
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)
@@ -804,10 +804,10 @@ identify_source_line (s, line, mid_statement, pc)
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;
@@ -961,7 +961,7 @@ list_command (arg, from_tty)
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)
@@ -993,9 +993,9 @@ list_command (arg, from_tty)
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)
@@ -1025,17 +1025,19 @@ list_command (arg, from_tty)
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);
}
@@ -1116,7 +1118,7 @@ line_info (arg, from_tty)
address. */
printf_filtered (" for address ");
wrap_here (" ");
- print_address (sal.pc, stdout);
+ print_address (sal.pc, gdb_stdout);
}
else
printf_filtered (".");
@@ -1131,7 +1133,7 @@ line_info (arg, from_tty)
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");
}
@@ -1141,10 +1143,10 @@ line_info (arg, from_tty)
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");
}
@@ -1166,6 +1168,7 @@ line_info (arg, from_tty)
printf_filtered ("Line number %d is out of range for \"%s\".\n",
sal.line, sal.symtab->filename);
}
+ free (sals.sals);
}
/* Commands to search the source file for a regexp. */
@@ -1328,6 +1331,12 @@ _initialize_source ()
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\
diff --git a/gdb/sp64-tdep.c b/gdb/sp64-tdep.c
index c6c4a8e..b066945 100644
--- a/gdb/sp64-tdep.c
+++ b/gdb/sp64-tdep.c
@@ -89,7 +89,7 @@ sparc64_single_step (ignore)
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));
@@ -256,7 +256,7 @@ dump_ccreg (reg, val)
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",
@@ -274,16 +274,16 @@ sparc_print_register_hook (regno)
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);
}
}
diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c
index 3835952..e1f0235 100644
--- a/gdb/sparc-nat.c
+++ b/gdb/sparc-nat.c
@@ -121,7 +121,7 @@ fetch_inferior_registers (regno)
CORE_ADDR sp = *(CORE_ADDR*)&registers[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),
&registers[i], REGISTER_RAW_SIZE (regno), 0);
register_valid[regno] = 1;
@@ -278,8 +278,8 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
if (0 != target_read_memory (sp, &registers[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");
}
}
@@ -296,7 +296,7 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, ignore)
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");
}
}
diff --git a/gdb/sparc-pinsn.c b/gdb/sparc-pinsn.c
index 5e4fe91..5ca42dc 100644
--- a/gdb/sparc-pinsn.c
+++ b/gdb/sparc-pinsn.c
@@ -26,7 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
diff --git a/gdb/stack.c b/gdb/stack.c
index dc14c38..0b26d56 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -56,7 +56,7 @@ static void
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));
@@ -65,16 +65,16 @@ static void
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));
@@ -107,6 +107,25 @@ int selected_frame_level;
int frame_file_full_name = 0;
+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,
@@ -123,11 +142,14 @@ print_stack_frame (frame, level, source)
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 {
@@ -145,7 +167,7 @@ print_args_stub (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;
}
@@ -257,10 +279,10 @@ print_frame_info (fi, level, source, args)
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;
@@ -305,7 +327,7 @@ print_frame_info (fi, level, source, args)
if (source != 0)
set_default_breakpoint (1, fi->pc, sal.symtab, sal.line);
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
/*
@@ -473,7 +495,7 @@ frame_info (addr_exp, from_tty)
if (funname)
{
printf_filtered (" in ");
- fprintf_symbol_filtered (stdout, funname, funlang,
+ fprintf_symbol_filtered (gdb_stdout, funname, funlang,
DMGL_ANSI | DMGL_PARAMS);
}
wrap_here (" ");
@@ -533,7 +555,7 @@ frame_info (addr_exp, from_tty)
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");
}
}
@@ -599,7 +621,7 @@ backtrace_limit_info (arg, from_tty)
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
@@ -686,6 +708,11 @@ backtrace_command (count_exp, from_tty)
{
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);
}
@@ -701,7 +728,7 @@ static int
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;
@@ -733,7 +760,7 @@ static int
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;
@@ -778,7 +805,7 @@ print_block_frame_labels (b, have_default, stream)
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;
@@ -813,7 +840,7 @@ static void
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);
@@ -888,7 +915,7 @@ locals_info (args, from_tty)
{
if (!selected_frame)
error ("No frame selected.");
- print_frame_local_vars (selected_frame, stdout);
+ print_frame_local_vars (selected_frame, gdb_stdout);
}
static void
@@ -898,13 +925,13 @@ catch_info (ignore, from_tty)
{
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;
@@ -973,7 +1000,7 @@ args_info (ignore, from_tty)
{
if (!selected_frame)
error ("No frame selected.");
- print_frame_arg_vars (selected_frame, stdout);
+ print_frame_arg_vars (selected_frame, gdb_stdout);
}
/* Select frame FRAME, and note that its stack level is LEVEL.
diff --git a/gdb/stuff.c b/gdb/stuff.c
index 1ce07ef..3c069c7 100644
--- a/gdb/stuff.c
+++ b/gdb/stuff.c
@@ -168,7 +168,7 @@ err (va_alist)
va_start (args);
string = va_arg (args, char *);
- vfprintf (stderr, string, args);
+ vfprintf (gdb_stderr, string, args);
va_end (args);
exit (-1);
}
diff --git a/gdb/sun3-nat.c b/gdb/sun3-nat.c
index d0c7506..1f7f25d 100644
--- a/gdb/sun3-nat.c
+++ b/gdb/sun3-nat.c
@@ -133,6 +133,6 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
#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");
}
}
diff --git a/gdb/sun386-nat.c b/gdb/sun386-nat.c
index 317bd8a..63f6752 100644
--- a/gdb/sun386-nat.c
+++ b/gdb/sun386-nat.c
@@ -118,9 +118,9 @@ core_file_command (filename, from_tty)
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] == '/')
@@ -137,7 +137,7 @@ core_file_command (filename, from_tty)
validate_files ();
}
else if (from_tty)
- printf ("No core file now.\n");
+ printf_unfiltered ("No core file now.\n");
}
i387_to_double (from, to)
diff --git a/gdb/symfile.c b/gdb/symfile.c
index fd8298d..5202823 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -564,7 +564,7 @@ symbol_file_add (name, from_tty, addr, mainline, mapped, readnow)
{
printf_filtered ("Mapped symbols for %s...", name);
wrap_here ("");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
init_entry_point_info (objfile);
find_sym_fns (objfile);
@@ -578,7 +578,7 @@ symbol_file_add (name, from_tty, addr, mainline, mapped, readnow)
{
printf_filtered ("Reading symbols from %s...", name);
wrap_here ("");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
syms_from_objfile (objfile, addr, mainline, from_tty);
}
@@ -594,7 +594,7 @@ symbol_file_add (name, from_tty, addr, mainline, mapped, readnow)
{
printf_filtered ("expanding to full symbols...");
wrap_here ("");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
for (psymtab = objfile -> psymtabs;
@@ -608,7 +608,7 @@ symbol_file_add (name, from_tty, addr, mainline, mapped, readnow)
if (from_tty || info_verbose)
{
printf_filtered ("done.\n");
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
new_symfile_objfile (objfile, mainline, from_tty);
@@ -648,7 +648,7 @@ symbol_file_command (args, from_tty)
symfile_objfile = NULL;
if (from_tty)
{
- printf ("No symbol file now.\n");
+ printf_unfiltered ("No symbol file now.\n");
}
}
else
diff --git a/gdb/symm-nat.c b/gdb/symm-nat.c
index 75a940e..752263d 100644
--- a/gdb/symm-nat.c
+++ b/gdb/symm-nat.c
@@ -111,43 +111,43 @@ struct pt_regset ep;
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);
@@ -167,72 +167,72 @@ unsigned int pcr;
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)
@@ -253,13 +253,13 @@ long regs[FPA_NREGS];
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);
}
}
}
@@ -269,13 +269,13 @@ struct pt_regset ep;
{
- 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");
}
}
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 1a149cf..43fb383 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -111,8 +111,8 @@ void
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
@@ -267,7 +267,6 @@ gdb_mangle_name (type, i, j)
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)
@@ -348,6 +347,7 @@ gdb_mangle_name (type, i, j)
work with the normal mechanisms. */
if (OPNAME_PREFIX_P (field_name))
{
+ char *opname;
opname = cplus_mangle_opname (field_name + 3, 0);
if (opname == NULL)
{
@@ -1531,10 +1531,10 @@ find_methods (t, name, sym_arr)
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);
}
}
}
@@ -2130,7 +2130,7 @@ decode_line_2 (sym_arr, nelts, funfirstline, canonical)
}
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)
@@ -2143,10 +2143,10 @@ decode_line_2 (sym_arr, nelts, funfirstline, canonical)
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++;
}
@@ -2154,8 +2154,8 @@ decode_line_2 (sym_arr, nelts, funfirstline, canonical)
{
prompt = ">";
}
- printf("%s ",prompt);
- fflush(stdout);
+ printf_unfiltered("%s ",prompt);
+ gdb_flush(gdb_stdout);
args = command_line_input ((char *) NULL, 0);
@@ -2198,7 +2198,7 @@ decode_line_2 (sym_arr, nelts, funfirstline, canonical)
if (num > nelts + 2)
{
- printf ("No choice number %d.\n", num);
+ printf_unfiltered ("No choice number %d.\n", num);
}
else
{
@@ -2216,7 +2216,7 @@ decode_line_2 (sym_arr, nelts, funfirstline, canonical)
}
else
{
- printf ("duplicate request for %d ignored.\n", num);
+ printf_unfiltered ("duplicate request for %d ignored.\n", num);
}
}
@@ -2285,7 +2285,7 @@ output_source_filename (name, first)
}
wrap_here ("");
- fputs_filtered (name, stdout);
+ fputs_filtered (name, gdb_stdout);
}
static void
@@ -2534,9 +2534,9 @@ list_symbols (regexp, class, bpt)
}
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;
@@ -2546,7 +2546,7 @@ list_symbols (regexp, class, bpt)
/* 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 &&
@@ -2555,7 +2555,7 @@ list_symbols (regexp, class, bpt)
type_print (SYMBOL_TYPE (sym),
(SYMBOL_CLASS (sym) == LOC_TYPEDEF
? "" : SYMBOL_SOURCE_NAME (sym)),
- stdout, 0);
+ gdb_stdout, 0);
printf_filtered (";\n");
}
@@ -2564,12 +2564,12 @@ list_symbols (regexp, class, bpt)
# 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
}
}
diff --git a/gdb/tahoe-pinsn.c b/gdb/tahoe-pinsn.c
index 92b0ceb..4016b3b 100644
--- a/gdb/tahoe-pinsn.c
+++ b/gdb/tahoe-pinsn.c
@@ -37,7 +37,7 @@ static unsigned char *print_insn_arg ();
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
unsigned char buffer[MAXLEN];
register int i;
@@ -54,11 +54,11 @@ print_insn (memaddr, stream)
/* 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. */
@@ -66,14 +66,14 @@ print_insn (memaddr, stream)
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;
}
@@ -83,7 +83,7 @@ print_insn_arg (d, p, addr, stream)
char *d;
register char *p;
CORE_ADDR addr;
- FILE *stream;
+ GDB_FILE *stream;
{
int temp1 = 0;
register int regnum = *p & 0xf;
@@ -92,14 +92,14 @@ print_insn_arg (d, p, addr, stream)
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;
}
}
@@ -113,50 +113,50 @@ print_insn_arg (d, p, addr, stream)
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;
}
@@ -169,26 +169,26 @@ print_insn_arg (d, p, addr, stream)
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;
@@ -196,12 +196,12 @@ print_insn_arg (d, p, addr, stream)
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;
@@ -213,7 +213,7 @@ print_insn_arg (d, p, addr, stream)
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;
}
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index 2bf0d05..92e2614 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -57,7 +57,7 @@ void
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);
@@ -85,7 +85,7 @@ whatis_exp (exp, show)
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)
@@ -146,7 +146,7 @@ ptype_command (typename, from_tty)
{
/* 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);
}
@@ -175,7 +175,7 @@ void
print_type_scalar (type, val, stream)
struct type *type;
LONGEST val;
- FILE *stream;
+ GDB_FILE *stream;
{
unsigned int i;
unsigned len;
@@ -235,7 +235,7 @@ print_type_scalar (type, val, stream)
default:
error ("Invalid type code in symbol table.");
}
- fflush (stream);
+ gdb_flush (stream);
}
#if MAINTENANCE_CMDS
diff --git a/gdb/typeprint.h b/gdb/typeprint.h
index e6740db..eead5f6 100644
--- a/gdb/typeprint.h
+++ b/gdb/typeprint.h
@@ -18,4 +18,4 @@ along with this program; if not, write to the Free Software
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 *));
diff --git a/gdb/ultra3-nat.c b/gdb/ultra3-nat.c
index 76ea63b..f1b81b7 100644
--- a/gdb/ultra3-nat.c
+++ b/gdb/ultra3-nat.c
@@ -298,7 +298,7 @@ register_addr (regno,blockend)
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 */
}
diff --git a/gdb/ultra3-xdep.c b/gdb/ultra3-xdep.c
index ff56622..bda2697 100644
--- a/gdb/ultra3-xdep.c
+++ b/gdb/ultra3-xdep.c
@@ -53,7 +53,7 @@ int fd, cmd, arg;
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);
}
}
diff --git a/gdb/umax-xdep.c b/gdb/umax-xdep.c
index edcfee4..8c5a295 100644
--- a/gdb/umax-xdep.c
+++ b/gdb/umax-xdep.c
@@ -91,9 +91,9 @@ core_file_command (filename, from_tty)
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
@@ -130,5 +130,5 @@ core_file_command (filename, from_tty)
validate_files ();
}
else if (from_tty)
- printf ("No core file now.\n");
+ printf_unfiltered ("No core file now.\n");
}
diff --git a/gdb/utils.c b/gdb/utils.c
index 14a5c79..3ee6986 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -30,10 +30,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#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"
@@ -219,7 +216,7 @@ warning_setup ()
{
target_terminal_ours ();
wrap_here(""); /* Force out any buffered output */
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
/* Print a warning message.
@@ -239,12 +236,12 @@ warning (va_alist)
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);
}
@@ -263,12 +260,12 @@ error (va_alist)
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);
}
@@ -290,9 +287,9 @@ fatal (va_alist)
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);
}
@@ -312,9 +309,9 @@ fatal_dump_core (va_alist)
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);
@@ -405,7 +402,7 @@ print_sys_errmsg (string, errcode)
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. */
@@ -413,26 +410,26 @@ print_sys_errmsg (string, errcode)
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);
}
@@ -627,7 +624,7 @@ PTR
xmalloc (size)
long size;
{
- return (xmmalloc ((void *) NULL, size));
+ return (xmmalloc ((PTR) NULL, size));
}
/* Like mrealloc but get error if no storage available. */
@@ -637,7 +634,7 @@ xrealloc (ptr, size)
PTR ptr;
long size;
{
- return (xmrealloc ((void *) NULL, ptr, size));
+ return (xmrealloc ((PTR) NULL, ptr, size));
}
@@ -683,7 +680,7 @@ savestring (ptr, size)
char *
msavestring (md, ptr, size)
- void *md;
+ PTR md;
const char *ptr;
int size;
{
@@ -705,7 +702,7 @@ strsave (ptr)
char *
mstrsave (md, ptr)
- void *md;
+ PTR md;
const char *ptr;
{
return (msavestring (md, ptr, strlen (ptr)));
@@ -742,13 +739,13 @@ query (va_alist)
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 */
@@ -1030,7 +1027,7 @@ wrap_here(indent)
if (wrap_buffer[0])
{
*wrap_pointer = '\0';
- fputs (wrap_buffer, stdout);
+ fputs (wrap_buffer, gdb_stdout);
}
wrap_pointer = wrap_buffer;
wrap_buffer[0] = '\0';
@@ -1069,6 +1066,15 @@ begin_line ()
}
}
+
+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.
@@ -1080,9 +1086,17 @@ begin_line ()
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;
@@ -1090,7 +1104,7 @@ fputs_filtered (linebuffer, stream)
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);
@@ -1105,7 +1119,8 @@ fputs_filtered (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')
@@ -1181,6 +1196,44 @@ fputs_filtered (linebuffer, stream)
}
}
+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,
@@ -1206,11 +1259,12 @@ fputs_filtered (linebuffer, stream)
#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;
@@ -1228,7 +1282,26 @@ vfprintf_filtered (stream, format, args)
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
@@ -1236,7 +1309,15 @@ vprintf_filtered (format, args)
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 */
@@ -1258,8 +1339,27 @@ fprintf_filtered (va_alist)
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
@@ -1283,6 +1383,7 @@ fprintfi_filtered (va_alist)
va_end (args);
}
+
/* VARARGS */
void
printf_filtered (va_alist)
@@ -1294,12 +1395,28 @@ 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
@@ -1313,8 +1430,8 @@ printfi_filtered (va_alist)
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);
}
@@ -1327,7 +1444,14 @@ void
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
@@ -1515,7 +1639,7 @@ _initialize_utils ()
#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);
diff --git a/gdb/valprint.c b/gdb/valprint.c
index b3b1f71..c91b7cd 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -34,7 +34,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* 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));
@@ -61,7 +61,7 @@ static void
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"
@@ -121,7 +121,7 @@ val_print (type, valaddr, address, stream, format, deref_ref, recurse, pretty)
struct type *type;
char *valaddr;
CORE_ADDR address;
- FILE *stream;
+ GDB_FILE *stream;
int format;
int deref_ref;
int recurse;
@@ -143,7 +143,7 @@ val_print (type, valaddr, address, stream, format, deref_ref, recurse, pretty)
if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
{
fprintf_filtered (stream, "<incomplete type>");
- fflush (stream);
+ gdb_flush (stream);
return (0);
}
@@ -159,7 +159,7 @@ val_print (type, valaddr, address, stream, format, deref_ref, recurse, pretty)
int
value_print (val, stream, format, pretty)
value val;
- FILE *stream;
+ GDB_FILE *stream;
int format;
enum val_prettyprint pretty;
{
@@ -236,7 +236,7 @@ void
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. */
@@ -258,7 +258,7 @@ val_print_type_code_int (type, valaddr, stream)
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. */
@@ -317,7 +317,7 @@ val_print_type_code_int (type, valaddr, stream)
void
print_longest (stream, format, use_local, val_long)
- FILE *stream;
+ GDB_FILE *stream;
int format;
int use_local;
LONGEST val_long;
@@ -331,7 +331,7 @@ print_longest (stream, format, use_local, 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
@@ -431,7 +431,7 @@ void
print_floating (valaddr, type, stream)
char *valaddr;
struct type *type;
- FILE *stream;
+ GDB_FILE *stream;
{
double doub;
int inv;
@@ -447,43 +447,48 @@ print_floating (valaddr, type, stream)
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)
{
@@ -512,7 +517,7 @@ print_floating (valaddr, type, stream)
static void
print_hex_chars (stream, valaddr, len)
- FILE *stream;
+ GDB_FILE *stream;
unsigned char *valaddr;
unsigned len;
{
@@ -551,7 +556,7 @@ val_print_array_elements (type, valaddr, address, stream, format, deref_ref,
struct type *type;
char *valaddr;
CORE_ADDR address;
- FILE *stream;
+ GDB_FILE *stream;
int format;
int deref_ref;
int recurse;
@@ -621,7 +626,7 @@ val_print_array_elements (type, valaddr, address, stream, format, deref_ref,
static void
value_print_array_elements (val, stream, format, pretty)
value val;
- FILE *stream;
+ GDB_FILE *stream;
int format;
enum val_prettyprint pretty;
{
@@ -657,7 +662,7 @@ value_print_array_elements (val, stream, format, 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;
}
@@ -684,9 +689,8 @@ int
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. */
@@ -696,7 +700,7 @@ val_print_string (addr, len, stream)
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
@@ -799,15 +803,18 @@ val_print_string (addr, len, stream)
{
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);
}
@@ -950,9 +957,9 @@ set_print (arg, from_tty)
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*/
@@ -973,8 +980,9 @@ _initialize_valprint ()
"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);
@@ -1027,14 +1035,14 @@ _initialize_valprint ()
"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
diff --git a/gdb/valprint.h b/gdb/valprint.h
index 5918def..4d58641 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -32,9 +32,9 @@ extern unsigned int print_max; /* Max # of chars for strings/vectors */
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 *));
diff --git a/gdb/values.c b/gdb/values.c
index 9b12ad5..95b751a 100644
--- a/gdb/values.c
+++ b/gdb/values.c
@@ -360,7 +360,7 @@ show_values (num_exp, from_tty)
{
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");
}
@@ -512,11 +512,11 @@ show_convenience (ignore, from_tty)
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");
}
diff --git a/gdb/vax-pinsn.c b/gdb/vax-pinsn.c
index 622bb8f..350d906 100644
--- a/gdb/vax-pinsn.c
+++ b/gdb/vax-pinsn.c
@@ -35,7 +35,7 @@ static unsigned char *print_insn_arg ();
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
unsigned char buffer[MAXLEN];
register int i;
@@ -52,11 +52,11 @@ print_insn (memaddr, stream)
/* 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. */
@@ -64,14 +64,14 @@ print_insn (memaddr, stream)
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;
}
@@ -81,7 +81,7 @@ print_insn_arg (d, p, addr, stream)
char *d;
register char *p;
CORE_ADDR addr;
- FILE *stream;
+ GDB_FILE *stream;
{
register int regnum = *p & 0xf;
float floatlitbuf;
@@ -89,10 +89,10 @@ print_insn_arg (d, p, addr, stream)
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;
}
}
@@ -106,32 +106,32 @@ print_insn_arg (d, p, addr, stream)
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;
@@ -139,30 +139,30 @@ print_insn_arg (d, p, addr, stream)
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;
@@ -170,64 +170,64 @@ print_insn_arg (d, p, addr, stream)
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;
}
diff --git a/gdb/xcoffexec.c b/gdb/xcoffexec.c
index e9981f3..cb20bc3 100644
--- a/gdb/xcoffexec.c
+++ b/gdb/xcoffexec.c
@@ -184,7 +184,7 @@ char *filename;
else {
exec_close(0); /* just in case */
if (from_tty)
- printf("No exec file now.\n");
+ printf_unfiltered("No exec file now.\n");
}
}
@@ -277,7 +277,7 @@ sex_to_vmap(bfd *bf, sec_ptr sex, PTR arg3)
}
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
@@ -759,13 +759,13 @@ exec_files_info (t)
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,
@@ -925,7 +925,7 @@ xcoff_relocate_core ()
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;
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index f4bfd44..2ce0ce4 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -810,7 +810,7 @@ retrieve_tracebackinfo (abfd, textsec, cs)
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;
}
@@ -892,7 +892,7 @@ retrieve_traceback (abfd, textsec, cs, size)
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;
}
@@ -1051,7 +1051,7 @@ read_xcoff_symtab (objfile, nsyms)
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) {
@@ -1459,7 +1459,7 @@ function_entry_point:
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.. */
@@ -1681,7 +1681,7 @@ process_xcoff_symbol (cs, objfile)
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;
@@ -1858,7 +1858,7 @@ free_linetab ()
#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
@@ -1983,7 +1983,7 @@ init_debugsection(abfd)
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;
diff --git a/gdb/xcoffsolib.c b/gdb/xcoffsolib.c
index 7c5ed88..590de2c 100644
--- a/gdb/xcoffsolib.c
+++ b/gdb/xcoffsolib.c
@@ -74,7 +74,7 @@ solib_add (arg_string, from_tty, target)
/* 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 ? ") " : "",
@@ -82,12 +82,12 @@ solib_add (arg_string, from_tty, target)
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
@@ -101,7 +101,7 @@ solib_add (arg_string, from_tty, target)
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;
}
}
@@ -118,7 +118,7 @@ solib_add (arg_string, from_tty, target)
/* 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 */
@@ -154,19 +154,19 @@ register struct ld_info *ldi;
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 ",
diff --git a/gdb/z8k-tdep.c b/gdb/z8k-tdep.c
index cf6060b..ffec6f6 100644
--- a/gdb/z8k-tdep.c
+++ b/gdb/z8k-tdep.c
@@ -206,7 +206,7 @@ z8k_push_dummy_frame ()
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
- FILE *stream;
+ GDB_FILE *stream;
{
disassemble_info info;
@@ -352,8 +352,8 @@ print_register_hook (regno)
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)
@@ -365,8 +365,8 @@ print_register_hook (regno)
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)
{
@@ -375,10 +375,10 @@ print_register_hook (regno)
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));
}
}
@@ -421,7 +421,7 @@ z8k_set_pointer_size (newsize)
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)
{
@@ -457,8 +457,8 @@ set_memory (args, from_tty)
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