- Download samba source code from http://www.samba.org and compile it (without source code, it will be impossible to do symbolic debugging).
- Stop or kill any other samba instances.
Start samba under gdb:
gdb <path/to/compiled/smbd>
Specify
smbd
parameters:set args -i -M single
Parameters -i -M single
force smbd
to start as single process, do not daemonize and print all messages and errors to stdout/stderr.
Now, you can set breakpoints and trace your source code as you normally would with any other program.
Note: instead of using gdb
, you might find more convenient to use gdb-tui
(gdb text user interface), or use other debuggers like ddd
.