📄 xdbg.cpp
字号:
#include "config.h"#include "xdbg.h"#include <string.h>namespace oxsemi {namespace debug {const char* get_basename__(const char* file){ size_t len = strlen(file); const char* p = file + len - 1; for(; p > file && *p != '\\' && *p != '/'; --p) ; return p > file ? p+1 : file;}/** * This routine displays (with colours) a dump of the given area of memory, * listing 16 bytes per line, on the left as two digit hex numbers, and then * on the right as ASCII characters, with unprintable characters displayed * as dots (and in a different colour). * * @param address An unsigned char * - pointing to the first byte of data * to display. * @param length An unsigned int - the number of bytes to display. */ #if (defined(_DEBUG) || !defined(OXSEMI_PRODUCTION))void TraceMemory(const unsigned char * address, unsigned int length){ TRACE( "$CDisplaying %d(0x%X) bytes from address %08X:\n", length, length, address); unsigned int skipAtStart = (((unsigned int)address) & 15); address = (const unsigned char *) (((unsigned int)address) & ~15); for (unsigned int i=0; i<skipAtStart+length; i+=16) { TRACE("$G%08X$n ", i); unsigned int j; for (j=0; j<16; j++) { unsigned int k=i+j; bool show = k >= skipAtStart && k < skipAtStart+length; unsigned char c = address[k]; if (show) { TRACE("%s%02X$n ", c==0 ? "$n":"$W", c); } else { TRACE(" "); } } TRACE(" "); for (j=0; j<16; j++) { unsigned int k=i+j; bool show = k >= skipAtStart && k < skipAtStart+length; unsigned char c = address[k]; if (show) { TRACE( "%s%c$n", (c>=32 && c<127) ? "$Y" : "$R", (c>=32 && c<127) ? c : '.'); } else { TRACE(" "); } } TRACE("\n"); }}#endif}; // namespace debug }; // namespace oxsemi#include "xdbg_unix.cpp"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -