Help on debugging smbd daemon with GDB

meow at computer.org meow at computer.org
Fri May 30 01:11:40 GMT 2003


Hi Dave:
        Thanks for your suggestion. 
        I tried to run smbd -i in GDB. 
        Another process still fork when a window clients connects to the 
samba server. 
        And, I attached the fork child process to GDB and attempted single 
step, same gdb-internal-error occur... 

        Forgot to mentioned that I ran samba on RedHat7.3 
 
Yen

 





David Collier-Brown -- Customer Engineering <David.Collier-Brown at Sun.COM>
Sent by: samba-technical-bounces at lists.samba.org
29/05/2003 01:49

 
        To:     meow at computer.org
        cc:     samba-technical at lists.samba.org
        Subject:        Re: Help on debugging smbd daemon with GDB


   I run smbd -i under gdb at home.

--dave

meow at computer.org wrote:
> 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 */
>                 {
>                         sleep(100);
>                         printf(" I don't want to  be a zombie\n");
>                 }
> 
>                 return 0;
>         }
> 
> 
> 


-- 
David Collier-Brown,           | Always do right. This will gratify
Sun Microsystems DCMO          | some people and astonish the rest.
Toronto, Ontario               |
(905) 415-2849 or x52849       | davecb at canada.sun.com







More information about the samba-technical mailing list