<aname="l3"></a>* You can enter the debugger with </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KDebug.CC.html#l763"><spanclass=cF4>Debug</span></a><spanclass=cF0>() or </span><spanclass=cF2><CTRL-ALT-d></span><spanclass=cF0>. You might enter the debugger through a fault. Enter </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KDebug.CC.html#l528"><spanclass=cF4>G</span></a><spanclass=cF0>() or </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KDebug.CC.html#l560"><spanclass=cF4>G2</span></a><spanclass=cF0>()
<aname="l4"></a>to continue execution. Place a call to </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KDebug.CC.html#l763"><spanclass=cF4>Debug</span></a><spanclass=cF0>() in your code at fatal error points to enter the debugger. If you see a stack
<aname="l5"></a>dump, record the label+offset and unassemble, </span><ahref="https://zeal-operating-system.github.io/ZealOS/Compiler/UAsm.CC.html#l836"><spanclass=cF4>U</span></a><spanclass=cF0>(). </span><ahref="https://zeal-operating-system.github.io/ZealOS/Compiler/UAsm.CC.html#l836"><spanclass=cF4>U</span></a><spanclass=cF0>(</span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l4089"><spanclass=cF4>_RIP</span></a><spanclass=cF0>);
<aname="l7"></a>* </span><ahref="https://zeal-operating-system.github.io/ZealOS/Compiler/UAsm.CC.html#l836"><spanclass=cF4>U</span></a><spanclass=cF0>(&FunName+offset) to unassemble mem or </span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Debug.CC.html#l334"><spanclass=cF4>Uf</span></a><spanclass=cF0>("FunName") to unassemble a function. </span><ahref="https://zeal-operating-system.github.io/ZealOS/Compiler/UAsm.CC.html#l836"><spanclass=cF4>U</span></a><spanclass=cF0>(</span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l4089"><spanclass=cF4>_RIP</span></a><spanclass=cF0>-16);
<aname="l9"></a>* While debugging, you specify addresses of assembly routines with just the label, as in </span><spanclass=cF2>_MALLOC+0x20</span><spanclass=cF0>. You specify </span><ahref="https://zeal-operating-system.github.io/ZealOS/Doc/CosmiC.DD.html#l1"><spanclass=cF4>CosmiC</span></a><spanclass=cF0>
<aname="l10"></a>function names with </span><spanclass=cF2>&</span><spanclass=cF0> before functions as in </span><spanclass=cF2>&Print+0x10</span><spanclass=cF0>.
<aname="l12"></a>* You can use </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelB.HH.html#l166"><spanclass=cF4>progress1</span></a><spanclass=cF0>-</span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelB.HH.html#l181"><spanclass=cF4>progress4</span></a><spanclass=cF0> for debugging because they show on the wallpaper. They're just global int variables.
<aname="l14"></a>* You can use </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Job.CC.html#l507"><spanclass=cF4>SysLog</span></a><spanclass=cF0>() to send text to the </span><ahref="https://zeal-operating-system.github.io/ZealOS/Doc/Glossary.DD.html#l154"><spanclass=cF4>System Task</span></a><spanclass=cF0> window. It works like </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/StrPrint.CC.html#l1110"><spanclass=cF4>Print</span></a><spanclass=cF0>(). You could also use </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KDebug.CC.html#l244"><spanclass=cF4>RawPrint</span></a><spanclass=cF0>().
<aname="l16"></a>* </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KDebug.CC.html#l195"><spanclass=cF4>D</span></a><spanclass=cF0>(), </span><ahref="https://zeal-operating-system.github.io/ZealOS/System/DolDoc/DocPutS.CC.html#l366"><spanclass=cF4>DocD</span></a><spanclass=cF0>(), </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KDebug.CC.html#l263"><spanclass=cF4>RawD</span></a><spanclass=cF0>() to do 16 column hex dump mem with numbering from zero. With </span><ahref="https://zeal-operating-system.github.io/ZealOS/System/DolDoc/DocPutS.CC.html#l366"><spanclass=cF4>DocD</span></a><spanclass=cF0> the values are updated continually
<aname="l19"></a>* </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KDebug.CC.html#l230"><spanclass=cF4>Dm</span></a><spanclass=cF0>(), </span><ahref="https://zeal-operating-system.github.io/ZealOS/System/DolDoc/DocPutS.CC.html#l352"><spanclass=cF4>DocDm</span></a><spanclass=cF0>(), </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KDebug.CC.html#l281"><spanclass=cF4>RawDm</span></a><spanclass=cF0>() to do 16 column hex dump mem with addresses showing.
<aname="l21"></a>* </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KDebug.CC.html#l235"><spanclass=cF4>Da</span></a><spanclass=cF0>() to do one column address dump (for stack, etc.) with symbolic addresses.
<aname="l23"></a>* </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KDebug.CC.html#l383"><spanclass=cF4>Dr</span></a><spanclass=cF0>() dumps registers. You can display and modify registers in the debugger with variable-like labels, </span><spanclass=cF4>_RAX</span><spanclass=cF0>, </span><spanclass=cF4>_RBX</span><spanclass=cF0>, etc.
<aname="l25"></a>* </span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Debug.CC.html#l216"><spanclass=cF4>ClassRep</span></a><spanclass=cF0>() and the dynamic version </span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Debug.CC.html#l246"><spanclass=cF4>ClassRepD</span></a><spanclass=cF0>() can be used to dump structures.
<aname="l27"></a>* </span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Utils/Profiler.CC.html#l30"><spanclass=cF4>Prof</span></a><spanclass=cF0>() and </span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Utils/Profiler.CC.html#l95"><spanclass=cF4>ProfRep</span></a><spanclass=cF0>() provide code profiling. See </span><ahref="https://zeal-operating-system.github.io/ZealOS/Demo/InFile/InProfile.IN.html#l1"><spanclass=cF4>::/Demo/InFile/InProfile.IN</span></a><spanclass=cF0> (This is an </span><ahref="https://zeal-operating-system.github.io/ZealOS/Doc/Glossary.DD.html#l220"><spanclass=cF4>InFile</span></a><spanclass=cF0>.)
<aname="l29"></a>* Use </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KDebug.CC.html#l244"><spanclass=cF4>RawPrint</span></a><spanclass=cF0>() to print debug info bypassing the window framework. You pass these routines a count in milliseconds for how
<aname="l30"></a>long it should be displayed. You can use </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KMisc.CC.html#l257"><spanclass=cF4>Raw</span></a><spanclass=cF0>(</span><spanclass=cF2>TRUE</span><spanclass=cF0>) to make all output bypass the window framework. The </span><spanclass=cF2>WinMgr</span><spanclass=cF0> runs on </span><spanclass=cF2>Core0</span><spanclass=cF0>
<aname="l33"></a>* Use </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KMisc.CC.html#l247"><spanclass=cF4>SysDebug</span></a><spanclass=cF0>() to set a flag which you can read with </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KMisc.CC.html#l252"><spanclass=cF4>IsSysDebug</span></a><spanclass=cF0>() when you wish to trigger some debug activity. It's just a
<aname="l36"></a>* There are flags for various trace options that can help debugging when there are compiler bugs. Often, you place them in </span><spanclass=cF2>#e
<aname="l39"></a></span><ahref="https://zeal-operating-system.github.io/ZealOS/Compiler/CMisc.CC.html#l66"><spanclass=cF4>Echo</span></a><spanclass=cF0>() turns on or off raw data going into the lexical analyzer.
<aname="l41"></a></span><ahref="https://zeal-operating-system.github.io/ZealOS/Compiler/CMisc.CC.html#l61"><spanclass=cF4>Trace</span></a><spanclass=cF0>() unassembles code generated from the CosmiC compiler.
<aname="l43"></a></span><ahref="https://zeal-operating-system.github.io/ZealOS/Compiler/CMisc.CC.html#l50"><spanclass=cF4>PassTrace</span></a><spanclass=cF0>() shows intermediate code coming-out after optimization. The bits ctrl which passes are displayed.
<aname="l46"></a>* There is a heap check utility which can find leaks. Use </span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Utils/HeapLog.CC.html#l83"><spanclass=cF4>HeapLog</span></a><spanclass=cF0>(), </span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Utils/HeapLog.CC.html#l139"><spanclass=cF4>HeapLogAddrRep</span></a><spanclass=cF0>() and </span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Utils/HeapLog.CC.html#l175"><spanclass=cF4>HeapLogSizeRep</span></a><spanclass=cF0>(). It's a really
<aname="l47"></a>simple program which intercepts </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Memory/MAllocFree.CC.html#l391"><spanclass=cF4>MAlloc</span></a><spanclass=cF0>() and </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Memory/MAllocFree.CC.html#l387"><spanclass=cF4>Free</span></a><spanclass=cF0>(). You can customize the code to find other heap issues.
<aname="l49"></a>* You can define handler functions for </span><spanclass=cF2><CTRL-ALT-letter></span><spanclass=cF0> keys with </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KeyDev.CC.html#l201"><spanclass=cF4>CtrlAltCBSet</span></a><spanclass=cF0>(). They operate either in a interrupt
<aname="l50"></a>environment or in the window mgr when it queues kbd messages. You can do </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KMisc.CC.html#l257"><spanclass=cF4>Raw</span></a><spanclass=cF0>() output. </span><spanclass=cF2><CTRL-ALT-letter></span><spanclass=cF0> handlers take a
<aname="l53"></a>* If you recompile </span><spanclass=cF2>Kernel</span><spanclass=cF0> with </span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootHDIns.CC.html#l25"><spanclass=cF4>BootHDIns</span></a><spanclass=cF0>(), you can set the </span><spanclass=cF4>MemInit</span><spanclass=cF0>, option to initialize memory to a value at boot, the </span><spanclass=cF4>HeapI
<aname="l54"></a>nit</span><spanclass=cF0> option to cause mem alloced off the heap to be initialized or </span><spanclass=cF4>VarInit</span><spanclass=cF0> option so both global and local variables will be
<aname="l56"></a>uninitialized variable bugs. You can set </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelB.HH.html#l145"><spanclass=cF4>sys_var_init_flag</span></a><spanclass=cF0>, and </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelB.HH.html#l141"><spanclass=cF4>sys_heap_init_flag</span></a><spanclass=cF0> directly after booting.