Detect the absence of a symbol hash table.
[deliverable/binutils-gdb.git] / gdb / main.c
CommitLineData
b8ec8d4a 1/* Top level stuff for GDB, the GNU debugger.
1a494973 2 Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995
51b57ded 3 Free Software Foundation, Inc.
bd5635a1
RP
4
5This file is part of GDB.
6
e522fb52 7This program is free software; you can redistribute it and/or modify
bd5635a1 8it under the terms of the GNU General Public License as published by
e522fb52
JG
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
bd5635a1 11
e522fb52 12This program is distributed in the hope that it will be useful,
bd5635a1
RP
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
e522fb52 18along with this program; if not, write to the Free Software
b52cac6b 19Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
bd5635a1 20
bd5635a1 21#include "defs.h"
b8ec8d4a
SS
22#include <setjmp.h>
23#include "top.h"
bd5635a1 24#include "target.h"
844750e3
SS
25#include "inferior.h"
26#include "call-cmds.h"
bd5635a1 27
e522fb52
JG
28#include "getopt.h"
29
bd5635a1 30#include <sys/types.h>
2b576293 31#include "gdb_stat.h"
844750e3 32#include <ctype.h>
b8ec8d4a 33
2b576293 34#include "gdb_string.h"
bd5635a1 35
9748446f 36/* Temporary variable for SET_TOP_LEVEL. */
86db943c 37
9748446f
JK
38static int top_level_val;
39
40/* Do a setjmp on error_return and quit_return. catch_errors is
41 generally a cleaner way to do this, but main() would look pretty
42 ugly if it had to use catch_errors each time. */
43
44#define SET_TOP_LEVEL() \
47792960
KS
45 (((top_level_val = SIGSETJMP (error_return)) \
46 ? (PTR) 0 : (PTR) memcpy (quit_return, error_return, sizeof (SIGJMP_BUF))) \
9748446f
JK
47 , top_level_val)
48
86db943c
SG
49/* If nonzero, display time usage both at startup and for each command. */
50
51int display_time;
52
53/* If nonzero, display space usage both at startup and for each command. */
54
55int display_space;
56
47792960
KS
57static void print_gdb_help PARAMS ((GDB_FILE *));
58extern void gdb_init PARAMS ((char *));
d836385e 59#ifdef __CYGWIN__
47792960 60#include <windows.h> /* for MAX_PATH */
d836385e 61#include <sys/cygwin.h> /* for cygwin_conv_to_posix_path */
47792960 62#endif
844750e3 63
bd5635a1
RP
64int
65main (argc, argv)
66 int argc;
67 char **argv;
68{
69 int count;
bd5635a1
RP
70 static int quiet = 0;
71 static int batch = 0;
72
73 /* Pointers to various arguments from command line. */
74 char *symarg = NULL;
75 char *execarg = NULL;
76 char *corearg = NULL;
77 char *cdarg = NULL;
78 char *ttyarg = NULL;
79
c307bb11
JK
80 /* These are static so that we can take their address in an initializer. */
81 static int print_help;
82 static int print_version;
83
84 /* Pointers to all arguments of --command option. */
bd5635a1
RP
85 char **cmdarg;
86 /* Allocated size of cmdarg. */
87 int cmdsize;
88 /* Number of elements of cmdarg used. */
89 int ncmd;
90
c307bb11 91 /* Indices of all arguments of --directory option. */
bd5635a1
RP
92 char **dirarg;
93 /* Allocated size. */
94 int dirsize;
95 /* Number of elements used. */
96 int ndir;
97
3a16d640
JG
98 struct stat homebuf, cwdbuf;
99 char *homedir, *homeinit;
100
bd5635a1
RP
101 register int i;
102
86db943c
SG
103 long time_at_startup = get_run_time ();
104
1a494973
C
105 START_PROGRESS (argv[0], 0);
106
a6b26c44 107#ifdef MPW
b8ec8d4a
SS
108 /* Do all Mac-specific setup. */
109 mac_init ();
a6b26c44 110#endif /* MPW */
1a494973 111
bd5635a1 112 /* This needs to happen before the first use of malloc. */
318bf84f 113 init_malloc ((PTR) NULL);
bd5635a1
RP
114
115#if defined (ALIGN_STACK_ON_STARTUP)
116 i = (int) &count & 0x3;
117 if (i != 0)
118 alloca (4 - i);
119#endif
120
bd099407 121 /* If error() is called from initialization code, just exit */
9748446f 122 if (SET_TOP_LEVEL ()) {
bd099407
JG
123 exit(1);
124 }
125
bd5635a1
RP
126 cmdsize = 1;
127 cmdarg = (char **) xmalloc (cmdsize * sizeof (*cmdarg));
128 ncmd = 0;
129 dirsize = 1;
130 dirarg = (char **) xmalloc (dirsize * sizeof (*dirarg));
131 ndir = 0;
132
133 quit_flag = 0;
134 line = (char *) xmalloc (linesize);
135 line[0] = '\0'; /* Terminate saved (now empty) cmd line */
136 instream = stdin;
137
b7ec5b8d
FF
138 getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
139 current_directory = gdb_dirbuf;
bd5635a1 140
bd5635a1
RP
141 /* Parse arguments and options. */
142 {
143 int c;
bd5635a1
RP
144 /* When var field is 0, use flag field to record the equivalent
145 short option (or arbitrary numbers starting at 10 for those
146 with no equivalent). */
147 static struct option long_options[] =
148 {
318bf84f
FF
149 {"readnow", no_argument, &readnow_symbol_files, 1},
150 {"r", no_argument, &readnow_symbol_files, 1},
151 {"mapped", no_argument, &mapped_symbol_files, 1},
152 {"m", no_argument, &mapped_symbol_files, 1},
ee0613d1
JG
153 {"quiet", no_argument, &quiet, 1},
154 {"q", no_argument, &quiet, 1},
fb29d681 155 {"silent", no_argument, &quiet, 1},
ee0613d1
JG
156 {"nx", no_argument, &inhibit_gdbinit, 1},
157 {"n", no_argument, &inhibit_gdbinit, 1},
158 {"batch", no_argument, &batch, 1},
159 {"epoch", no_argument, &epoch_interface, 1},
6c803036
JK
160
161 /* This is a synonym for "--annotate=1". --annotate is now preferred,
162 but keep this here for a long time because people will be running
163 emacses which use --fullname. */
164 {"fullname", no_argument, 0, 'f'},
165 {"f", no_argument, 0, 'f'},
166
167 {"annotate", required_argument, 0, 12},
ee0613d1
JG
168 {"help", no_argument, &print_help, 1},
169 {"se", required_argument, 0, 10},
170 {"symbols", required_argument, 0, 's'},
171 {"s", required_argument, 0, 's'},
172 {"exec", required_argument, 0, 'e'},
173 {"e", required_argument, 0, 'e'},
174 {"core", required_argument, 0, 'c'},
175 {"c", required_argument, 0, 'c'},
176 {"command", required_argument, 0, 'x'},
c307bb11 177 {"version", no_argument, &print_version, 1},
ee0613d1 178 {"x", required_argument, 0, 'x'},
7f6cb62e 179/* start-sanitize-gdbtk */
d836385e 180#ifdef GDBTK
7f6cb62e 181 {"tclcommand", required_argument, 0, 'z'},
d836385e 182#endif
7f6cb62e 183/* end-sanitize-gdbtk */
ee0613d1
JG
184 {"directory", required_argument, 0, 'd'},
185 {"cd", required_argument, 0, 11},
186 {"tty", required_argument, 0, 't'},
187 {"baud", required_argument, 0, 'b'},
188 {"b", required_argument, 0, 'b'},
86db943c
SG
189 {"nw", no_argument, &use_windows, 0},
190 {"nowindows", no_argument, &use_windows, 0},
191 {"w", no_argument, &use_windows, 1},
192 {"windows", no_argument, &use_windows, 1},
193 {"statistics", no_argument, 0, 13},
bd5635a1
RP
194/* Allow machine descriptions to add more options... */
195#ifdef ADDITIONAL_OPTIONS
196 ADDITIONAL_OPTIONS
197#endif
86db943c 198 {0, no_argument, 0, 0}
bd5635a1
RP
199 };
200
201 while (1)
202 {
ee0613d1
JG
203 int option_index;
204
bd5635a1
RP
205 c = getopt_long_only (argc, argv, "",
206 long_options, &option_index);
207 if (c == EOF)
208 break;
209
210 /* Long option that takes an argument. */
211 if (c == 0 && long_options[option_index].flag == 0)
212 c = long_options[option_index].val;
213
214 switch (c)
215 {
216 case 0:
217 /* Long option that just sets a flag. */
218 break;
219 case 10:
220 symarg = optarg;
221 execarg = optarg;
222 break;
223 case 11:
224 cdarg = optarg;
225 break;
6c803036
JK
226 case 12:
227 /* FIXME: what if the syntax is wrong (e.g. not digits)? */
228 annotation_level = atoi (optarg);
229 break;
86db943c
SG
230 case 13:
231 /* Enable the display of both time and space usage. */
232 display_time = 1;
233 display_space = 1;
234 break;
6c803036
JK
235 case 'f':
236 annotation_level = 1;
1a494973
C
237/* We have probably been invoked from emacs. Disable window interface. */
238 use_windows = 0;
6c803036 239 break;
bd5635a1
RP
240 case 's':
241 symarg = optarg;
242 break;
243 case 'e':
244 execarg = optarg;
245 break;
246 case 'c':
247 corearg = optarg;
248 break;
249 case 'x':
250 cmdarg[ncmd++] = optarg;
251 if (ncmd >= cmdsize)
252 {
253 cmdsize *= 2;
254 cmdarg = (char **) xrealloc ((char *)cmdarg,
255 cmdsize * sizeof (*cmdarg));
256 }
257 break;
7f6cb62e 258 /* start-sanitize-gdbtk */
d836385e 259#ifdef GDBTK
7f6cb62e
KS
260 case 'z':
261 {
262 extern int gdbtk_test PARAMS ((char *));
263 if (!gdbtk_test (optarg))
264 {
265 fprintf_unfiltered (gdb_stderr, "%s: unable to load tclcommand file \"%s\"",
266 argv[0], optarg);
267 exit (1);
268 }
269 break;
270 }
d836385e 271#endif /* GDBTK */
7f6cb62e 272 /* end-sanitize-gdbtk */
bd5635a1
RP
273 case 'd':
274 dirarg[ndir++] = optarg;
275 if (ndir >= dirsize)
276 {
277 dirsize *= 2;
278 dirarg = (char **) xrealloc ((char *)dirarg,
279 dirsize * sizeof (*dirarg));
280 }
281 break;
282 case 't':
283 ttyarg = optarg;
284 break;
285 case 'q':
286 quiet = 1;
287 break;
288 case 'b':
d0d8484a
SG
289 {
290 int i;
291 char *p;
292
293 i = strtol (optarg, &p, 0);
294 if (i == 0 && p == optarg)
8e4c7b3e
JK
295
296 /* Don't use *_filtered or warning() (which relies on
297 current_target) until after initialize_all_files(). */
298
299 fprintf_unfiltered
300 (gdb_stderr,
301 "warning: could not set baud rate to `%s'.\n", optarg);
d0d8484a
SG
302 else
303 baud_rate = i;
304 }
265c044a
DP
305 case 'l':
306 {
307 int i;
308 char *p;
309
310 i = strtol (optarg, &p, 0);
311 if (i == 0 && p == optarg)
312
313 /* Don't use *_filtered or warning() (which relies on
314 current_target) until after initialize_all_files(). */
315
316 fprintf_unfiltered
317 (gdb_stderr,
318 "warning: could not set timeout limit to `%s'.\n", optarg);
319 else
320 remote_timeout = i;
321 }
bd5635a1 322 break;
d0d8484a 323
bd5635a1
RP
324#ifdef ADDITIONAL_OPTION_CASES
325 ADDITIONAL_OPTION_CASES
326#endif
327 case '?':
199b2450 328 fprintf_unfiltered (gdb_stderr,
fb29d681 329 "Use `%s --help' for a complete list of options.\n",
bd5635a1
RP
330 argv[0]);
331 exit (1);
332 }
bd5635a1 333 }
fb29d681 334
b52cac6b
FF
335 /* If --help or --version, disable window interface. */
336 if (print_help || print_version)
337 use_windows = 0;
338
bd5635a1
RP
339 /* OK, that's all the options. The other arguments are filenames. */
340 count = 0;
341 for (; optind < argc; optind++)
342 switch (++count)
343 {
344 case 1:
345 symarg = argv[optind];
346 execarg = argv[optind];
347 break;
348 case 2:
349 corearg = argv[optind];
350 break;
351 case 3:
199b2450 352 fprintf_unfiltered (gdb_stderr,
bd5635a1
RP
353 "Excess command line arguments ignored. (%s%s)\n",
354 argv[optind], (optind == argc - 1) ? "" : " ...");
355 break;
356 }
357 if (batch)
358 quiet = 1;
359 }
360
47792960 361 gdb_init (argv[0]);
bd5635a1 362
c307bb11
JK
363 /* Do these (and anything which might call wrap_here or *_filtered)
364 after initialize_all_files. */
365 if (print_version)
366 {
199b2450 367 print_gdb_version (gdb_stdout);
c307bb11
JK
368 wrap_here ("");
369 printf_filtered ("\n");
370 exit (0);
371 }
372
373 if (print_help)
374 {
47792960
KS
375 print_gdb_help (gdb_stdout);
376 fputs_unfiltered ("\n", gdb_stdout);
c307bb11
JK
377 exit (0);
378 }
b52cac6b 379
bd5635a1
RP
380 if (!quiet)
381 {
81066208
JG
382 /* Print all the junk at the top, with trailing "..." if we are about
383 to read a symbol file (possibly slowly). */
199b2450 384 print_gdb_version (gdb_stdout);
81066208
JG
385 if (symarg)
386 printf_filtered ("..");
bd099407 387 wrap_here("");
199b2450 388 gdb_flush (gdb_stdout); /* Force to screen during slow operations */
bd5635a1
RP
389 }
390
81066208 391 error_pre_print = "\n\n";
1a494973
C
392 quit_pre_print = error_pre_print;
393
51b57ded
FF
394 /* We may get more than one warning, don't double space all of them... */
395 warning_pre_print = "\nwarning: ";
81066208 396
3a16d640
JG
397 /* Read and execute $HOME/.gdbinit file, if it exists. This is done
398 *before* all the command line arguments are processed; it sets
399 global parameters, which are independent of what file you are
400 debugging or what directory you are in. */
d836385e 401#ifdef __CYGWIN__
47792960
KS
402 {
403 char * tmp = getenv ("HOME");
404
405 if (tmp != NULL)
406 {
407 homedir = (char *) alloca (MAX_PATH+1);
d836385e 408 cygwin_conv_to_posix_path (tmp, homedir);
47792960 409 }
d836385e
GN
410 else
411 homedir = NULL;
47792960
KS
412 }
413#else
414 homedir = getenv ("HOME");
415#endif
3a16d640
JG
416 if (homedir)
417 {
47792960 418 homeinit = (char *) alloca (strlen (homedir) +
3a16d640 419 strlen (gdbinit) + 10);
47792960 420 strcpy (homeinit, homedir);
3a16d640
JG
421 strcat (homeinit, "/");
422 strcat (homeinit, gdbinit);
b52cac6b 423
9e77e83d 424 if (!inhibit_gdbinit)
3a16d640 425 {
9748446f 426 if (!SET_TOP_LEVEL ())
3a16d640
JG
427 source_command (homeinit, 0);
428 }
429 do_cleanups (ALL_CLEANUPS);
430
431 /* Do stats; no need to do them elsewhere since we'll only
432 need them if homedir is set. Make sure that they are
433 zero in case one of them fails (this guarantees that they
434 won't match if either exists). */
435
436 memset (&homebuf, 0, sizeof (struct stat));
437 memset (&cwdbuf, 0, sizeof (struct stat));
438
439 stat (homeinit, &homebuf);
440 stat (gdbinit, &cwdbuf); /* We'll only need this if
441 homedir was set. */
442 }
754e5da2 443
bd5635a1
RP
444 /* Now perform all the actions indicated by the arguments. */
445 if (cdarg != NULL)
446 {
9748446f 447 if (!SET_TOP_LEVEL ())
bd5635a1
RP
448 {
449 cd_command (cdarg, 0);
bd5635a1
RP
450 }
451 }
f266e564
JK
452 do_cleanups (ALL_CLEANUPS);
453
bd5635a1 454 for (i = 0; i < ndir; i++)
9748446f 455 if (!SET_TOP_LEVEL ())
bd5635a1 456 directory_command (dirarg[i], 0);
51b57ded 457 free ((PTR)dirarg);
f266e564
JK
458 do_cleanups (ALL_CLEANUPS);
459
bd5635a1
RP
460 if (execarg != NULL
461 && symarg != NULL
2e4964ad 462 && STREQ (execarg, symarg))
bd5635a1
RP
463 {
464 /* The exec file and the symbol-file are the same. If we can't open
465 it, better only print one error message. */
9748446f 466 if (!SET_TOP_LEVEL ())
bd5635a1
RP
467 {
468 exec_file_command (execarg, !batch);
81066208 469 symbol_file_command (symarg, 0);
bd5635a1
RP
470 }
471 }
472 else
473 {
474 if (execarg != NULL)
9748446f 475 if (!SET_TOP_LEVEL ())
bd5635a1
RP
476 exec_file_command (execarg, !batch);
477 if (symarg != NULL)
9748446f 478 if (!SET_TOP_LEVEL ())
81066208 479 symbol_file_command (symarg, 0);
bd5635a1 480 }
f266e564
JK
481 do_cleanups (ALL_CLEANUPS);
482
81066208
JG
483 /* After the symbol file has been read, print a newline to get us
484 beyond the copyright line... But errors should still set off
485 the error message with a (single) blank line. */
afe4ca15
JG
486 if (!quiet)
487 printf_filtered ("\n");
81066208 488 error_pre_print = "\n";
1a494973 489 quit_pre_print = error_pre_print;
318bf84f 490 warning_pre_print = "\nwarning: ";
81066208 491
bd5635a1 492 if (corearg != NULL)
9748446f 493 if (!SET_TOP_LEVEL ())
bd5635a1 494 core_file_command (corearg, !batch);
9748446f 495 else if (isdigit (corearg[0]) && !SET_TOP_LEVEL ())
bd5635a1 496 attach_command (corearg, !batch);
f266e564 497 do_cleanups (ALL_CLEANUPS);
bd5635a1
RP
498
499 if (ttyarg != NULL)
9748446f 500 if (!SET_TOP_LEVEL ())
bd5635a1 501 tty_command (ttyarg, !batch);
f266e564 502 do_cleanups (ALL_CLEANUPS);
bd5635a1
RP
503
504#ifdef ADDITIONAL_OPTION_HANDLER
505 ADDITIONAL_OPTION_HANDLER;
506#endif
507
81066208 508 /* Error messages should no longer be distinguished with extra output. */
1a494973
C
509 error_pre_print = NULL;
510 quit_pre_print = NULL;
318bf84f 511 warning_pre_print = "warning: ";
81066208 512
3a16d640
JG
513 /* Read the .gdbinit file in the current directory, *if* it isn't
514 the same as the $HOME/.gdbinit file (it should exist, also). */
515
516 if (!homedir
517 || memcmp ((char *) &homebuf, (char *) &cwdbuf, sizeof (struct stat)))
9e77e83d 518 if (!inhibit_gdbinit)
bd5635a1 519 {
9748446f 520 if (!SET_TOP_LEVEL ())
d75710b0 521 source_command (gdbinit, 0);
bd5635a1 522 }
d75710b0
FF
523 do_cleanups (ALL_CLEANUPS);
524
525 for (i = 0; i < ncmd; i++)
526 {
9748446f 527 if (!SET_TOP_LEVEL ())
d75710b0
FF
528 {
529 if (cmdarg[i][0] == '-' && cmdarg[i][1] == '\0')
530 read_command_file (stdin);
531 else
532 source_command (cmdarg[i], !batch);
533 do_cleanups (ALL_CLEANUPS);
534 }
535 }
51b57ded 536 free ((PTR)cmdarg);
bd5635a1 537
8b3c897a 538 /* Read in the old history after all the command files have been read. */
fc61e9ee 539 init_history();
8b3c897a 540
bd5635a1
RP
541 if (batch)
542 {
543 /* We have hit the end of the batch file. */
544 exit (0);
545 }
546
547 /* Do any host- or target-specific hacks. This is used for i960 targets
548 to force the user to set a nindy target and spec its parameters. */
549
550#ifdef BEFORE_MAIN_LOOP_HOOK
551 BEFORE_MAIN_LOOP_HOOK;
552#endif
553
1a494973
C
554 END_PROGRESS (argv[0]);
555
86db943c
SG
556 /* Show time and/or space usage. */
557
558 if (display_time)
559 {
560 long init_time = get_run_time () - time_at_startup;
561
562 printf_unfiltered ("Startup time: %ld.%06ld\n",
563 init_time / 1000000, init_time % 1000000);
564 }
565
566 if (display_space)
567 {
265c044a 568#ifdef HAVE_SBRK
86db943c
SG
569 extern char **environ;
570 char *lim = (char *) sbrk (0);
571
572 printf_unfiltered ("Startup size: data size %ld\n",
573 (long) (lim - (char *) &environ));
265c044a 574#endif
86db943c
SG
575 }
576
1a494973
C
577 /* The default command loop.
578 The WIN32 Gui calls this main to set up gdb's state, and
579 has its own command loop. */
47792960 580#if !defined _WIN32 || defined __GNUC__
bd5635a1
RP
581 while (1)
582 {
9748446f 583 if (!SET_TOP_LEVEL ())
bd5635a1 584 {
f266e564 585 do_cleanups (ALL_CLEANUPS); /* Do complete cleanup */
754e5da2
SG
586 /* GUIs generally have their own command loop, mainloop, or whatever.
587 This is a good place to gain control because many error
588 conditions will end up here via longjmp(). */
589 if (command_loop_hook)
590 command_loop_hook ();
a6b26c44 591 else
754e5da2 592 command_loop ();
bd5635a1
RP
593 quit_command ((char *)0, instream == stdin);
594 }
595 }
1a494973 596
bd5635a1 597 /* No exit -- exit is through quit_command. */
1a494973
C
598#endif
599
bd5635a1 600}
47792960
KS
601
602/* Don't use *_filtered for printing help. We don't want to prompt
603 for continue no matter how small the screen or how much we're going
604 to print. */
605
606static void
607print_gdb_help (stream)
608 GDB_FILE *stream;
609{
610 fputs_unfiltered ("\
611This is the GNU debugger. Usage:\n\n\
612 gdb [options] [executable-file [core-file or process-id]]\n\n\
613Options:\n\n\
614", stream);
615 fputs_unfiltered ("\
616 -b BAUDRATE Set serial port baud rate used for remote debugging.\n\
617 --batch Exit after processing options.\n\
618 --cd=DIR Change current directory to DIR.\n\
619 --command=FILE Execute GDB commands from FILE.\n\
620 --core=COREFILE Analyze the core dump COREFILE.\n\
621", stream);
622 fputs_unfiltered ("\
623 --directory=DIR Search for source files in DIR.\n\
624 --epoch Output information used by epoch emacs-GDB interface.\n\
625 --exec=EXECFILE Use EXECFILE as the executable.\n\
626 --fullname Output information used by emacs-GDB interface.\n\
627 --help Print this message.\n\
628", stream);
629 fputs_unfiltered ("\
630 --mapped Use mapped symbol files if supported on this system.\n\
631 --nw Do not use a window interface.\n\
632 --nx Do not read .gdbinit file.\n\
633 --quiet Do not print version number on startup.\n\
634 --readnow Fully read symbol files on first access.\n\
635", stream);
636 fputs_unfiltered ("\
637 --se=FILE Use FILE as symbol file and executable file.\n\
638 --symbols=SYMFILE Read symbols from SYMFILE.\n\
639 --tty=TTY Use TTY for input/output by the program being debugged.\n\
640 --version Print version information and then exit.\n\
641", stream);
642#ifdef ADDITIONAL_OPTION_HELP
643 fputs_unfiltered (ADDITIONAL_OPTION_HELP, stream);
644#endif
645 fputs_unfiltered ("\n\
646For more information, type \"help\" from within GDB, or consult the\n\
647GDB manual (available as on-line info or a printed manual).\n\
648Report bugs to \"bug-gdb@prep.ai.mit.edu\".\
649", stream);
650}
651
d3507982
JK
652\f
653void
654init_proc ()
655{
656}
657
d3507982
JK
658void
659proc_remove_foreign (pid)
660 int pid;
661{
662}
bd5635a1 663
47792960
KS
664/* All I/O sent to the *_filtered and *_unfiltered functions eventually ends up
665 here. The fputs_unfiltered_hook is primarily used by GUIs to collect all
666 output and send it to the GUI, instead of the controlling terminal. Only
667 output to gdb_stdout and gdb_stderr are sent to the hook. Everything else
668 is sent on to fputs to allow file I/O to be handled appropriately. */
669
bd5635a1 670void
b8ec8d4a
SS
671fputs_unfiltered (linebuffer, stream)
672 const char *linebuffer;
673 FILE *stream;
bd5635a1 674{
47792960
KS
675 if (fputs_unfiltered_hook
676 && (stream == gdb_stdout
677 || stream == gdb_stderr))
678 fputs_unfiltered_hook (linebuffer, stream);
679 else
680 fputs (linebuffer, stream);
bd5635a1 681}
This page took 0.374794 seconds and 4 git commands to generate.