2 /* Debug macros for developemnt.
4 Free Software Foundation, Inc.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
38 static FILE *fout = NULL;
39 static char fname[128];
40 static int file_cnt = 0; /* count number of open files */
48 fdbg = fopen ("dbg.log", "a+");
55 /* Can't easily get the message back to gdb... write to a log instead. */
57 fputs_dbg (data, fakestream)
65 if (fakestream == stdout || fakestream == stderr || fakestream == NULL)
69 for (file_cnt = 0; file_cnt < 20; file_cnt++)
71 sprintf (fname, "dbg%d.log", file_cnt);
72 if ((fout = fopen (fname), "r") != NULL)
77 fout = fopen (fname, "w");
83 fprintf (fakestream, data);
89 #ifdef ANSI_PROTOTYPES
90 printf_dbg (const char *format,...)
98 #ifdef ANSI_PROTOTYPES
99 va_start (args, format);
104 format = va_arg (args, char *);
106 vsprintf (buf, format, args);