Thread: Daemon process debugger

  1. #1
    Registered User
    Join Date
    Nov 2008
    Location
    INDIA
    Posts
    64

    Question Daemon process debugger

    Hai all,
    I have wrote a daemon program.Then I tried to debug it using ddd and gdb debuggers.But when the parent is exit its process the debugger stops its job.From that I understood that we can't debug a daemon program using ddd and gdb.CAn any one help me to debug the daemon program.

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by karthigayan View Post
    Hai all,
    I have wrote a daemon program.Then I tried to debug it using ddd and gdb debuggers.But when the parent is exit its process the debugger stops its job.From that I understood that we can't debug a daemon program using ddd and gdb.CAn any one help me to debug the daemon program.
    What is the "parent" you are referring to? How exactly are you invoking the debugger?
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #3
    Registered User Maz's Avatar
    Join Date
    Nov 2005
    Location
    Finland
    Posts
    194
    When a daemon() call is done, what actually happens is fork(), after which the parent calls _exit() leaving the child to be running. (simplified). So unless you tell your debugger to "trace children" (see gdb's man page), it will quit when the process it was first attached to exits. Another option is to start the daemon without debugger, and after the parent has exited, you can attach the gdb to running children. (again, see gdb's man page).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. init adopts zombie process?
    By password636 in forum Linux Programming
    Replies: 4
    Last Post: 07-01-2009, 10:05 AM
  2. Replies: 3
    Last Post: 02-20-2009, 12:46 AM
  3. Replies: 3
    Last Post: 10-15-2008, 09:24 AM
  4. Problem with forking a process
    By Unitedroad in forum C Programming
    Replies: 10
    Last Post: 10-04-2007, 01:43 AM
  5. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 07:53 AM

Tags for this Thread