--- nono/debugger/debugger.h 2026/04/29 17:05:16 1.1.1.9 +++ nono/debugger/debugger.h 2026/04/29 17:05:58 1.1.1.14 @@ -11,8 +11,8 @@ #pragma once #include "debugger_defs.h" +#include "bus.h" #include "monitor.h" -#include "saddr.h" #include "textscreen.h" #include "thread.h" #include @@ -72,6 +72,7 @@ class Debugger : public ThreadDevice struct { uint32 inst; // 命令ワード uint32 mask; // マスク + int instbytes; // 命令バイト数 }; }; @@ -108,8 +109,6 @@ class Debugger : public ThreadDevice void ExecMain() { Exec(md_mpu.get()); } void ExecXP() { Exec(md_xp.get()); } - void NotifyExceptionMain(int vector); - void NotifyExceptionXP(int vector); // MPU トレースが必要なら true を返す bool IsTrace() const; @@ -120,17 +119,18 @@ class Debugger : public ThreadDevice private: void Close(); - void RxCallback(); - void AcceptCallback(); + void RxCallback(uint32); + void AcceptCallback(uint32); void Input(int); void EnterPrompt(); + void QuitPrompt(); void LeavePrompt(bool trace); void PrintPrompt(); void Exec(DebuggerMD *); CmdAct Command(); bool CheckAllBreakpoints(DebuggerMD *); - bool CheckBreakpointInst(breakpoint_t&); + uint64 ReadBreakpointInst(breakpoint_t&); void ParseCmdbuf(); // コマンド名は大文字小文字を区別する関係でスネークスタイル。 CmdAct cmd_b(); @@ -145,7 +145,6 @@ class Debugger : public ThreadDevice CmdAct cmd_c(); CmdAct cmd_ct(); CmdAct cmd_d(); - CmdAct cmd_dt(); CmdAct cmd_D(); CmdAct cmd_disp(); CmdAct cmd_exhist(); @@ -154,12 +153,13 @@ class Debugger : public ThreadDevice CmdAct cmd_hr(); CmdAct cmd_L(); CmdAct cmd_m(); - CmdAct cmd_mt(); CmdAct cmd_mpu(); CmdAct cmd_M(); CmdAct cmd_minus(); CmdAct cmd_n(); CmdAct cmd_nt(); + CmdAct cmd_pe(); + CmdAct cmd_pf(); CmdAct cmd_q(); CmdAct cmd_reset(); CmdAct cmd_s(); @@ -172,13 +172,20 @@ class Debugger : public ThreadDevice CmdAct cmd_z(); bool Check(DebuggerMD *); + bool ParseOptBreakAddr(const std::string&); + bool ParseOptBreakInst(const std::string&); + bool ParseOptBreakVector(const std::string&); + bool IsCPUStr(const std::string&) const; DebuggerMD *ParseCPU(const std::string&) const; - int AddBreakpoint(const breakpoint_t&, const std::string&); - void RecalcInstMask(); - bool GetAddr(saddr_t *addr, bool); - CmdAct cmd_d_common(MemoryMode access_mode, MMULookupMode lookup_mode); + int AddBreakInst(const std::string& cpustr, const std::string& inststr, + const std::string& skipstr, std::string *errstr); + int AddBreakVector(const std::string& cpustr, const std::string& vecstr, + const std::string& skipstr, std::string *errstr); + int AddBreakpoint(const breakpoint_t&); + bool GetAddr(busaddr *addr, bool); + CmdAct cmd_d_common(busaddr access_mode); CmdAct cmd_hist_common(BranchHistory& hist); - CmdAct cmd_m_common(MemoryMode access_mode, MMULookupMode lookup_mode); + CmdAct cmd_m_common(busaddr access_mode); CmdAct cmd_n_common(bool); CmdAct cmd_s_common(bool); CmdAct cmd_so_common(bool); @@ -199,7 +206,7 @@ class Debugger : public ThreadDevice std::string HelpConvert(const std::string& msg); // モニタを更新して表示 - void ShowMonitor(Monitor& monitor); + void ShowMonitor(Monitor *monitor); // テキストスクリーンを表示 void ShowTextScreen(TextScreen& screen); @@ -226,16 +233,13 @@ class Debugger : public ThreadDevice const char *prompt {}; // プロンプト文字列 std::string cmdbuf {}; // 現在のコマンドライン std::string last_cmdbuf {}; // 直前のコマンドライン - std::vector args {}; + std::vector cmdargs {}; uint32 pc {}; std::array bpoint {}; - uint32 bi_inst {}; - int bi_inst_bytes {}; - int bi_need_bytes {}; uint64 ct_timespan {}; - saddr_t d_last_addr {}; - saddr_t m_last_addr {}; + busaddr d_last_addr {}; + busaddr m_last_addr {}; StepType step_type {}; // ステップ実行種別 DebuggerMD *step_md {}; // ステップ実行中の CPU uint32 step_count {}; @@ -258,8 +262,8 @@ class Debugger : public ThreadDevice std::string bpointmsg {}; // ブレークポイントモニタ - DECLARE_MONITOR_CALLBACK(MonitorUpdateBpoint); - Monitor bpoint_monitor { this }; + DECLARE_MONITOR_SCREEN(MonitorScreenBpoint); + Monitor *bpoint_monitor {}; // 逆アセンブルとメモリダンプモニタ std::array, MAX_MEMDUMP_MONITOR> @@ -275,6 +279,6 @@ class Debugger : public ThreadDevice static std::vector cmdtable; }; -static inline Debugger *GetDebugger() { +inline Debugger *GetDebugger() { return Object::GetObject(OBJ_DEBUGGER); }