Debugging for retards
There are three manner of debugging, you can use all at same time:
- strace logs
- mlnet logs
- running mlnet under gdb
__Strace logs__
strace mlnet 1>mlnet-stdout.txt 2>mlnet-stderr.txt
As described in Linux I/O Redirection http://www.cpqlinux.com/redirect.html, this will save the stdout and stderr to text files.
Send both files to the developers for debugging after the crash.
__mlnet logs__
In mldonkey console (telnet or gui), type this
set verbosity all (for doing paranoid logging, see verbosity wiki page for more info) set log_file /tmp/mlnetlog (or other location for saving the log)
open_log (for enabling log)
Send the log to the developers for debugging after the crash.
__running mlnet under gdb__
GDB is the debugging brother of GCC. For this, is recommended to compiling the kernel with ./configure --enable-debugging (put your other own stuff you add for enabling networks or other). After this, there are two options:
- Running mlnet with the GDB \"sufix\". For this simply put:
gdb mlnet
But with this you can't use strace at same time.
- Ataching mlnet to GDB after running it. Run mlnet (even with the strace thingie or without it, as you prefer...) and fist see the mlnet pid number with:
ps auxww|grep mlnet
Then appears this:
1000 14084 32.1 4.5 28452 23212 pts/2 R+ 11:21 0:02 mlnet
Where the bold number is the pid. Then simply put this:
gdb --pid= (number of the pid)
2.4 Logging output
You may want to save the output of GDB commands to a file. There are several commands to control GDB's logging.
set logging on
- Enable logging
set logging off
- Disable logging
set logging file FILE
- Change the name of the current logfile. The default logfile is gdb.txt. This command has to be issued before enabling logging.
set logging overwrite [off|on]
- By default, GDB will append to the logfile. Set this to "on" if you want set logging on to overwrite the logfile instead.
set logging redirect [off|on]
- By default, GDB output will go to both the terminal and the logfile. Set this to "on" if you want output to go only to the log file.
show logging
- Show the current values of the logging settings.
( Incomplete, don't know how to saving all info to logs like stdout and stderr but showing them in screen like always, for doing bt after crash).