ldb - LUnix debugger version 1.0 ================================ Available (commandline-) commands: b break Send character (ascii code 3) to debugged process. c continue Continue process (CTRL+s stopps it) d [[ mid: ] address ] disassemble Disassemble process-code (or any other memory address). With no argument d continues disassembling at the last position. Default for mid is the process' mid. Address is the relative address in the mid-memory area or, if no mid is given the address is relative/absolute/original to the process' startaddress (as defined by the used with the 'm'-command). f dev:filename file Load exacutable file for debugging. h [[ mid: ] address ] hexdump Print a hexdump, syntax like 'd' i info Print process information m[aro] mode ma absolute memory addresses mr relative memory addresses mo original memory addresses (display mode of disassembler) r [ args ] run Run a loaded process with 'args' as commandline parameters. s #signum signal Sends signal #signum to debugged process. t tick Lets the debugged process run for exactly one time slice. (or till there is a 'jsr$$9012' in the code, wich can be used like breakpoints for debugging) NOTE: ldb waits till the process is interrupted while running (if the process is blocked ldb will wait till it is unblocked again) examples: --------- @> ldb LUnix Debug Version 1.0 by Poldi 4.3.1996 ldb> f @:prim { load 'prim' } ldb> r 10000,10 { prim 10000,10 } ldb> i {info} pc=38:0046 sr=00 a=00 x=00 y=00 { mid:reladr ,status register,akku,x-register,y-register } stack 17 90 { $9018=suicide is the return-address, if there is a rts } zp 57 8d 38 35 30 3a 8e 00 59 2f 8d { zero page starting with address $57: ...10 bytes } ldb> d 38:46 { begin disassembling at pc=38:0046 taken from info } $c846 lda#$c8 $c848 jsr$$9051 $c84b jmp$$c991 $c84e rts $c84f lda#$00 $c851 sta$$59 $c853 sta$$5a $c855 sta$$5b $c857 sta$$5c $c859 ldii$57 ldb> mr { switch to relative-address-mode } ldb> h 0 { hexdump starting at relative addr. 0 } $0000 38 f5 fa fa 00 00 00 00 8UZZ.... $0008 00 46 00 00 00 00 00 00 .f...... $0010 00 00 00 00 00 00 00 00 ........ $0018 00 00 4c 1b 90 00 00 00 ..l..... $0020 00 00 00 00 00 00 00 00 ........ $0028 00 00 00 00 00 00 00 00 ........ $0030 00 00 00 00 00 00 00 00 ........ $0038 50 52 49 4d 00 00 00 00 prim.... { 'prim' CMD name in the file } $0040 17 27 00 00 80 00 a9 c8 .'....)h $0048 20 51 90 4c 91 39 60 a9 q.l.9@) ldb> f @:ldb { load 'ldb' } ldb> mo { switch to original address-mode } ldb> d { disassemble code } $7000 38 00 00 00 40 57 06 00 8...@w.. $7008 1c 40 00 00 00 00 00 00 .@...... $7010 00 00 00 00 00 00 00 00 ........ $7018 00 00 4c 48 70 4c 52 70 ..lhPlrP $7020 00 00 00 00 00 00 00 00 ........ $7028 00 00 00 00 00 00 00 00 ........ $7030 00 00 00 00 00 00 00 00 ........ $7038 4c 44 42 00 00 00 00 00 ldb..... $7040 lda#$70 $7042 jsr$$9051 ldb> d { continue disassembling } $7045 jmp$$79aa $7048 se i $7049 lda#$03 $704b ldx$$7001 $704e jsr$$902d $7051 rti $7052 jmp$$901b $7055 pjp$$70a2 $7058 30 31 32 33 34 35 36 37 01234567 $7060 38 39 41 42 43 44 45 46 89abcdef ldb> d { continue disassembling } $7068 01 04 07 0a 0d 10 13 16 ........ $7070 00 00 00 00 00 00 00 00 ........ $7078 00 00 00 00 00 00 00 00 ........ $7080 00 00 00 00 00 00 00 00 ........ $7088 00 00 00 00 00 00 00 00 ........ $7090 00 00 00 00 00 00 00 00 ........ $7098 00 00 00 00 00 00 00 00 ........ $70a0 00 00 .. $70a2 and#$3f $70a4 = $$70d2 ldb> d { continue disassembling } $70a6 cmp#$20 $70a8 bcs$$70ac $70aa ora#$40 $70ac jsr$$9069 $70af bcc$$70d2 $70b1 jsr$$70b7 $70b4 jmp$$901b $70b7 bit$$7071 $70ba bpl$$70d2 $70bc lda$$7075 ---------------------------------------- ldb> f @:prim { load file 'prim' } ldb> r 10000,10 { exec 'prim 10000,10' } ldb> i { info } pc=2d:0046 sr=00 a=00 x=00 y=00 stack 17 90 zp 57 38 a9 20 20 ac 38 a6 57 e8 86 ldb> t { let prim run for one tick } ldb> i { print info agin } pc=2d:0170 sr=23 a=00 x=00 y=04 stack 3d 2f 17 90 zp 57 0a 00 d0 01 00 00 01 01 00 00 ldb> t ldb> i pc=2d:0154 sr=23 a=00 x=00 y=07 stack 3d 2f 17 90 zp 57 0a 00 80 03 00 00 13 04 00 00 ldb> t ldb> i pc=2d:0158 sr=23 a=00 x=00 y=02 stack 3d 2f 17 90 zp 57 0a 00 e4 00 00 00 af 01 00 00 ldb> t ldb> i pc=2d:014b sr=22 a=ff x=00 y=0e stack 3d 2f 17 90 zp 57 0a 00 00 40 1c 00 17 27 00 00 ldb> t 10007 { a prime number calculated by prim after 5 ticks } ldb> i pc=2d:017b sr=21 a=00 x=09 y=04 stack 3d 2f 17 90 zp 57 09 00 60 02 00 00 79 01 00 00 ldb> s s #signum (1..16) sends signal to process ldb> s 7 { send signal 7 'killed parent' } process doesn't support this signal ldb> s 6 { send signal 6 'user break' } ldb> t { another tick.. } Process died { process caught the signal and ended } ldb> i No file loaded ldb> x { exit from ldb .. back to shell } @> disassembler notes: ------------------- The assemblersytax may look strange to you, because it is based on an old assembler i wrote (it was easier to use it's disass-tables as writing some new, wich i may do somewhen in future). lda#$12 --- parameter #12 is decimal, $12 hex, "a ascii,