オプション修正。dumpmemoryで開始、終了のアドレスを指定できるように
[YACASL2.git] / include / monitor.h
1 #ifndef MONITOR_INCLUDE
2 #define MONITOR_INCLUDE
3
4 #include <stdio.h>
5 #include <string.h>
6 #include <assert.h>
7 #include "hash.h"
8 #include "cmem.h"
9 #include "cerr.h"
10 #include "exec.h"
11 #include "word.h"
12
13 /**
14  * @brief モニター
15  */
16 enum {
17     MONARGSIZE = 3,          /**<モニター引数の最大数 */
18 };
19
20 /**
21  * @brief モニター引数を表すデータ型
22  */
23 typedef struct {
24     int argc;                   /**<オペランド数 */
25     char *argv[MONARGSIZE];      /**<オペランド配列 */
26 } MONARGS;
27
28 /**
29  * @brief モニター命令行を表すデータ型
30  */
31 typedef struct {
32     char *cmd;                  /**<コマンド */
33     MONARGS *args;               /**<引数 */
34 } MONCMDLINE;
35
36 /**
37  * @brief ブレークポイント表を表すデータ型
38  */
39 typedef struct _BPSLIST {
40     struct _BPSLIST *next;        /**<リスト次項目へのポインタ */
41     WORD adr;                   /**<アドレス */
42 } BPSLIST;
43
44 /**
45  * ブレークポイント表のサイズ
46  */
47 enum {
48     BPSTABSIZE = 251,         /**<ブレークポイント表のサイズ */
49 };
50
51 enum {
52     MONINSIZE = 40    /**<モニターの、入力領域 */
53 };
54
55 typedef enum {
56     MONREPEAT = 0,
57     MONNEXT = 1,
58     MONQUIT = 2,
59 } MONCMDTYPE;
60
61 /**
62  * @brief アドレスのハッシュ値を返す
63  *
64  * @return ハッシュ値
65  *
66  * @param adr アドレス
67  */
68 unsigned adrhash(WORD adr);
69
70 /**
71  * @brief 文字列から、モニターの引数を取得する
72  *
73  * @return モニターの引数
74  *
75  * @param *str 文字列
76  */
77 MONARGS *monargstok(const char *str);
78
79 /**
80  * @brief 行から、モニターの命令と引数を取得する
81  *
82  * @return モニターの命令と引数
83  *
84  * @param *line 行
85  */
86 MONCMDLINE *monlinetok(const char *line);
87
88 /**
89  * @brief モニターの命令を実行する
90  *
91  * @return モニター命令の種類
92  *
93  * @param *cmd モニター命令
94  * @param *args モニター命令の引数
95  */
96 MONCMDTYPE monitorcmd(char *cmd, MONARGS *args);
97
98 /**
99  * @brief ブレークポイント表にアドレスがある場合はtrue、ない場合はfalseを返す
100  *
101  * @return trueまたはfalse
102  *
103  * @param *adr アドレス
104  */
105 bool getbps(WORD adr);
106
107 /**
108  * @brief ブレークポイント表にアドレスを追加する
109  *
110  * @return 追加した場合はtrue、追加しなかった場合はfalse
111  *
112  * @param *adr アドレス
113  */
114 bool addbps(WORD adr);
115
116
117 /**
118  * @brief ブレークポイント表からアドレスを削除する
119  *
120  * @return 削除した場合はtrue、削除しなかった場合はfalse
121  *
122  * @param *adr アドレス
123  */
124 bool delbps(WORD adr);
125
126 /**
127  * @brief ブレークポイント表を解放する
128  *
129  * @return なし
130  */
131 void freebps();
132
133 #endif        /* end of MONITOR_INCLUDE */