|
|
1.1 root 1: //
2: // nono
1.1.1.2 ! root 3: // Copyright (C) 2020 nono project
! 4: // Licensed under nono-license.txt
1.1 root 5: //
6:
7: // 逆アセンブラ(共通部分)
8:
9: #pragma once
10:
11: #include "debugger_private.h"
12:
13: // 逆アセンブラ抽象クラス
14: class Disasm
15: {
16: public:
17: // コンストラクタ
18: Disasm(DebuggerMD *m) {
19: md = m;
20: }
21: virtual ~Disasm() { }
22:
23: // laddr の位置を1命令逆アセンブルする。
24: // 成功すれば true、失敗すれば false を返す?
25: // 成功すれば text に出力文字列、ir に命令バイナリがセットされている。
26: //
27: // Exec() 実装は、laddr が論理アドレスなら md->TranslateAddr() を呼んで
28: // 物理アドレスを取得し、vm_phys_peek8() で物理メモリを読み出すこと。
29: virtual bool Exec(saddr_t laddr) = 0;
30:
31: // 出力文字列(ダンプ)
32: std::string dump {};
33:
34: // 出力文字列(命令)
35: std::string text {};
36:
37: // この命令のバイナリ列
38: // (メモリイメージ順)
39: std::vector<uint8> bin {};
40:
41: protected:
42: // デバッガ(MD)クラス。TranslateAddr() のため。
43: DebuggerMD *md {};
44:
45: // 継承先の Exec() の先頭で呼び出してください。
46: void ExecInit() {
47: text.clear();
48: bin.clear();
49: }
50: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.