--- nono/host/hostcom.cpp 2026/04/29 17:05:11 1.1 +++ nono/host/hostcom.cpp 2026/04/29 17:05:21 1.1.1.3 @@ -73,9 +73,11 @@ // // objname_ は "HostCOM" とか (スレッド名も同じになる)。 // 設定ファイルキーワードプレフィックスはこれを小文字にしたもの("hostcom")。 -HostCOMDevice::HostCOMDevice(const std::string& objname_) - : inherited(objname_) +HostCOMDevice::HostCOMDevice(Device *parent_, const std::string& objname_) + : inherited(parent_, OBJ_NONE) { + SetName(objname_); + // 親が hostcom* か debugger かによっていろいろ動作が違う。 if (GetName() == "Debugger") { // デバッガコンソールならログレベルは親に準じるため、こっちは不要。 @@ -88,7 +90,7 @@ HostCOMDevice::HostCOMDevice(const std:: // モニタは hostcom* のみ必要。 monitor.func = ToMonitorCallback(&HostCOMDevice::MonitorUpdate); - monitor.SetSize(30, 16); + monitor.SetSize(30, 17); monitor.Regist(ID_MONITOR_HOSTCOM); } } @@ -146,13 +148,11 @@ HostCOMDevice::SelectDriver() const ConfigItem& dditem = gConfig->Find("debugger-driver"); const std::string& ddtype = dditem.AsString(); if (ddtype == "stdio") { - const char *opt; - if (gMainApp.opt_D) { - opt = "-D"; - } else { - opt = "'-V debugger-driver=stdio'"; + auto where = dditem.GetWhere(); + if (where == "-V") { + where += " debugger-driver=stdio"; } - item.Err("cannot be used with %s option", opt); + item.Err("stdio driver conflicts with " + where); return false; } } @@ -231,8 +231,8 @@ HostCOMDevice::Dispatch(int udata) // ...のだが、Dispatch(LISTEN_SOCKET) は着信を受け付けた時には // LISTEN_SOCKET を返し、それを受けてここで通知処理を行う。 if (udata == LISTEN_SOCKET) { - if (dev && accept_func) { - (dev->*accept_func)(); + if (accept_func) { + (parent->*accept_func)(); } udata = DONE; } @@ -339,11 +339,12 @@ HostCOMDevice::MonitorUpdate(Monitor *, { screen.Clear(); - screen.Print(0, 0, "HostCOM Driver: %s", driver->GetDriverName()); + screen.Print(0, 0, "Parent Device : %s", parent->GetName().c_str()); + screen.Print(0, 1, "HostCOM Driver: %s", driver->GetDriverName()); // 次の1行はドライバ依存情報 - driver->MonitorUpdateMD(screen); + driver->MonitorUpdateMD(screen, 2); - int y = 3; + int y = 4; screen.Print(0, y++, "%-17s%13s", "", "Bytes"); screen.Print(0, y++, "%-17s%13s", "VM sends", format_number(stat.tx_bytes).c_str());