Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

gdb problem

[es] :: Linux :: gdb problem

[ Pregleda: 3046 | Odgovora: 3 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

shiggy
Bg

Član broj: 1367
Poruke: 121
*.yubc.net



Profil

icon gdb problem31.05.2003. u 21:12 - pre 254 meseci
Koristim gdb u okviru emacs-a. U momentu kad se proces forkuje, gdb nastavlja
da prati parent proces (u kome se nishta bitno ne deshava). Kako da debagujem child? Gledao sam po dokumentaciji ali sam samo izgubio preko potrebno vreme. Spremam ispit koji ce vrlo brzo doci pa vas molim da shto pre odgovorite.

Unpred hvala
 
Odgovor na temu

shiggy
Bg

Član broj: 1367
Poruke: 121
*.yubc.net



Profil

icon Re: gdb problem02.06.2003. u 00:46 - pre 254 meseci
jel ovo mene svi kuliraju ili niko ne zna odgovor na ovo pitanje?
 
Odgovor na temu

Dejan Lozanovic
Dejan Lozanovic
Beograd

Član broj: 691
Poruke: 2325
217.26.67.*

Jabber: null@elitesecurity.org
Sajt: speedy-order.com


+75 Profil

icon Re: gdb problem02.06.2003. u 14:35 - pre 254 meseci
Ovo je iz mana

Code:

       You  can,  instead, specify a process ID as a second argu-
       ment, if you want to debug a running process:

       gdb program 1234

       would attach GDB to process 1234 (unless you also  have  a
       file  named `1234'; GDB does check for a core file first).

A ovo iz info-a ne znam kako nisi nasao ali ja sam za dve sekunde nasao i kada sam prvi put trazio,.

Code:

File: gdb.info,  Node: Processes,  Prev: Threads,  Up: Running

Debugging programs with multiple processes
==========================================

   On most systems, GDB has no special support for debugging programs
which create additional processes using the `fork' function.  When a
program forks, GDB will continue to debug the parent process and the
child process will run unimpeded.  If you have set a breakpoint in any
code which the child then executes, the child will get a `SIGTRAP'
signal which (unless it catches the signal) will cause it to terminate.

   However, if you want to debug the child process there is a workaround
which isn't too painful.  Put a call to `sleep' in the code which the
child process executes after the fork.  It may be useful to sleep only
if a certain environment variable is set, or a certain file exists, so
that the delay need not occur when you don't want to run GDB on the
child.  While the child is sleeping, use the `ps' program to get its
process ID.  Then tell GDB (a new invocation of GDB if you are also
debugging the parent process) to attach to the child process (*note
Attach::).  From that point on you can debug the child process just
like any other process which you attached to.

   On HP-UX (11.x and later only?), GDB provides support for debugging
programs that create additional processes using the `fork' or `vfork'
function.

   By default, when a program forks, GDB will continue to debug the
parent process and the child process will run unimpeded.

   If you want to follow the child process instead of the parent
process, use the command `set follow-fork-mode'.

`set follow-fork-mode MODE'
     Set the debugger response to a program call of `fork' or `vfork'.
     A call to `fork' or `vfork' creates a new process.  The MODE can
     be:

    `parent'
          The original process is debugged after a fork.  The child
          process runs unimpeded.  This is the default.

    `child'
          The new process is debugged after a fork.  The parent process
          runs unimpeded.

    `ask'
          The debugger will ask for one of the above choices.

`show follow-fork-mode'
     Display the current debugger response to a `fork' or `vfork' call.

   If you ask to debug a child process and a `vfork' is followed by an
`exec', GDB executes the new target up to the first breakpoint in the
new target.  If you have a breakpoint set on `main' in your original
program, the breakpoint will also be set on the child process's `main'.

   When a child process is spawned by `vfork', you cannot debug the
child or parent until an `exec' call completes.

   If you issue a `run' command to GDB after an `exec' call executes,
the new target restarts.  To restart the parent process, use the `file'
command with the parent executable name as its argument.

   You can use the `catch' command to make GDB stop whenever a `fork',
`vfork', or `exec' call is made.  *Note Setting catchpoints: Set
Catchpoints.

tako da ne znam sta da ti kazem osim da ubuduce pazljivije citas to sto trazis
 
Odgovor na temu

shiggy
Bg

Član broj: 1367
Poruke: 121
*.beotel.net



Profil

icon Re: gdb problem05.06.2003. u 19:02 - pre 254 meseci
zahvaljujem na odgovoru... mada sam skoro digao ruke od gdb-a, jer izgleda neshto treba dodatno da se podesi. probao sam i attach i set follow-fork-mode ali ni jedno ni drugo ne daju rezultata.(dodushe atach ubije proces koji trenutno debagujem) ali ne nastavi child. A set follow kao da neme efekta kad dodje do forka on nastavi sa parentom bilo shta da se postavi (ask,child), a chuio sam da follow-fork radi samo na HP unixu.. tako da nishta od toga....

pozdrav


ps:josh jednom hvala na odgovoru...
 
Odgovor na temu

[es] :: Linux :: gdb problem

[ Pregleda: 3046 | Odgovora: 3 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.