The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Can a child process return a specific value to a parent process ? Ametis1970 High Level Programming 8 04-10-2008 12:22 AM
Child process is not getting started Crab High Level Programming 5 09-17-2006 10:15 PM
about child process compbug UNIX for Dummies Questions & Answers 12 03-22-2006 07:55 PM
KDM child process larryase UNIX for Dummies Questions & Answers 6 01-24-2005 05:41 PM
Child Process PID skannan High Level Programming 2 06-10-2002 08:54 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-07-2005
shriashishpatil shriashishpatil is offline
Registered User
  
 

Join Date: Dec 2005
Location: Pune
Posts: 81
gdb to child process

Hi,

I want to debug a child process which is forked from other process.
Whenever I try to attach the pid of child process to gbd, the
process gets killed and the parent process starts a new child process.

any idea what could be the reason.
In general how can i debug a child process with gdb.

thanks in advance.

-Ashish
  #2 (permalink)  
Old 12-07-2005
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,764
Basically you have to pause the child, get it's pid, then have gdb attach to it.

See:
http://www.cs.ust.hk/~keithlau/Pilot...16/gdb_26.html
  #3 (permalink)  
Old 12-08-2005
shriashishpatil shriashishpatil is offline
Registered User
  
 

Join Date: Dec 2005
Location: Pune
Posts: 81
gdb to child process

thanks for your help.

I tried to place sleep in child process. But the child process exec another
process. I tried to keep sleep at the start od execed program too, but it get defuncted immediately after I attach the pid to gdb.
Any pointers in this direction,

thanks in advance,
  #4 (permalink)  
Old 12-09-2005
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,764
Try creating a signal handler in the "second" child. Have it wait forever for a user defined signal like SIGUSR1 for example.

The idea is to prevent the process from doing anything until you have attached to it.
  #5 (permalink)  
Old 12-12-2005
shriashishpatil shriashishpatil is offline
Registered User
  
 

Join Date: Dec 2005
Location: Pune
Posts: 81
Jim,
thanks for ur help.

I am able to attach the pid of child process to gdb (by putting sleep in main) . But it(child) gets defuncted in a while and my parent process starts a new child process.
Parent process uses a hell lot of threads and might be that is causing the problem.
Jim, I wish u would sit beside me and tell these fundas in depth :-).

Any pointers in this direction would help.

Thanks in advance.
-Ashish
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:43 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0