1 | /* command.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 capture;
|
---|
23 | class annotation;
|
---|
24 | class gdbio;
|
---|
25 | class display_window;
|
---|
26 | class threads_window;
|
---|
27 | class breakpoints_window;
|
---|
28 | class breakpoint;
|
---|
29 | class source_window;
|
---|
30 | class source_files_window;
|
---|
31 | class register_window;
|
---|
32 |
|
---|
33 |
|
---|
34 | class command_window : public pmtty
|
---|
35 | {
|
---|
36 | public:
|
---|
37 | typedef pmtty parent;
|
---|
38 |
|
---|
39 | // Contructors and destructors
|
---|
40 | command_window (pmapp *app, unsigned id, const char *fontnamesize,
|
---|
41 | char **argv);
|
---|
42 | ~command_window ();
|
---|
43 |
|
---|
44 | // Querying members
|
---|
45 | const breakpoint_list::brkpt_node *get_breakpoint_list () const
|
---|
46 | { return breakpoints.list; }
|
---|
47 | const breakpoint *get_breakpoint (int n) const;
|
---|
48 | const char *get_debuggee () const { return debuggee; }
|
---|
49 | const source_files_window *get_srcs () const { return srcs; }
|
---|
50 |
|
---|
51 | // Override member functions of pmframe
|
---|
52 | MRESULT wm_activate (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
53 | MRESULT wm_command (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
54 |
|
---|
55 | // etc.
|
---|
56 | void show_source (const char *short_fname, const char *long_fname,
|
---|
57 | bool set_focus, int lineno = -1);
|
---|
58 | void capture_error (const capture *p);
|
---|
59 | void run_command ();
|
---|
60 | void prepare_run ();
|
---|
61 | void show_annotation (const annotation *ann);
|
---|
62 | void exec_file (const char *s, int len);
|
---|
63 | void where ();
|
---|
64 | void handle_output (const char *text, int len);
|
---|
65 | void associate_help (HWND hwnd);
|
---|
66 | void update_registers ();
|
---|
67 | void get_breakpoints ();
|
---|
68 |
|
---|
69 | // Constants
|
---|
70 |
|
---|
71 | enum
|
---|
72 | {
|
---|
73 | GSC_PROMPT = 0x0001,
|
---|
74 | GSC_RUNNING = 0x0002,
|
---|
75 | GSC_BREAKPOINTS = 0x0004,
|
---|
76 | GSC_EXEC_FILE = 0x0008
|
---|
77 | };
|
---|
78 |
|
---|
79 | private:
|
---|
80 |
|
---|
81 | struct new_source;
|
---|
82 |
|
---|
83 | void lock ();
|
---|
84 | void unlock ();
|
---|
85 | void key (char c);
|
---|
86 | void kill_input ();
|
---|
87 | void complete ();
|
---|
88 | void complete (const char *p);
|
---|
89 | HWND create_hwnd_menu ();
|
---|
90 | void completion_menu (HWND hwnd, int start, int count, int skip);
|
---|
91 | void from_history (bool next);
|
---|
92 | void replace_command (const char *s);
|
---|
93 | void exec_command ();
|
---|
94 | void font ();
|
---|
95 | void arg_add (const char *str);
|
---|
96 | void arg_delete_all ();
|
---|
97 | void thread ();
|
---|
98 | void notify (unsigned change);
|
---|
99 | void show_new_source (const new_source *ns);
|
---|
100 | void delete_source (source_window *src);
|
---|
101 | bool open_dialog (char *buf, const char *title, const char *fname);
|
---|
102 | void open_exec ();
|
---|
103 | void open_core ();
|
---|
104 | void open_source ();
|
---|
105 | void brkpt_update (int index, const breakpoint *old_bpt,
|
---|
106 | const breakpoint *new_bpt);
|
---|
107 | void get_breakpoints (source_window *src, bool paint);
|
---|
108 | source_window *find_source_short (const char *fname);
|
---|
109 | source_window *find_source_long (const char *fname);
|
---|
110 | void pmdbg_start ();
|
---|
111 | void pmdbg_stop ();
|
---|
112 | void pmdbg_term ();
|
---|
113 | MRESULT pmdebugmode_msg (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
114 | MRESULT startup_msg (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
115 | MRESULT history_msg (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
116 | void new_debuggee ();
|
---|
117 | void help_disable (const pmframe *frame);
|
---|
118 |
|
---|
119 | // Override member functions of pmtxt
|
---|
120 | MRESULT wm_char (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
121 | bool wm_user (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
122 | MRESULT wm_close (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
123 |
|
---|
124 | struct src_node // Perhaps we should use a container class...
|
---|
125 | {
|
---|
126 | struct src_node *next;
|
---|
127 | source_window *src;
|
---|
128 | HWND hwndWinMenu;
|
---|
129 | unsigned menu_id;
|
---|
130 | };
|
---|
131 |
|
---|
132 | struct cmd_hist;
|
---|
133 |
|
---|
134 | // Data members
|
---|
135 |
|
---|
136 | bool exec_file_pending;
|
---|
137 | bool help_ok;
|
---|
138 | char **argv;
|
---|
139 | int argv_used;
|
---|
140 | int argv_size;
|
---|
141 | fstring debuggee;
|
---|
142 |
|
---|
143 | _fmutex mutex; // Hide pmtxt::mutex
|
---|
144 |
|
---|
145 | astring input_line;
|
---|
146 | lstring completions;
|
---|
147 | cmd_hist *history;
|
---|
148 | cmd_hist *cur_cmd;
|
---|
149 |
|
---|
150 | src_node *src_list;
|
---|
151 | int src_menu_id_count;
|
---|
152 | char *src_menu_id_used;
|
---|
153 |
|
---|
154 | breakpoint_list breakpoints;
|
---|
155 |
|
---|
156 | breakpoints_window *brk;
|
---|
157 | display_window *dsp;
|
---|
158 | threads_window *thr;
|
---|
159 | source_files_window *srcs;
|
---|
160 | register_window *reg;
|
---|
161 |
|
---|
162 | gdbio *gdb;
|
---|
163 |
|
---|
164 | // Friends
|
---|
165 | // TODO: Use more friends instead of public members?
|
---|
166 |
|
---|
167 | friend source_window;
|
---|
168 | friend gdbio;
|
---|
169 | friend void command_window_thread (void *arg);
|
---|
170 | friend MRESULT EXPENTRY
|
---|
171 | dlg_pmdebugmode (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
172 | friend MRESULT EXPENTRY
|
---|
173 | dlg_startup (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
174 | friend MRESULT EXPENTRY
|
---|
175 | dlg_history (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
176 | };
|
---|