From c8a3ccbeb89221d726542a89b42ddb26827af1f4 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 27 Jul 2019 18:26:18 -0700 Subject: 5490 --- html/039debug.cc.html | 56 +++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'html/039debug.cc.html') diff --git a/html/039debug.cc.html b/html/039debug.cc.html index a7c05411..4fe7fc35 100644 --- a/html/039debug.cc.html +++ b/html/039debug.cc.html @@ -2,7 +2,7 @@ -Mu - subx/039debug.cc +Mu - 039debug.cc @@ -56,7 +56,7 @@ if ('onhashchange' in window) { -https://github.com/akkartik/mu/blob/master/subx/039debug.cc +https://github.com/akkartik/mu/blob/master/039debug.cc
   1 //:: Some helpers for debugging.
   2 
@@ -74,50 +74,50 @@ if ('onhashchange' in window) {
  14 void load_labels() {
  15   ifstream fin("labels");
  16   fin >> std::hex;
- 17   while (has_data(fin)) {
+ 17   while (has_data(fin)) {
  18     uint32_t addr = 0;
  19     fin >> addr;
- 20     string name;
- 21     fin >> name;
- 22     put(Symbol_name, addr, name);
+ 20     string name;
+ 21     fin >> name;
+ 22     put(Symbol_name, addr, name);
  23   }
  24 }
  25 
  26 void load_source_lines() {
  27   ifstream fin("source_lines");
  28   fin >> std::hex;
- 29   while (has_data(fin)) {
+ 29   while (has_data(fin)) {
  30     uint32_t addr = 0;
  31     fin >> addr;
- 32     string line;
- 33     getline(fin, line);
- 34     put(Source_line, addr, hacky_squeeze_out_whitespace(line));
+ 32     string line;
+ 33     getline(fin, line);
+ 34     put(Source_line, addr, hacky_squeeze_out_whitespace(line));
  35   }
  36 }
  37 
  38 :(after "Run One Instruction")
- 39 if (contains_key(Symbol_name, EIP))
- 40   trace(Callstack_depth, "run") << "== label " << get(Symbol_name, EIP) << end();
- 41 if (contains_key(Source_line, EIP))
- 42   trace(Callstack_depth, "run") << "0x" << HEXWORD << EIP << ": " << get(Source_line, EIP) << end();
+ 39 if (contains_key(Symbol_name, EIP))
+ 40   trace(Callstack_depth, "run") << "== label " << get(Symbol_name, EIP) << end();
+ 41 if (contains_key(Source_line, EIP))
+ 42   trace(Callstack_depth, "run") << "0x" << HEXWORD << EIP << ": " << get(Source_line, EIP) << end();
  43 else
  44   // no source line info; do what you can
- 45   trace(Callstack_depth, "run") << "0x" << HEXWORD << EIP << ": " << debug_info(EIP) << end();
+ 45   trace(Callstack_depth, "run") << "0x" << HEXWORD << EIP << ": " << debug_info(EIP) << end();
  46 
  47 :(code)
  48 string debug_info(uint32_t inst_address) {
- 49   uint8_t op = read_mem_u8(inst_address);
+ 49   uint8_t op = read_mem_u8(inst_address);
  50   if (op != 0xe8) {
  51     ostringstream out;
- 52     out << HEXBYTE << NUM(op);
+ 52     out << HEXBYTE << NUM(op);
  53     return out.str();
  54   }
- 55   int32_t offset = read_mem_i32(inst_address+/*skip op*/1);
+ 55   int32_t offset = read_mem_i32(inst_address+/*skip op*/1);
  56   uint32_t next_eip = inst_address+/*inst length*/5+offset;
- 57   if (contains_key(Symbol_name, next_eip))
+ 57   if (contains_key(Symbol_name, next_eip))
  58     return "e8/call "+get(Symbol_name, next_eip);
  59   ostringstream out;
- 60   out << "e8/call 0x" << HEXWORD << next_eip;
+ 60   out << "e8/call 0x" << HEXWORD << next_eip;
  61   return out.str();
  62 }
  63 
@@ -136,33 +136,33 @@ if ('onhashchange' in window) {
  76   if (Watch_points.empty()) return;
  77   trace(Callstack_depth, "dbg") << "watch points:" << end();
  78   for (map<string, uint32_t>::iterator p = Watch_points.begin();  p != Watch_points.end();  ++p)
- 79     trace(Callstack_depth, "dbg") << "  " << p->first << ": " << HEXWORD << p->second << " -> " << HEXWORD << read_mem_u32(p->second) << end();
+ 79     trace(Callstack_depth, "dbg") << "  " << p->first << ": " << HEXWORD << p->second << " -> " << HEXWORD << read_mem_u32(p->second) << end();
  80 }
  81 
  82 :(before "End Globals")
  83 string Watch_this_effective_address;
  84 :(after "Run One Instruction")
  85 Watch_this_effective_address = "";
- 86 if (contains_key(Symbol_name, EIP) && starts_with(get(Symbol_name, EIP), "$watch-"))
- 87   Watch_this_effective_address = get(Symbol_name, EIP);
+ 86 if (contains_key(Symbol_name, EIP) && starts_with(get(Symbol_name, EIP), "$watch-"))
+ 87   Watch_this_effective_address = get(Symbol_name, EIP);
  88 :(after "Found effective_address(addr)")
  89 if (!Watch_this_effective_address.empty()) {
- 90   dbg << "now watching " << HEXWORD << addr << " for " << Watch_this_effective_address << end();
- 91   put(Watch_points, Watch_this_effective_address, addr);
+ 90   dbg << "now watching " << HEXWORD << addr << " for " << Watch_this_effective_address << end();
+ 91   put(Watch_points, Watch_this_effective_address, addr);
  92 }
  93 
  94 //: Special label that dumps regions of memory.
  95 //: Not a general mechanism; by the time you get here you're willing to hack
  96 //: on the emulator.
  97 :(after "Run One Instruction")
- 98 if (contains_key(Symbol_name, EIP) && get(Symbol_name, EIP) == "$dump-stream-at-EAX")
+ 98 if (contains_key(Symbol_name, EIP) && get(Symbol_name, EIP) == "$dump-stream-at-EAX")
  99   dump_stream_at(Reg[EAX].u);
 100 :(code)
 101 void dump_stream_at(uint32_t stream_start) {
-102   int32_t stream_length = read_mem_i32(stream_start + 8);
+102   int32_t stream_length = read_mem_i32(stream_start + 8);
 103   dbg << "stream length: " << std::dec << stream_length << end();
 104   for (int i = 0;  i < stream_length + 12;  ++i)
-105     dbg << "0x" << HEXWORD << (stream_start+i) << ": " << HEXBYTE << NUM(read_mem_u8(stream_start+i)) << end();
+105     dbg << "0x" << HEXWORD << (stream_start+i) << ": " << HEXBYTE << NUM(read_mem_u8(stream_start+i)) << end();
 106 }
 107 
 108 //: helpers
-- 
cgit 1.4.1-2-gfad0