ref: d8bc774595bf282d119bc61a73d5659ab21bd6ae
parent: 0e5df5b543d9bdd9c6c7ce1b239fd03797fcf823
author: spew <spew@cbza.org>
date: Sun Mar 23 11:09:18 EDT 2025
lsd: minor improvements
--- a/src/plan9/lsd.sl
+++ b/src/plan9/lsd.sl
@@ -132,7 +132,7 @@
4. A string of the form \"file:line\" which specifies a line in a
file of source code.
- Examples:
+ EXAMPLES
`(bpset 'strcpy)` ; breakpoint on strcpy function.
`(bpset (curPC))` ; breakpoint on current instruction.
@@ -150,7 +150,7 @@
4. A string of the form \"file:line\" which specifies a line in a
file of source code.
- Examples:
+ EXAMPLES
`(bpdel 'strcpy)` ; remove breakpoint on strcpy function.
`(bpdel (curPC))` ; remove breakpoint on current instruction.
@@ -207,10 +207,11 @@
(def (cont)
"Continue program execution. Return the next instruction
address to be executed or `NIL` if the program has exited."
- (let ((addr (curPC)))
- (when (has? bptbl addr) (step))
- (startstop)
- (curPC)))
+ (when (has? bptbl (curPC)) (step))
+ (let ((note (startstop)))
+ (unless (void? note) (princ note "\n")))
+ (let ((pc (curPC)))
+ (and pc (princ (hex (curPC)) "\n"))))
(def (func)
"Continue program execution until the current function returns."
@@ -252,7 +253,7 @@
Each element in the list has the form `(address . instr)` where `instr`
is the disassembled instruction at the `address`.
- Examples: just like `(asm)` but returns a list instead of printing."
+ EXAMPLES just like `(asm)` but returns a list instead of printing."
(if (<= n 0)
()
(let ((on-bp (has? bptbl addr)))
@@ -265,7 +266,7 @@
(def (asm (n 5) (addr (curPC)))
"Print the next `n` disassembled instructions at addr.
- Examples:
+ EXAMPLES
`(asm)` ; print out 5 from current program instruction.
`(asm 10)` ; print out 10 from current program instruction.
@@ -292,15 +293,15 @@
"\n" s))
(io-close plumbf)))
-(def (Bline)
- "Step forward one line of source code and then plumb the
- new line (make a bee line) to your editor."
- (line)
- (Bsrc))
+(def (B stepper)
+ "Step forward using the stepper and then plumb the
+ new line to your editor.
-(def (Bover)
- "Same as Bline but with `over`"
- (over)
+ EXAMPLES
+
+ `(B line)`; step one line and then see
+ `(B cont)`; continue and then see where you stop"
+ (stepper)
(Bsrc))
(def (filepc f (line NIL))
@@ -307,7 +308,7 @@
"Return the instruction address corresponding to a filename
and line number. It is the inverse of (src addr).
- Examples:
+ EXAMPLES
#;> (filepc \"/sys/src/cmd/cat.c:5\")
2097192
@@ -318,7 +319,7 @@
(if line
(lsd-file2pc f line)
(let ((s (str-split f ":")))
- (when (not (= (length s) 2)) (error "invalid file"))
+ (unless (= (length s) 2) (error "invalid \"file:line\" format"))
(let ((line (str->num (cadr s))))
(unless line (error "bad line number"))
(lsd-file2pc (car s) line)))))
@@ -327,7 +328,7 @@
"Return a symbol from the attached proc's symbol table or NIL.
Input is a sym.
- Examples:
+ EXAMPLES
#;> (sym-find 'strecpy)
#(symbol \"strecpy\" #\\T 2276784)"