Re: Debugging an exec'ed process



jt@xxxxxxxxxxx (Jens Thoms Toerring) writes:

Linny <linvin333@xxxxxxxxx> wrote:

We would like to use 'gdb' to debug our executable(with debugging
symbols) but the client which runs our module is a debug stripped
version.

It doesn't matter: you'd have the exact same problem if it was
built with full debug info.

Here is an answer:

(gdb) help set follow-fork-mode
Set debugger response to a program call of fork or vfork.
A fork or vfork creates a new process. follow-fork-mode can be:
parent - the original process is debugged after a fork
child - the new process is debugged after a fork
The unfollowed process will continue to run.
By default, the debugger will follow the parent process.

if ( ( cd = getenv( "CHILD_DEBUG" ) ) != NULL && *cd != '\0' )
{
fprintf( stderr, "Child process pid = %d\n", getpid( ) );
sleep( 36000 );
}

This technique often allows one to debug "early startup problems",
but likely isn't necessary for the OP's problem.

A useful variation is to check "DEBUGGER" environment variable,
and if set invoke DEBUGGER with correct executable and pid:
no need to sleep(), nor to retype pid.

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
.



Relevant Pages

  • Re: dde Debug message
    ... The DDE is the absolute worst debugger I have ever used. ... it is the only one that can debug MT apps on hpux 10.20 ... The other thing you can do is run the app under gdb until it SIGSERVs ... In order to understand recursion you must first understand recursion. ...
    (comp.unix.programmer)
  • Re: How to specify a new but non-default path of gdb in gcc?
    ... Remove all numerals to get the correct address.] ... debugger you use to debug it, ... You do not need to recompile your program to debug it with your ... In order to understand recursion you must first understand recursion. ...
    (comp.os.linux.development.apps)
  • Re: How to connect to children process
    ... Main problem is amount of manual operations required per debug cycle. ... connection to DLL with debugger takes sensible amount of time and manual ... Is the main problem that the debugger keeps symbols file loaded ... AFAIK that's how VS2003 debugger works, but WinDbg should usually ...
    (microsoft.public.vsnet.debugging)
  • Re: Need Help Debugging
    ... you should use straight and plain ADPlus.VBS from the debugger package. ... debug info loaded, etc... ... does that avoid using the stack ?!? ... which is our custom CRITICAL_SECTION class. ...
    (microsoft.public.win32.programmer.kernel)
  • gnome-settings-daemon crashed twice
    ... To debug your program, run it with the --sync command line ... backtrace from your debugger if you break on the gdk_x_errorfunction.) ...
    (GNOME)