--- nono/debugger/debugger.cpp 2026/04/29 17:04:43 1.1.1.6 +++ nono/debugger/debugger.cpp 2026/04/29 17:04:48 1.1.1.7 @@ -9,8 +9,8 @@ #include "debugger_m680x0.h" #include "debugger_m88xx0.h" #include "mainapp.h" -#include "mystring.h" #include "mythread.h" +#include "scheduler.h" #include #include @@ -264,6 +264,12 @@ Debugger::CommandAction Debugger::MainLoop() { for (;;) { + // ブレークポイント到達メッセージがあればここで表示 + if (bpointmsg.empty() == false) { + cons->Print("%s", bpointmsg.c_str()); + bpointmsg.clear(); + } + cons->Prompt(); if (cons->Gets(cmdbuf) == false) { // EOF or Error @@ -420,7 +426,8 @@ Debugger::Check() // ブレークポイントがどれかでも成立するかを調べる。 // 1つ以上成立してブレークするなら true を返す。 // 1つも成立しておらずブレークしないなら false を返す。 -// 成立すれば内容をここで表示する。 +// このルーチン内では Console があることを期待してはいけない (プロンプトが +// ない時でも呼ばれるので)。 bool Debugger::CheckAllBreakpoints() { @@ -509,7 +516,13 @@ Debugger::CheckAllBreakpoints() assert(false); break; } - cons->Print("breakpoint #%d (%s) reached\n", i, desc.c_str()); + + // 到達メッセージを作成。 + // この時点ではまだコンソールを取得していない可能性があるので + // (-D なしで起動した場合とか)、表示せず用意するだけ。 + // コンソールが取得できたところで表示する。 + bpointmsg += string_format("breakpoint #%d (%s) reached\n", + i, desc.c_str()); } // 例外通知は通過ごとに常に下ろしておく @@ -842,7 +855,7 @@ Debugger::HelpDetails = { Shows disassemble. The first form ("D") interprets
as a physical address. The second and third form ("d", "dt") interprets
as a logical - address if the address translation is enabled. Normally,
is + address if the address translation is enabled. Normally,
is interpreted in the current privilege and current address space. You can change it by modifier. On m68k, can be specified either by function code number directly @@ -1638,8 +1651,8 @@ Debugger::GetAddr(saddr_t *sa, bool defa if (ParseAddr(str.c_str() + addrpos, &addr) == false) { return false; } - // 偶数番地に丸める - sa->SetAddr(addr & 0xfffffffe); + // 命令境界に丸める + sa->SetAddr(addr & ~(md->inst_bytes - 1)); return true; }