1 | /* gdbio.h -*- C++ -*-
|
---|
2 | Copyright (c) 1996 Eberhard Mattes
|
---|
3 |
|
---|
4 | This file is part of pmgdb.
|
---|
5 |
|
---|
6 | pmgdb is free software; you can redistribute it and/or modify
|
---|
7 | it under the terms of the GNU General Public License as published by
|
---|
8 | the Free Software Foundation; either version 2, or (at your option)
|
---|
9 | any later version.
|
---|
10 |
|
---|
11 | pmgdb is distributed in the hope that it will be useful,
|
---|
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | GNU General Public License for more details.
|
---|
15 |
|
---|
16 | You should have received a copy of the GNU General Public License
|
---|
17 | along with pmgdb; see the file COPYING. If not, write to
|
---|
18 | the Free Software Foundation, 59 Temple Place - Suite 330,
|
---|
19 | Boston, MA 02111-1307, USA. */
|
---|
20 |
|
---|
21 |
|
---|
22 | class command_window;
|
---|
23 | class capture;
|
---|
24 |
|
---|
25 | class gdbio : annotation
|
---|
26 | {
|
---|
27 | public:
|
---|
28 |
|
---|
29 | // Types
|
---|
30 |
|
---|
31 | enum gsp
|
---|
32 | {
|
---|
33 | GSP_CMD,
|
---|
34 | GSP_OTHER,
|
---|
35 | GSP_NONE,
|
---|
36 | GSP_NOTREADY
|
---|
37 | };
|
---|
38 |
|
---|
39 | enum gsr
|
---|
40 | {
|
---|
41 | GSR_RUNNING,
|
---|
42 | GSR_STOPPED,
|
---|
43 | GSR_NONE
|
---|
44 | };
|
---|
45 |
|
---|
46 | gdbio (command_window *cmd);
|
---|
47 | ~gdbio ();
|
---|
48 |
|
---|
49 | void parse_gdb ();
|
---|
50 | const astring &get_output () const { return output; }
|
---|
51 | bool is_nochild () const { return gdb_running == GSR_NONE; }
|
---|
52 | bool is_ready () const { return gdb_prompt == GSP_CMD; }
|
---|
53 | void prepare_run ();
|
---|
54 | void send_init (int fd);
|
---|
55 | void send_init ();
|
---|
56 | bool send_cmd (const char *fmt, ...);
|
---|
57 | void queue_cmd (const char *fmt, ...);
|
---|
58 | bool call_cmd (const char *fmt, ...);
|
---|
59 | capture *capture_cmd (const char *fmt, ...);
|
---|
60 | ULONG address_of_line (const char *fname, int lineno);
|
---|
61 | bool get_setshow_boolean (const char *name);
|
---|
62 | void set_setshow_boolean (const char *name, bool value);
|
---|
63 | char *get_setshow_string (const char *name);
|
---|
64 | void set_setshow_string (const char *name, const char *value);
|
---|
65 |
|
---|
66 | private:
|
---|
67 | void parse_breakpoints_table ();
|
---|
68 | void parse_display_begin ();
|
---|
69 | void parse_error_begin ();
|
---|
70 | void parse_source ();
|
---|
71 | void parse_source_location ();
|
---|
72 | void parse_frame_begin ();
|
---|
73 | void parse_pre_prompt ();
|
---|
74 | void parse_value (bool to_screen, bool to_field);
|
---|
75 | void fetch ();
|
---|
76 | void handle_output (const char *text, int len);
|
---|
77 | void copy_text (bool to_screen, bool to_field);
|
---|
78 | void field_init () { field.set (0); }
|
---|
79 | void send_str (const char *str, int len);
|
---|
80 | void send_vfmt (const char *fmt, va_list args);
|
---|
81 | void lock_cmd_queue ();
|
---|
82 | void unlock_cmd_queue ();
|
---|
83 | void reset_hev_done ();
|
---|
84 | void post_hev_done ();
|
---|
85 | void wait_hev_done ();
|
---|
86 |
|
---|
87 | struct cmd_queue
|
---|
88 | {
|
---|
89 | struct cmd_queue *next;
|
---|
90 | fstring cmd;
|
---|
91 | };
|
---|
92 |
|
---|
93 | command_window *cmd;
|
---|
94 | capture *capture_head, *capture_cur;
|
---|
95 | capture *frame_head, *frame_cur;
|
---|
96 | capture *display_head, *display_cur;
|
---|
97 | astring field;
|
---|
98 | astring output;
|
---|
99 | bool ignore_prompt;
|
---|
100 | bool ignore_output;
|
---|
101 | bool show_annotations;
|
---|
102 | bool breakpoints_invalid;
|
---|
103 | bool breakpoints_invalid_pending;
|
---|
104 | bool exec_file_pending;
|
---|
105 | bool stopped_pending;
|
---|
106 | bool call_flag;
|
---|
107 | gsp gdb_prompt;
|
---|
108 | gsr gdb_running;
|
---|
109 |
|
---|
110 | _fmutex mutex_cmd_queue;
|
---|
111 | HEV hev_done;
|
---|
112 | int to_gdb;
|
---|
113 | cmd_queue *cmd_head, **cmd_add;
|
---|
114 |
|
---|
115 | friend command_window;
|
---|
116 | };
|
---|