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