* gdb.texinfo (Command Syntax): Document C-o binding.
[deliverable/binutils-gdb.git] / gdb / event-top.h
CommitLineData
c2c6d25f 1/* Definitions used by GDB event-top.c.
72290732 2 Copyright 1999, 2001 Free Software Foundation, Inc.
c2c6d25f
JM
3 Written by Elena Zannoni <ezannoni@cygnus.com> of Cygnus Solutions.
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,
20 Boston, MA 02111-1307, USA. */
21
0af5533d
MK
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
c2c6d25f
JM
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
0af5533d 27 'actions' for tracepoints. In these cases, the prompt is '>' and
c2c6d25f
JM
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.
0af5533d 32 The prompt stack represents part of the saved state. Another part
c2c6d25f 33 would be the function that readline would invoke after a whole line
0af5533d 34 of input has ben entered. This second piece would be something
c2c6d25f
JM
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
0af5533d
MK
38 the annotation level. When this is set to 2, the prompt is
39 actually composed of a prefix, the prompt itself and a suffix. */
c2c6d25f
JM
40
41/* At any particular time there will be always at least one prompt on
0af5533d 42 the stack, the one being currently displayed by gdb. If gdb is
c2c6d25f
JM
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
0af5533d
MK
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
c2c6d25f 47 to 0 or 1, pops the top of the stack, resetting its size to one
0af5533d 48 element. The MAXPROMPTS limit is safe, for now. Once other cases
c2c6d25f
JM
49 are dealt with (like the different prompts used for 'commands' or
50 'actions') this array implementation of the prompt stack may have
0af5533d 51 to change. */
c2c6d25f
JM
52
53#define MAXPROMPTS 10
54struct prompts
55 {
56 struct
57 {
58 char *prefix;
59 char *prompt;
60 char *suffix;
61 }
62 prompt_stack[MAXPROMPTS];
63 int top;
64 };
65
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
69
70/* Exported functions from event-top.c.
0af5533d 71 FIXME: these should really go into top.h. */
c2c6d25f
JM
72
73extern void display_gdb_prompt (char *new_prompt);
74extern void async_init_signals (void);
0af5533d
MK
75extern void set_async_editing_command (char *args, int from_tty,
76 struct cmd_list_element *c);
77extern void set_async_annotation_level (char *args, int from_tty,
78 struct cmd_list_element *c);
79extern void set_async_prompt (char *args, int from_tty,
80 struct cmd_list_element *c);
c2c6d25f
JM
81
82/* Signal to catch ^Z typed while reading a command: SIGTSTP or SIGCONT. */
83#ifndef STOP_SIGNAL
72290732 84#include <signal.h>
c2c6d25f
JM
85#ifdef SIGTSTP
86#define STOP_SIGNAL SIGTSTP
87extern void handle_stop_sig (int sig);
88#endif
89#endif
90extern void handle_sigint (int sig);
91extern void pop_prompt (void);
92extern void push_prompt (char *prefix, char *prompt, char *suffix);
2acceee2
JM
93extern void gdb_readline2 (void *client_data);
94extern void mark_async_signal_handler_wrapper (void *token);
95extern void async_request_quit (void *arg);
96extern void stdin_event_handler (int error, void *client_data);
6426a772
JM
97extern void async_disable_stdin (void);
98extern void async_enable_stdin (void *dummy);
c2c6d25f
JM
99
100/* Exported variables from event-top.c.
0af5533d 101 FIXME: these should really go into top.h. */
c2c6d25f
JM
102
103extern int async_command_editing_p;
104extern int exec_done_display_p;
105extern char *async_annotation_suffix;
106extern char *new_async_prompt;
107extern struct prompts the_prompts;
2acceee2 108extern void (*call_readline) (void *);
c2c6d25f
JM
109extern void (*input_handler) (char *);
110extern int input_fd;
This page took 0.135354 seconds and 4 git commands to generate.