|
|
Arbitrary functions can be called, by using the C syntax for calling functions; a function call may occur anywhere in an expression. For example, to call the function ps (which is built into SCODB):
debug0:18> ps()
FLAGS S UID PID PPID CPU PRI NI WAITCHAN CMD
2019 S 0 0 0 0 0 14 runout sched
...
Arguments can be passed to functions:
debug0:19> outb($port, $value)
0
Any function in the kernel can be called
from within SCODB.
In addition SCODB includes some functions
that may be useful.
A full list can be
obtained by typing ? at the command line):
The output format of the ps( ) function can be modified by changing the contents of an internal SCODB variable called scodb_options. The default style is to output the process slot number in the first column. By setting bit 1 (the value 2) in the scodb_options variable, the process flags are displayed in the first column instead (this is the original style):
debug0:19>The ``waitchan'' field can be displayed numerically rather than symbolically by setting bit 2 (the value 4) in scodb_options:scodb_options=2
2 debug0:20>ps()
FLAGS S UID PID PPID CPU PRI NI WAITCHAN CMD 2019 S 0 0 0 0 0 14 F01F47C4 sched ...
debug0:19>scodb_options=4
4 debug0:20>ps()
SLOT S UID PID PPID CPU PRI NI WAITCHAN CMD 0 S 0 0 0 0 0 14 F01F47C4 sched ...
Be careful when calling functions because SCODB does not check the argument type or value.
Note that, on multiprocessing configuration, calling the inb(D3oddi) and outb(D3oddi) family of functions from SCODB on a processor that does not have access to the I/O bus has unpredictable results. Character strings enclosed in double-quotes are placed in temporary memory, and are valid for the duration of the expression in which they occur, and have the type char *. Note that a string used in one expression should not be used in another expression, since the memory may have been reused for another string since then, so debugger variables should not be assigned string values:
debug0:20>An example of proper use of string literals is in breakpoint commands, to use the printf( ) function:var s1 "string 1"
debug0:21>var s2 "string 2"
debug0:22>$s1 == $s2
1
debug0:23>In the above breakpoint example, each time open( ) is called, its arguments are printed, and control returned to the kernel.bp mod open
Enter commands to execute at breakpoint: [1]{>}printf("open(%s, %o, %o)\n", u.u_arg[0], u.u_arg[1], u.u_arg[2])
[2]q
[3] <Esc> :q