PROPHET/OS

NAME

debug: near is what turns an address in a fault message into a name

SYNOPSIS

debug sym <name>        address of a kernel symbol

DESCRIPTION

debug near <hexaddr>          the symbol just below an address
debug map                     where this run lies, stretch by stretch
debug stack <thread>          the kernel call stack of a waiting thread
debug net                     every open socket this user may see
debug mem <hexaddr> [n]       dump kernel memory, 64 bytes by default
debug watch <addr> [rw] [n]   set a watchpoint
debug watch off               clear it
debug caught                  what it last caught
debug --tui [prog ...]        the split screen

near is what turns an address in a fault message into a name. The symbol table comes from /system/ksym.all, every symbol of the linked kernel, static ones too; without it the global names of /system/ksym.

A watchpoint uses the processor's debug registers, so there are few of them and they cost nothing while nothing hits them. Setting it arms every core, so a writer on any of them is caught.

The tabs

debug --tui                     the debugger alone, on the Cores tab
debug --tui stress cpu          with a program beside it

Fifteen tabs: Program (the program's own screen, in a terminal of its own, so a program that paints cells like top stays in its tab; while it runs every key but Tab goes to it), Cores (load and the thread each core runs), Threads (every thread, the core it runs on), Locks (who waits on whom, DEADLOCK when the kernel closed a chain, then the spinlocks by wait share), Memory (hex at a cursor with its symbol), Watch, Log (the kernel ring), Calls (the program's system calls per block with their errors, and its libraries), Access (every path, channel and call the program reached, with how often it was asked, read, written or opened, and how often refused by Sicht or a missing right; only a program debug started is traced, and the programs that one starts in turn), Rights (every right held, given away or never had, the folders of its Sicht with r w l x, and each refusal with its reason), Net (every open TCP connection and UDP port of the program, with its peer, bytes in and out, and errors: retransmissions for TCP, packets lost to a full queue for UDP), Events (the trail of a traced program: runs and threads started, ended or fallen, signals sent, memory taken and given, refusals; space pauses, the arrows scroll back, s writes it to debug-events.txt), Diff (a and b take two snapshots, and the tab shows what changed between them: threads gone, new or in another state with their switches and run time, calls per block, memory present and cold with new stretches, the names reached, and the network bytes), Map (every stretch of pages with its address, size, rights, how many pages are present, cold or nailed, and what it is: image, heap, stack, shadow stack or a side thread's stack), Settings.

The program runs one priority step below the debugger, so the picture stays smooth however hard the program loads the machine.

Tab, Shift+Tab, 1 to 0   the tab (Net to Settings only by Tab)
Up, Down, PgUp, PgDn     move the choice or the view
Enter                    details of the chosen thread (with its
                         kernel call stack) or lock;
                         on a core, its thread
g                        Memory: go to a symbol or a hex address
w, W                     Memory: set or clear the watchpoint
Left, Right              Settings: change the chosen setting
q, Esc                   end, and the program with it

Settings: the priority of the program (idle, low, normal), how often the picture is read, freeze, whether finished threads show, the trace of the kernel, and the width and kind of the watchpoint.

EXAMPLE

$ debug --help
debug sym <name>        address of a kernel symbol
debug near <hexaddr>    the symbol just below an address
debug map               where this run lies, stretch by stretch
debug stack <thread>    the kernel call stack of a thread that waits
debug net               every open socket this user may see
debug mem <hexaddr> [n] dump kernel memory (default 64 bytes)
debug watch <addr> [rw] [n]  set a watchpoint
debug watch off         clear it
debug caught            what it last caught
debug --tui [prog ...]  split screen: the debugger left, the program right

SEE ALSO

log, mods, state