about summary refs log tree commit diff stats
path: root/src/config/color.c
Commit message (Expand)AuthorAgeFilesLines
* Update copyrightMichael Vetter2021-01-081-1/+1
* Declare counter var inside loopMichael Vetter2020-11-091-8/+4
* Basic support for building on NetBSD.nia2020-09-041-0/+2
* Apply coding styleMichael Vetter2020-07-071-291/+300
* Revert "Apply coding style"Michael Vetter2020-07-071-303/+294
* Apply coding styleMichael Vetter2020-07-071-294/+303
* XEP-0392: get background color from themeMichael Vetter2020-01-221-1/+8
* Update my Copyright to 2020Michael Vetter2020-01-031-1/+1
* Improve color blindness handlingMichael Vetter2019-12-121-8/+12
* Implement Color Vision Deficiencies settingMichael Vetter2019-12-121-5/+10
* XEP-0392: color: implement color hashingAurelien Aptel2019-12-031-281/+364
* Add vim modelineMichael Vetter2019-11-131-0/+1
* Make sure memory in color_pair_cache_reset() was allocated.Michael Vetter2019-08-241-5/+8
* color: set capacity in unittest caseMichael Vetter2019-08-231-0/+5
* Notify trying to load 256 colour theme in incapable terminalMichael Vetter2019-08-231-0/+7
* color: Include log.hMichael Vetter2019-08-231-0/+1
* Reformat color.cMichael Vetter2019-08-231-5/+7
* Use log_error() instead of g_warning()Michael Vetter2019-08-231-14/+17
* Add 256 colors supportAurelien Aptel2019-08-231-0/+418
'>34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
                                
 
                                                                                                      
                                  



















                                                                         
                                                                                 
 







                                                                             


                                                                           























                                                                                                                     
                                                        
 
//:: Some helpers for debugging.

//: Load the 'map' file generated during 'subx --map translate' when running 'subx --map --trace run'.
//: (It'll only affect the trace.)

:(before "End Globals")
map</*address*/uint32_t, string> Symbol_name;  // used only by 'subx run'
:(before "End --map Settings")
load_map("map");
:(code)
void load_map(const string& map_filename) {
  ifstream fin(map_filename.c_str());
  fin >> std::hex;
  while (has_data(fin)) {
    uint32_t addr = 0;
    fin >> addr;
    string name;
    fin >> name;
    put(Symbol_name, addr, name);
  }
}

:(after "Run One Instruction")
if (contains_key(Symbol_name, EIP))
  trace(Callstack_depth, "run") << "== label " << get(Symbol_name, EIP) << end();

//: make calls in particular more salient
:(before "End Trace Call Instruction")
// at this point we've skipped past the e8 opcode, but not the offset operand
int32_t offset = read_mem_i32(EIP);
uint32_t next_eip = EIP+offset+4;
if (contains_key(Symbol_name, next_eip))
  return "/call "+get(Symbol_name, next_eip);

//: If a label starts with '$watch-', make a note of the effective address
//: computed by the next instruction. Start dumping out its contents to the
//: trace after every subsequent instruction.

:(after "Run One Instruction")
dump_watch_points();
:(before "End Globals")
map<string, uint32_t> Watch_points;
:(before "End Reset")
Watch_points.clear();
:(code)
void dump_watch_points() {
  if (Watch_points.empty()) return;
  dbg << "watch points:" << end();
  for (map<string, uint32_t>::iterator p = Watch_points.begin();  p != Watch_points.end();  ++p)
    dbg << "  " << p->first << ": " << HEXWORD << p->second << " -> " << HEXWORD << read_mem_u32(p->second) << end();
}

:(before "End Globals")
string Watch_this_effective_address;
:(after "Run One Instruction")
Watch_this_effective_address = "";
if (contains_key(Symbol_name, EIP) && starts_with(get(Symbol_name, EIP), "$watch-"))
  Watch_this_effective_address = get(Symbol_name, EIP);
:(after "Found effective_address(addr)")
if (!Watch_this_effective_address.empty()) {
  dbg << "now watching " << HEXWORD << addr << " for " << Watch_this_effective_address << end();
  put(Watch_points, Watch_this_effective_address, addr);
}