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