Compile your program with lcc -G To start your program, type
a.out --pause-- argsIt will print out a message like
=> DEBUG NUB <= to debug: /usr/local/bin/ldb target a.out connect dynastar 1143In a separate window, execute the ldb command. You can also start ldb by typing just `ldb' or `ldb a.out'. You must execute ldb from the directory in which a.out was linked. ldb has a cd command so you can change directories without restarting. Type '?' to ldb for a list of commands.
If you just want to debug a running program, send it a QUIT, which the debug nub will catch.
disc wait (disconnect) target a.out (loses old state, including bad exp server) connect host port (reconnect to the same target)
Complaints, questions, or comments to nr@cs.tufts.edu.
To dereference pointers in structures, arrays, etc, type to ldb i /followpointers 1 def 2, 3, or more will follow more pointers. 0 is default, doesn't follow pointers.
By default ldb prints only the first 100 elements of an array. To change the number, type to ldb
i /$ArrayLimit 15 defe.g. to print the first 15 elements. Similary ldb prints only the first 30 characters of strings; for more, type to ldb e.g.
i /$StringLimit 50 def