--- nono/debugger/debugger.cpp 2026/04/29 17:05:32 1.1.1.17 +++ nono/debugger/debugger.cpp 2026/04/29 17:05:45 1.1.1.19 @@ -92,7 +92,7 @@ Debugger::~Debugger() Close(); if ((bool)hostcom) { - hostcom->SetRxCallback(NULL); + hostcom->ResetRxCallback(); hostcom->SetAcceptCallback(NULL); } @@ -103,12 +103,15 @@ bool Debugger::Create() { // ホストドライバを作成 - hostcom.reset(new HostCOMDevice(this, "Debugger")); + try { + hostcom.reset(new HostCOMDevice(this, -1, "Debugger")); + } catch (...) { } if ((bool)hostcom == false) { + warnx("Failed to initialize HostCOMDevice at %s", __method__); return false; } - hostcom->SetRxCallback(ToDeviceCallback(&Debugger::RxCallback)); + hostcom->SetRxCallback(ToDeviceCallback(&Debugger::RxCallback), 0); hostcom->SetAcceptCallback(ToDeviceCallback(&Debugger::AcceptCallback)); return true; @@ -136,14 +139,28 @@ Debugger::Init() syncer = GetSyncer(); - if (gMainApp.Has(VMCap::M88K)) { - md_mpu.reset(new DebuggerMD_m88xx0(this)); - } else { - md_mpu.reset(new DebuggerMD_m680x0(this)); + try { + if (gMainApp.Has(VMCap::M88K)) { + md_mpu.reset(new DebuggerMD_m88xx0(this)); + } else { + md_mpu.reset(new DebuggerMD_m680x0(this)); + } + } catch (...) { } + if ((bool)md_mpu == false) { + warnx("Failed to initialize md_mpu at %s", __method__); + return false; } + if (gMainApp.Has(VMCap::LUNA)) { - md_xp.reset(new DebuggerMD_hd64180(this)); + try { + md_xp.reset(new DebuggerMD_hd64180(this)); + } catch (...) { } + if ((bool)md_xp == false) { + warnx("Failed to initialize md_xp at %s", __method__); + return false; + } } + // とりあえずメインプロセッサに固定 curmd = md_mpu.get(); @@ -404,7 +421,7 @@ Debugger::WriteFunc(const char *buf, int // ホストからの1文字受信通知 (HostCOM スレッドから呼ばれる) void -Debugger::RxCallback() +Debugger::RxCallback(uint32 arg) { // デバッガスレッドに通知 std::unique_lock lock(mtx); @@ -414,7 +431,7 @@ Debugger::RxCallback() // ホストからの着信通知 (HostCOM スレッドから呼ばれる) void -Debugger::AcceptCallback() +Debugger::AcceptCallback(uint32 dummy) { // デバッガスレッドに通知 std::unique_lock lock(mtx); @@ -2020,9 +2037,8 @@ Debugger::cmd_hist_common(BranchHistory& // MonitorUpdate() は TextScreen 高さに合わせて出力してくれる。 auto *histmon = hist.monitor; - auto size = histmon->GetSize(); TextScreen screen; - screen.Init(size.width, lines); + screen.Init(histmon->GetCol(), lines); // コンソールでは下が新しいの順のほうがいい if (bottom_to_top) {