Daemon process debugger

This is a discussion on Daemon process debugger within the C Programming forums, part of the General Programming Boards category; Hai all, I have wrote a daemon program.Then I tried to debug it using ddd and gdb debuggers.But when the ...

  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
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,274
    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
    Maz
    Maz is offline
    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, 11:05 AM
  2. Replies: 3
    Last Post: 02-20-2009, 12:46 AM
  3. Replies: 3
    Last Post: 10-15-2008, 10:24 AM
  4. Problem with forking a process
    By Unitedroad in forum C Programming
    Replies: 10
    Last Post: 10-04-2007, 02:43 AM
  5. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 08:53 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21