How does one debug smbd?

Michael H. Warfield mhw at
Wed Jul 18 21:52:48 GMT 2001

On Wed, Jul 18, 2001 at 02:31:38PM -0700, eric steadle wrote:
> This should probably be a FAQ but I can't find the
> piece of magic that I need to make it work.

> I'd like run smbd in a debugger (gdb is fine)
> interactively, but when I do so, I get tripped up by
> the following line of code in server.c:

>     if (!is_daemon && !is_a_socket(0)) 

	Why not start up smbd separately and then run gdb on the object file
and then attack to the PID you want to debug?

	You still have to make sure you get the right PID if there
are several and you are going for a particular one.

	Doesn't help much if you have to catch it quickly before it does
something early on, but it works fine if it's a process sitting there
waiting for something to respond to.

> The debug message below this line leads me to believe
> that standard input is not a socket, but not being a
> daemon wizard, that doesn't mean much to me. What is
> this line of code doing, exactly? 

> More to the point, how do I get smbd not to fork, and
> to run in my debugger so I can trace some things. 

	I think that's controlled from the "-D" option.  Don't use it
and it shouldn't fork.  (?)


 Michael H. Warfield    |  (770) 985-6132   |  mhw at
  (The Mad Wizard)      |  (678) 463-0932   |
  NIC whois:  MHW9      |  An optimist believes we live in the best of all
 PGP Key: 0xDF1DD471    |  possible worlds.  A pessimist is sure of it!

More information about the samba-technical mailing list