| 144 | } |
| 145 | |
| 146 | inline void HexDump(const uint8_t* data, size_t size){ |
| 147 | size_t pos = 0; |
| 148 | while (pos < size) { |
| 149 | printf("%#05zx: ", pos); |
| 150 | for (int i = 0; i < 16; i++) { |
| 151 | if (pos + i < size) { |
| 152 | printf("%02x", data[pos + i]); |
| 153 | } else { |
| 154 | printf(" "); |
| 155 | } |
| 156 | if (i % 4 == 3) { |
| 157 | printf(" "); |
| 158 | } |
| 159 | } |
| 160 | printf(" | "); |
| 161 | for (int i = 0; i < 16; i++) { |
| 162 | if (pos + i < size) { |
| 163 | if (data[pos + i] >= 0x20 && data[pos + i] <= 0x7e) { |
| 164 | printf("%c", data[pos + i]); |
| 165 | } else { |
| 166 | printf("."); |
| 167 | } |
| 168 | } else { |
| 169 | printf(" "); |
| 170 | } |
| 171 | } |
| 172 | printf("\n"); |
| 173 | pos += 16; |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | inline void PrintStackTrace(const std::string& filename, bool append = false) { |
| 178 | const int maxFrames = 128; // max number of frames in the stack trace |
no outgoing calls
no test coverage detected