1 /* Definitions used by GDB event-top.c.
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,
20 Boston, MA 02111-1307, USA. */
22 /* Stack for prompts. Each prompt is composed as a prefix, a prompt
23 and a suffix. The prompt to be displayed at any given time is the
24 one on top of the stack. A stack is necessary because of cases in
25 which the execution of a gdb command requires further input from
26 the user, like for instance 'commands' for breakpoints and
27 'actions' for tracepoints. In these cases, the prompt is '>' and
28 gdb should process input using the asynchronous readline interface
29 and the event loop. In order to achieve this, we need to save
30 somewhere the state of GDB, i.e. that it is processing user input
31 as part of a command and not as part of the top level command loop.
32 The prompt stack represents part of the saved state. Another part
33 would be the function that readline would invoke after a whole line
34 of input has ben entered. This second piece would be something
35 like, for instance, where to return within the code for the actions
36 commands after a line has been read. This latter portion has not
37 beeen implemented yet. The need for a 3-part prompt arises from
38 the annotation level. When this is set to 2, the prompt is actually
39 composed of a prefix, the prompt itself and a suffix. */
41 /* At any particular time there will be always at least one prompt on
42 the stack, the one being currently displayed by gdb. If gdb is
43 using annotation level equal 2, there will be 2 prompts on the
44 stack: the usual one, w/o prefix and suffix (at top - 1), and the
45 'composite' one with prefix and suffix added (at top). At this
46 time, this is the only use of the prompt stack. Resetting annotate
47 to 0 or 1, pops the top of the stack, resetting its size to one
48 element. The MAXPROMPTS limit is safe, for now. Once other cases
49 are dealt with (like the different prompts used for 'commands' or
50 'actions') this array implementation of the prompt stack may have
62 prompt_stack
[MAXPROMPTS
];
66 #define PROMPT(X) the_prompts.prompt_stack[the_prompts.top + X].prompt
67 #define PREFIX(X) the_prompts.prompt_stack[the_prompts.top + X].prefix
68 #define SUFFIX(X) the_prompts.prompt_stack[the_prompts.top + X].suffix
70 /* Exported functions from event-top.c.
71 FIXME: these should really go into top.h. */
73 extern void display_gdb_prompt (char *new_prompt
);
74 extern void async_init_signals (void);
75 extern void set_async_editing_command (char *args
, int from_tty
, struct cmd_list_element
*c
);
76 extern void set_async_annotation_level (char *args
, int from_tty
, struct cmd_list_element
*c
);
77 extern void set_async_prompt (char *args
, int from_tty
, struct cmd_list_element
*c
);
79 /* Signal to catch ^Z typed while reading a command: SIGTSTP or SIGCONT. */
82 #define STOP_SIGNAL SIGTSTP
83 extern void handle_stop_sig (int sig
);
86 extern void handle_sigint (int sig
);
87 extern void pop_prompt (void);
88 extern void push_prompt (char *prefix
, char *prompt
, char *suffix
);
89 extern void gdb_readline2 (void *client_data
);
90 extern void mark_async_signal_handler_wrapper (void *token
);
91 extern void async_request_quit (void *arg
);
92 extern void stdin_event_handler (int error
, void *client_data
);
93 extern void async_disable_stdin (void);
94 extern void async_enable_stdin (void *dummy
);
96 /* Exported variables from event-top.c.
97 FIXME: these should really go into top.h. */
99 extern int async_command_editing_p
;
100 extern int exec_done_display_p
;
101 extern char *async_annotation_suffix
;
102 extern char *new_async_prompt
;
103 extern struct prompts the_prompts
;
104 extern void (*call_readline
) (void *);
105 extern void (*input_handler
) (char *);
This page took 0.031417 seconds and 4 git commands to generate.