From 88469358f2ff2944f934dee9314a62e3fa6320d8 Mon Sep 17 00:00:00 2001 From: j8takagi Date: Mon, 6 Jul 2026 18:33:20 +0900 Subject: [PATCH] =?utf8?q?monitor=E7=B5=82=E4=BA=86=E6=99=82=E3=80=81exit?= =?utf8?q?=E3=81=99=E3=82=8B=E3=81=AE=E3=81=A7=E3=81=AF=E3=81=AA=E3=81=8F?= =?utf8?q?=E3=80=81exec=E3=81=AB=E6=88=BB=E3=82=8B=E3=82=88=E3=81=86?= =?utf8?q?=E5=86=85=E9=83=A8=E5=8B=95=E4=BD=9C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit - exitの場合、casl2 -mのmonitor終了時にメモリーリーク発生するため - monitor終了時、execmode.monitorとexecmode.stepをfalseにする - exec側の処理 -- execmode.monitorがfalseでexecptr->startがfalseかexecptr->endがtrueuの場合は即時終了 -- それ以外の場合は、execmode.monitorがfalseのままCOMET IIを実行 --- include/monitor.h | 3 +-- src/exec.c | 3 +++ src/monitor.c | 21 +++++++-------------- src/struct.c | 2 +- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/include/monitor.h b/include/monitor.h index 603505e..10b179c 100644 --- a/include/monitor.h +++ b/include/monitor.h @@ -131,9 +131,8 @@ void freebps(); /** * @brief モニター終了時の処理をする * - * @return エラーがない場合は0、エラーがある場合は1 */ -int monquit(); +void monquit(); /** * @brief COMET IIモニターを起動する diff --git a/src/exec.c b/src/exec.c index dc2b2dc..5ff6120 100644 --- a/src/exec.c +++ b/src/exec.c @@ -704,6 +704,9 @@ void exec() fprintf(stdout, "%s", monmsg); } monitor(); + if(execmode.monitor == false && (execptr->start == false || execptr->stop == true)) { + break; + } } /* プログラムレジスタをチェック */ if(sys->cpu->pr >= sys->memsize) { diff --git a/src/monitor.c b/src/monitor.c index 5dd7d95..fa03bea 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -367,20 +367,11 @@ void free_moncmdline(MONCMDLINE *moncmdl) } } -int monquit() +void monquit() { - int stat = 0; - - comet2_shutdown(); + execmode.monitor = false; + execmode.step = false; freebps(); - free_cmdtable(HASH_CMDTYPE); - free_cmdtable(HASH_CODE); - - if(cerr->num > 0) { - stat = 1; - } - freecerr(); - return stat; } void monitor() @@ -396,7 +387,8 @@ void monitor() /* EOFの処理 */ if(buf == NULL) { FREE(last_buf); - exit(monquit()); + monquit(); + break; } /* 空行(Enterだけ)の場合は、前回のコマンドをリピート */ if(buf[0] == '\0') { @@ -427,7 +419,8 @@ void monitor() if(cmdtype == MONQUIT) { FREE(buf); FREE(last_buf); - exit(monquit()); + monquit(); + break; } } while(cmdtype == MONREPEAT); FREE(buf); diff --git a/src/struct.c b/src/struct.c index a5d2c2c..435b70c 100644 --- a/src/struct.c +++ b/src/struct.c @@ -273,7 +273,7 @@ bool code_gr_valid(WORD code) WORD gr = 0; if(cmdtype == R_ADR_X || cmdtype == R1_R2 || cmdtype == R_) { gr = (code & 0x00F0) >> 4; - if(gr < 0 || GRSIZE <= gr) { + if(gr >= GRSIZE) { res = false; } } -- 2.47.3