https://github.com/akkartik/mu/blob/master/subx/039debug.cc
1
2
3
4
5
6 :(before "End Globals")
7 map<uint32_t, string> Symbol_name;
8 :(before "End --map Settings")
9 load_map("map");
10 :(code)
11 void load_map(const string& map_filename) {
12 ifstream fin(map_filename.c_str());
13 fin >> std::hex;
14 while (has_data(fin)) {
15 uint32_t addr = 0;
16 fin >> addr;
17 string name;
18 fin >> name;
19 put(Symbol_name, addr, name);
20 }
21 }
22
23 :(after "Run One Instruction")
24 if (contains_key(Symbol_name, EIP))
25 trace(90, "run") << "== label " << get(Symbol_name, EIP) << end();