1 /* Top level stuff for GDB, the GNU debugger.
2 Copyright 1999 Free Software Foundation, Inc.
3 Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions.
5 This file is part of GDB.
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.
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.
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. */
22 #include "event-loop.h"
28 /* readline include files */
29 #include <readline/readline.h>
30 #include <readline/history.h>
32 /* readline defines this. */
35 extern FILE *instream
;
37 static void command_line_handler
PARAMS ((char *));
38 static void gdb_readline2
PARAMS ((void));
39 static void pop_prompt
PARAMS ((void));
40 static void push_prompt
PARAMS ((char *, char *, char *));
41 static void change_line_handler
PARAMS ((void));
42 static void change_annotation_level
PARAMS ((void));
43 static void command_handler
PARAMS ((char *));
45 /* Signal handlers. */
46 void handle_sigint
PARAMS ((int));
47 void handle_sigquit
PARAMS ((int));
48 void handle_sighup
PARAMS ((int));
49 void handle_sigfpe
PARAMS ((int));
50 void handle_sigwinch
PARAMS ((int));
52 /* Functions to be invoked by the event loop in response to
54 void async_request_quit
PARAMS ((void));
55 void async_do_nothing
PARAMS ((void));
56 void async_disconnect
PARAMS ((void));
57 void async_float_handler
PARAMS ((void));
59 /* Functions from top.c. */
60 extern void command_loop_marker
PARAMS ((int));
61 extern int quit_cover
PARAMS ((PTR
));
62 extern void quit_command
PARAMS ((char *, int));
63 extern void execute_command
PARAMS ((char *, int));
65 /* Variables from top.c. */
66 extern int source_line_number
;
67 extern char *source_file_name
;
68 extern char *source_error
;
69 extern char *source_pre_error
;
70 extern int history_expansion_p
;
71 extern int server_command
;
73 /* If this definition isn't overridden by the header files, assume
74 that isatty and fileno exist on this system. */
76 #define ISATTY(FP) (isatty (fileno (FP)))
79 /* Hook for alternate command interface. */
80 void (*async_hook
) PARAMS ((void));
82 /* Readline offers an alternate interface, via callback
83 functions. These are all included in the file callback.c in the
84 readline distribution. This file provides (mainly) a function, which
85 the event loop uses as callback (i.e. event handler) whenever an event
86 is detected on the standard input file descriptor.
87 readline_callback_read_char is called (by the GDB event loop) whenever
88 there is a new character ready on the input stream. This function
89 incrementally builds a buffer internal to readline where it
90 accumulates the line read up to the point of invocation. In the
91 special case in which the character read is newline, the function
92 invokes a GDB supplied callback routine, which does the processing of
93 a full command line. This latter routine is the asynchronous analog
94 of the old command_line_input in gdb. Instead of invoking (and waiting
95 for) readline to read the command line and pass it back to
96 command_loop for processing, the new command_line_handler function has
97 the command line already available as its parameter. INPUT_HANDLER is
98 to be set to the function that readline will invoke when a complete
99 line of input is ready. CALL_READLINE is to be set to the function
100 that readline offers as callback to the event_loop. */
102 void (*input_handler
) PARAMS ((char *));
103 void (*call_readline
) PARAMS ((void));
105 /* Important variables for the event loop. */
107 /* This is used to determine if GDB is using the readline library or
108 its own simplified form of readline. It is used by the asynchronous
109 form of the set editing command.
110 ezannoni: as of 1999-04-29 I expect that this
111 variable will not be used after gdb is changed to use the event
112 loop as default engine, and event-top.c is merged into top.c. */
113 int async_command_editing_p
;
115 /* This variable contains the new prompt that the user sets with the
116 set prompt command. */
117 char *new_async_prompt
;
119 /* This is the annotation suffix that will be used when the
120 annotation_level is 2. */
121 char *async_annotation_suffix
;
123 /* This is the file descriptor for the input stream that GDB uses to
124 read commands from. */
127 /* This is the prompt stack. Prompts will be pushed on the stack as
128 needed by the different 'kinds' of user inputs GDB is asking
129 for. See event-loop.h. */
130 struct prompts the_prompts
;
132 /* signal handling variables */
133 /* Each of these is a pointer to a function that the event loop will
134 invoke if the corresponding signal has received. The real signal
135 handlers mark these functions as ready to be executed and the event
136 loop, in a later iteration, calls them. See the function
137 invoke_async_signal_handler. */
138 async_signal_handler
*sigint_token
;
140 async_signal_handler
*sighup_token
;
142 async_signal_handler
*sigquit_token
;
143 async_signal_handler
*sigfpe_token
;
144 #if defined(SIGWINCH) && defined(SIGWINCH_HANDLER)
145 async_signal_handler
*sigwinch_token
;
148 /* Structure to save a partially entered command. This is used when
149 the user types '\' at the end of a command line. This is necessary
150 because each line of input is handled by a different call to
151 command_line_handler, and normally there is no state retained
152 between different calls. */
153 int more_to_come
= 0;
155 struct readline_input_state
158 char *linebuffer_ptr
;
160 readline_input_state
;
163 /* Initialize all the necessary variables, start the event loop,
164 register readline, and stdin. */
168 int length
= strlen (PREFIX (0)) + strlen (PROMPT (0)) + strlen (SUFFIX (0)) + 1;
169 char *a_prompt
= (char *) xmalloc (length
);
171 /* Set things up for readline to be invoked via the alternate
172 interface, i.e. via a callback function (rl_callback_read_char). */
173 call_readline
= rl_callback_read_char
;
175 /* When readline has read an end-of-line character, it passes the
176 complete line to gdb for processing. command_line_handler is the
177 function that does this. */
178 input_handler
= command_line_handler
;
180 /* Tell readline what the prompt to display is and what function it
181 will need to call after a whole line is read. */
182 strcpy (a_prompt
, PREFIX (0));
183 strcat (a_prompt
, PROMPT (0));
184 strcat (a_prompt
, SUFFIX (0));
185 rl_callback_handler_install (a_prompt
, input_handler
);
187 /* Tell readline to use the same input stream that gdb uses. */
188 rl_instream
= instream
;
189 /* Get a file descriptor for the input stream, so that we can
190 register it with the event loop. */
191 input_fd
= fileno (instream
);
193 /* Now we need to create the event sources for the input file descriptor. */
194 /* At this point in time, this is the only event source that we
195 register with the even loop. Another source is going to be the
196 target program (inferior), but that must be registered only when
197 it actually exists (I.e. after we say 'run' or after we connect
198 to a remote target. */
200 create_file_handler (input_fd
, POLLIN
,
201 (file_handler_func
*) call_readline
, 0);
203 create_file_handler (input_fd
, GDB_READABLE
,
204 (file_handler_func
*) call_readline
, 0);
207 /* Loop until there is something to do. This is the entry point to
208 the event loop engine. gdb_do_one_event will process one event
209 for each invocation. It always returns 1, unless there are no
210 more event sources registered. In this case it returns 0. */
211 while (gdb_do_one_event () != 0)
214 /* We are done with the event loop. There are no more event sources
215 to listen to. So we exit GDB. */
219 /* Change the function to be invoked every time there is a character
220 ready on stdin. This is used when the user sets the editing off,
221 therefore bypassing readline, and letting gdb handle the input
222 itself, via gdb_readline2. Also it is used in the opposite case in
223 which the user sets editing on again, by restoring readline
224 handling of the input. */
226 change_line_handler ()
228 if (async_command_editing_p
)
230 /* Turn on editing by using readline. */
231 call_readline
= rl_callback_read_char
;
235 /* Turn off editing by using gdb_readline2. */
236 rl_callback_handler_remove ();
237 call_readline
= gdb_readline2
;
240 /* To tell the event loop to change the handler associated with the
241 input file descriptor, we need to create a new event source,
242 corresponding to the same fd, but with a new event handler
244 delete_file_handler (input_fd
);
246 create_file_handler (input_fd
, POLLIN
,
247 (file_handler_func
*) call_readline
, 0);
249 create_file_handler (input_fd
, GDB_READABLE
,
250 (file_handler_func
*) call_readline
, 0);
254 /* Displays the prompt. The prompt that is displayed is the current
255 top of the prompt stack, if the argument NEW_PROMPT is
256 0. Otherwise, it displays whatever NEW_PROMPT is. This is used
257 after each gdb command has completed, and in the following cases:
258 1. when the user enters a command line which is ended by '\'
259 indicating that the command will continue on the next line.
260 In that case the prompt that is displayed is the empty string.
261 2. When the user is entering 'commands' for a breakpoint, or
262 actions for a tracepoint. In this case the prompt will be '>'
264 FIXME: 2. & 3. not implemented yet for async. */
266 display_gdb_prompt (new_prompt
)
269 int prompt_length
= 0;
273 /* Just use the top of the prompt stack. */
274 prompt_length
= strlen (PREFIX (0)) +
275 strlen (SUFFIX (0)) +
276 strlen (PROMPT (0)) + 1;
278 new_prompt
= (char *) alloca (prompt_length
);
280 /* Prefix needs to have new line at end. */
281 strcpy (new_prompt
, PREFIX (0));
282 strcat (new_prompt
, PROMPT (0));
283 /* Suffix needs to have a new line at end and \032 \032 at
285 strcat (new_prompt
, SUFFIX (0));
288 if (async_command_editing_p
)
290 rl_callback_handler_remove ();
291 rl_callback_handler_install (new_prompt
, input_handler
);
295 /* Don't use a _filtered function here. It causes the assumed
296 character position to be off, since the newline we read from
297 the user is not accounted for. */
298 fputs_unfiltered (new_prompt
, gdb_stdout
);
301 /* Move to a new line so the entered line doesn't have a prompt
302 on the front of it. */
303 fputs_unfiltered ("\n", gdb_stdout
);
305 gdb_flush (gdb_stdout
);
309 /* Used when the user requests a different annotation level, with
310 'set annotate'. It pushes a new prompt (with prefix and suffix) on top
311 of the prompt stack, if the annotation level desired is 2, otherwise
312 it pops the top of the prompt stack when we want the annotation level
313 to be the normal ones (1 or 2). */
315 change_annotation_level ()
317 char *prefix
, *suffix
;
319 if (!PREFIX (0) || !PROMPT (0) || !SUFFIX (0))
321 /* The prompt stack has not been initialized to "", we are
322 using gdb w/o the --async switch */
323 warning ("Command has same effect as set annotate");
327 if (annotation_level
> 1)
329 if (!strcmp (PREFIX (0), "") && !strcmp (SUFFIX (0), ""))
331 /* Push a new prompt if the previous annotation_level was not >1. */
332 prefix
= (char *) alloca (strlen (async_annotation_suffix
) + 10);
333 strcpy (prefix
, "\n\032\032pre-");
334 strcat (prefix
, async_annotation_suffix
);
335 strcat (prefix
, "\n");
337 suffix
= (char *) alloca (strlen (async_annotation_suffix
) + 6);
338 strcpy (suffix
, "\n\032\032");
339 strcat (suffix
, async_annotation_suffix
);
340 strcat (suffix
, "\n");
342 push_prompt (prefix
, (char *) 0, suffix
);
347 if (strcmp (PREFIX (0), "") && strcmp (SUFFIX (0), ""))
349 /* Pop the top of the stack, we are going back to annotation < 1. */
355 /* Pushes a new prompt on the prompt stack. Each prompt has three
356 parts: prefix, prompt, suffix. Usually prefix and suffix are empty
357 strings, except when the annotation level is 2. Memory is allocated
358 within savestring for the new prompt. */
360 push_prompt (prefix
, prompt
, suffix
)
366 PREFIX (0) = savestring (prefix
, strlen (prefix
));
369 PROMPT (0) = savestring (prompt
, strlen (prompt
));
371 PROMPT (0) = savestring (PROMPT (-1), strlen (PROMPT (-1)));
373 SUFFIX (0) = savestring (suffix
, strlen (suffix
));
376 /* Pops the top of the prompt stack, and frees the memory allocated for it. */
380 if (strcmp (PROMPT (0), PROMPT (-1)))
383 PROMPT (-1) = savestring (PROMPT (0), strlen (PROMPT (0)));
392 /* Handles a gdb command. This function is called by
393 command_line_handler, which has processed one or more input lines
395 /* NOTE: 1999-04-30 This is the asynchronous version of the command_loop
396 function. The command_loop function will be obsolete when we
397 switch to use the event loop at every execution of gdb. */
399 command_handler (command
)
402 struct cleanup
*old_chain
;
403 int stdin_is_tty
= ISATTY (stdin
);
404 long time_at_cmd_start
;
406 long space_at_cmd_start
= 0;
408 extern int display_time
;
409 extern int display_space
;
412 extern int insert_mode
;
416 if (instream
== stdin
&& stdin_is_tty
)
417 reinitialize_more_filter ();
418 old_chain
= make_cleanup ((make_cleanup_func
) command_loop_marker
, 0);
423 /* If readline returned a NULL command, it means that the
424 connection with the terminal is gone. This happens at the
425 end of a testsuite run, after Expect has hung up
426 but GDB is still alive. In such a case, we just quit gdb
427 killing the inferior program too. */
429 quit_command ((char *) 0, stdin
== instream
);
431 time_at_cmd_start
= get_run_time ();
436 extern char **environ
;
437 char *lim
= (char *) sbrk (0);
439 space_at_cmd_start
= (long) (lim
- (char *) &environ
);
443 execute_command (command
, instream
== stdin
);
445 /* Do any commands attached to breakpoint we stopped at. */
446 bpstat_do_actions (&stop_bpstat
);
447 do_cleanups (old_chain
);
451 long cmd_time
= get_run_time () - time_at_cmd_start
;
453 printf_unfiltered ("Command execution time: %ld.%06ld\n",
454 cmd_time
/ 1000000, cmd_time
% 1000000);
460 extern char **environ
;
461 char *lim
= (char *) sbrk (0);
462 long space_now
= lim
- (char *) &environ
;
463 long space_diff
= space_now
- space_at_cmd_start
;
465 printf_unfiltered ("Space used: %ld (%c%ld for this command)\n",
467 (space_diff
>= 0 ? '+' : '-'),
473 /* Handle a complete line of input. This is called by the callback
474 mechanism within the readline library. Deal with incomplete commands
475 as well, by saving the partial input in a global buffer. */
477 /* NOTE: 1999-04-30 This is the asynchronous version of the
478 command_line_input function. command_line_input will become
479 obsolete once we use the event loop as the default mechanism in
482 command_line_handler (rl
)
485 static char *linebuffer
= 0;
486 static unsigned linelength
= 0;
489 int change_prompt
= 0;
496 int repeat
= (instream
== stdin
);
498 if (annotation_level
> 1 && instream
== stdin
)
500 printf_unfiltered ("\n\032\032post-");
501 printf_unfiltered (async_annotation_suffix
);
502 printf_unfiltered ("\n");
508 linebuffer
= (char *) xmalloc (linelength
);
515 strcpy (linebuffer
, readline_input_state
.linebuffer
);
516 p
= readline_input_state
.linebuffer_ptr
;
517 free (readline_input_state
.linebuffer
);
524 signal (STOP_SIGNAL
, stop_sig
);
527 /* Make sure that all output has been output. Some machines may let
528 you get away with leaving out some of the gdb_flush, but not all. */
530 gdb_flush (gdb_stdout
);
531 gdb_flush (gdb_stderr
);
533 if (source_file_name
!= NULL
)
535 ++source_line_number
;
536 sprintf (source_error
,
537 "%s%s:%d: Error in sourced command file:\n",
541 error_pre_print
= source_error
;
544 /* If we are in this case, then command_handler will call quit
545 and exit from gdb. */
546 if (!rl
|| rl
== (char *) EOF
)
551 if (strlen (rl
) + 1 + (p
- linebuffer
) > linelength
)
553 linelength
= strlen (rl
) + 1 + (p
- linebuffer
);
554 nline
= (char *) xrealloc (linebuffer
, linelength
);
555 p
+= nline
- linebuffer
;
559 /* Copy line. Don't copy null at end. (Leaves line alone
560 if this was just a newline) */
564 free (rl
); /* Allocated in readline. */
566 if (p
== linebuffer
|| *(p
- 1) == '\\')
568 /* We come here also if the line entered is empty (just a 'return') */
569 p
--; /* Put on top of '\'. */
573 readline_input_state
.linebuffer
= savestring (linebuffer
,
574 strlen (linebuffer
));
575 readline_input_state
.linebuffer_ptr
= p
;
577 /* We will not invoke a execute_command if there is more
578 input expected to complete the command. So, we need to
579 print an empty prompt here. */
580 display_gdb_prompt ("");
587 signal (STOP_SIGNAL
, SIG_DFL
);
590 #define SERVER_COMMAND_LENGTH 7
592 (p
- linebuffer
> SERVER_COMMAND_LENGTH
)
593 && STREQN (linebuffer
, "server ", SERVER_COMMAND_LENGTH
);
596 /* Note that we don't set `line'. Between this and the check in
597 dont_repeat, this insures that repeating will still do the
600 command_handler (linebuffer
+ SERVER_COMMAND_LENGTH
);
601 display_gdb_prompt (0);
605 /* Do history expansion if that is wished. */
606 if (history_expansion_p
&& instream
== stdin
607 && ISATTY (instream
))
612 *p
= '\0'; /* Insert null now. */
613 expanded
= history_expand (linebuffer
, &history_value
);
616 /* Print the changes. */
617 printf_unfiltered ("%s\n", history_value
);
619 /* If there was an error, call this function again. */
622 free (history_value
);
625 if (strlen (history_value
) > linelength
)
627 linelength
= strlen (history_value
) + 1;
628 linebuffer
= (char *) xrealloc (linebuffer
, linelength
);
630 strcpy (linebuffer
, history_value
);
631 p
= linebuffer
+ strlen (linebuffer
);
632 free (history_value
);
636 /* If we just got an empty line, and that is supposed
637 to repeat the previous command, return the value in the
639 if (repeat
&& p
== linebuffer
&& *p
!= '\\')
641 command_handler (line
);
642 display_gdb_prompt (0);
646 for (p1
= linebuffer
; *p1
== ' ' || *p1
== '\t'; p1
++);
649 command_handler (line
);
650 display_gdb_prompt (0);
656 /* Add line to history if appropriate. */
657 if (instream
== stdin
658 && ISATTY (stdin
) && *linebuffer
)
659 add_history (linebuffer
);
661 /* Note: lines consisting solely of comments are added to the command
662 history. This is useful when you type a command, and then
663 realize you don't want to execute it quite yet. You can comment
664 out the command and then later fetch it from the value history
665 and remove the '#'. The kill ring is probably better, but some
666 people are in the habit of commenting things out. */
668 *p1
= '\0'; /* Found a comment. */
670 /* Save into global buffer if appropriate. */
673 if (linelength
> linesize
)
675 line
= xrealloc (line
, linelength
);
676 linesize
= linelength
;
678 strcpy (line
, linebuffer
);
681 command_handler (line
);
682 display_gdb_prompt (0);
687 command_handler (linebuffer
);
688 display_gdb_prompt (0);
692 /* Does reading of input from terminal w/o the editing features
693 provided by the readline library. */
695 /* NOTE: 1999-04-30 Asynchronous version of gdb_readline. gdb_readline
696 will become obsolete when the event loop is made the default
697 execution for gdb. */
704 int result_size
= 80;
706 result
= (char *) xmalloc (result_size
);
708 /* We still need the while loop here, even though it would seem
709 obvious to invoke gdb_readline2 at every character entered. If
710 not using the readline library, the terminal is in cooked mode,
711 which sends the characters all at once. Poll will notice that the
712 input fd has changed state only after enter is pressed. At this
713 point we still need to fetch all the chars entered. */
717 /* Read from stdin if we are executing a user defined command.
718 This is the right thing for prompt_for_continue, at least. */
719 c
= fgetc (instream
? instream
: stdin
);
724 /* The last line does not end with a newline. Return it, and
725 if we are called again fgetc will still return EOF and
726 we'll return NULL then. */
729 command_line_handler (0);
733 #ifndef CRLF_SOURCE_FILES
737 if (input_index
> 0 && result
[input_index
- 1] == '\r')
743 result
[input_index
++] = c
;
744 while (input_index
>= result_size
)
747 result
= (char *) xrealloc (result
, result_size
);
751 result
[input_index
++] = '\0';
752 command_line_handler (result
);
756 /* Initialization of signal handlers and tokens. There is a function
757 handle_sig* for each of the signals GDB cares about. Specifically:
758 SIGINT, SIGFPE, SIGQUIT, SIGTSTP, SIGHUP, SIGWINCH. These
759 functions are the actual signal handlers associated to the signals
760 via calls to signal(). The only job for these functions is to
761 enqueue the appropriate event/procedure with the event loop. Such
762 procedures are the old signal handlers. The event loop will take
763 care of invoking the queued procedures to perform the usual tasks
764 associated with the reception of the signal. */
765 /* NOTE: 1999-04-30 This is the asynchronous version of init_signals.
766 init_signals will become obsolete as we move to have to event loop
767 as the default for gdb. */
769 async_init_signals ()
771 signal (SIGINT
, handle_sigint
);
773 create_async_signal_handler ((async_handler_func
*) async_request_quit
, NULL
);
775 /* If SIGTRAP was set to SIG_IGN, then the SIG_IGN will get passed
776 to the inferior and breakpoints will be ignored. */
778 signal (SIGTRAP
, SIG_DFL
);
781 /* If we initialize SIGQUIT to SIG_IGN, then the SIG_IGN will get
782 passed to the inferior, which we don't want. It would be
783 possible to do a "signal (SIGQUIT, SIG_DFL)" after we fork, but
784 on BSD4.3 systems using vfork, that can affect the
785 GDB process as well as the inferior (the signal handling tables
786 might be in memory, shared between the two). Since we establish
787 a handler for SIGQUIT, when we call exec it will set the signal
788 to SIG_DFL for us. */
789 signal (SIGQUIT
, handle_sigquit
);
791 create_async_signal_handler ((async_handler_func
*) async_do_nothing
, NULL
);
793 if (signal (SIGHUP
, handle_sighup
) != SIG_IGN
)
795 create_async_signal_handler ((async_handler_func
*) async_disconnect
, NULL
);
798 create_async_signal_handler ((async_handler_func
*) async_do_nothing
, NULL
);
800 signal (SIGFPE
, handle_sigfpe
);
802 create_async_signal_handler ((async_handler_func
*) async_float_handler
, NULL
);
804 #if defined(SIGWINCH) && defined(SIGWINCH_HANDLER)
805 signal (SIGWINCH
, handle_sigwinch
);
807 create_async_signal_handler ((async_handler_func
*) SIGWINCH_HANDLER
, NULL
);
811 /* Tell the event loop what to do if SIGINT is received.
812 See event-signal.c. */
817 signal (sig
, handle_sigint
);
819 /* If immediate_quit is set, we go ahead and process the SIGINT right
820 away, even if we usually would defer this to the event loop. The
821 assumption here is that it is safe to process ^C immediately if
822 immediate_quit is set. If we didn't, SIGINT would be really
823 processed only the next time through the event loop. To get to
824 that point, though, the command that we want to interrupt needs to
825 finish first, which is unacceptable. */
827 async_request_quit ();
829 /* If immediate quit is not set, we process SIGINT the next time
830 through the loop, which is fine. */
831 mark_async_signal_handler (sigint_token
);
834 /* Do the quit. All the checks have been done by the caller. */
836 async_request_quit ()
846 /* Tell the event loop what to do if SIGQUIT is received.
847 See event-signal.c. */
852 mark_async_signal_handler (sigquit_token
);
853 signal (sig
, handle_sigquit
);
856 /* Called by the event loop in response to a SIGQUIT. */
860 /* Empty function body. */
864 /* Tell the event loop what to do if SIGHUP is received.
865 See event-signal.c. */
870 mark_async_signal_handler (sighup_token
);
871 signal (sig
, handle_sighup
);
874 /* Called by the event loop to process a SIGHUP. */
878 catch_errors (quit_cover
, NULL
,
879 "Could not kill the program being debugged",
881 signal (SIGHUP
, SIG_DFL
); /*FIXME: ??????????? */
882 kill (getpid (), SIGHUP
);
886 /* Tell the event loop what to do if SIGFPE is received.
887 See event-signal.c. */
892 mark_async_signal_handler (sigfpe_token
);
893 signal (sig
, handle_sigfpe
);
896 /* Event loop will call this functin to process a SIGFPE. */
898 async_float_handler ()
900 /* This message is based on ANSI C, section 4.7. Note that integer
901 divide by zero causes this, so "float" is a misnomer. */
902 error ("Erroneous arithmetic operation.");
905 /* Tell the event loop what to do if SIGWINCH is received.
906 See event-signal.c. */
907 #if defined(SIGWINCH) && defined(SIGWINCH_HANDLER)
909 handle_sigwinch (sig
)
912 mark_async_signal_handler (sigwinch_token
);
913 signal (sig
, handle_sigwinch
);
918 /* Called by do_setshow_command. */
921 set_async_editing_command (args
, from_tty
, c
)
924 struct cmd_list_element
*c
;
926 change_line_handler ();
929 /* Called by do_setshow_command. */
932 set_async_annotation_level (args
, from_tty
, c
)
935 struct cmd_list_element
*c
;
937 change_annotation_level ();
940 /* Called by do_setshow_command. */
943 set_async_prompt (args
, from_tty
, c
)
946 struct cmd_list_element
*c
;
948 PROMPT (0) = savestring (new_async_prompt
, strlen (new_async_prompt
));
This page took 0.07088 seconds and 5 git commands to generate.