Help on debugging smbd daemon with GDB

meow at meow at
Wed May 28 03:16:21 GMT 2003

Hi :
        Could someone share with me on how to do source level debugging on 
smbd dameon using gdb. 
        I had done everything told in gdb man page, putting sleep() in the 
code, gdb still failed with gdb-internal error when debugging smbd daemon.

        According to GDB man page, one could attach to the child process 
by putting sleep after the child process started. 
        Hence, I 'd inserted sleep(100) at the start of the 
smbd_process().  And attach the child process to gdb once the child 
process gone to  sleep. 
        Once attach, the child process immediate return from the 
nanosleep() function, and do single stepping on the smbd_process; then, 
the gdb "crashed" and the folliowing errors printed:

        lin_lwp:1105 gdb-internal-error: lin_lwp_wait: Assertion 
'WIFSTOPPED(status) && WSTOPSIG(status) == SIGSTOP' failed. 
        An internal GDB error was detected. This might make further 
debuggin unreliable. Stop debugging session (y/n)?  n

        Create a core file containing the current state of GDB (y/n) ? n 

        , gdb exit. I am not sure it's a gdb bug or inproper use of the 
gdb. Anyway, I wrote a simple forking program and use the same debuggin 
method.  THis time I could attach to the child in sleeping and able to 
step the child process in gdb. 
        The gdb version is 5.3.1. 

        Please help, I really run out of idea on how to do source level 
debugging smbd.... 

        For your reference, here;s the simple fork program: 
        int main()
                int pid, status;
                if((pid= fork() < 0)
                        printf("fork error\n");
                else if (!pid){ /* child */
                        printf(" I don't want to  be a zombie\n");
                return 0;

More information about the samba-technical mailing list