Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Richard <rgrdev@googlemail.com>
To: Richard <rgrdev@googlemail.com>
Cc: Richard <rgrdev@gmail.com>,  gdb@sources.redhat.com
Subject: Re: fork debugging : back to parent.
Date: Tue, 08 Aug 2006 08:49:00 -0000	[thread overview]
Message-ID: <87zmef393u.fsf@mail.com> (raw)
In-Reply-To: <20060808000358.GA744@nevyn.them.org> (Daniel Jacobowitz's 	message of "Mon, 7 Aug 2006 20:03:58 -0400")

Daniel Jacobowitz <drow@false.org> writes:

> On Mon, Aug 07, 2006 at 11:47:03PM +0200, Richard wrote:
>> set follow-fork-mode to both is not supported:
>
> Sorry, try turning off detach-on-fork.  See "help set".
>
>> Sorry, if I'm missing something obvious. How owuld I browse "recent
>> features" in CVS?
>
> Take a look at the NEWS file.
>
> -- 
> Daniel Jacobowitz
> CodeSourcery
>

I think I answered my own question:

By setting follow to parent and detach to off, one can use info fork in
the parent thread in order to switch to the child thread.

If follow is set to child and detach is off, then there is no fork info
in the child for some reason so you cant switch back to the parent. Is
this a bug?

(1) follow parent and then switch to the child fork - we end up at our
childs breakpoint "pit_t par=" etc...
,----
| >set follow parent
| >set detach off
| >c
| Continuing.
| % date
| Breakpoint 3, main () at forkcmd.c:31
| 31                      if ((pid = waitpid(pid, &status, 0)) < 0)
| >info fork
|   1 process 11319 at 0xffffe410, <__kernel_vsyscall>
| * 0 process 11308 (main process) at 0x80487e6, file forkcmd.c, line 31
| >fork 1
| Reading in symbols for ../sysdeps/i386/elf/start.S...done.
| Switching to process 11319
| #0  __kernel_vsyscall ()
| >c
| Continuing.
| 
| Breakpoint 2, main () at forkcmd.c:23
| 23               pid_t par = getppid();
| >
`----

(2) try to follow child to a break and switch back to parent fork : not possible.

,----
| >set follow child
| >run
| The program being debugged has been started already.
| Start it from the beginning? (y or n) y
| Starting program: etc
| Reading symbols from system-supplied DSO at 0xffffe000...done.
| Reading symbols from /lib/tls/i686/cmov/libc.so.6...done.
| Reading symbols from /lib/ld-linux.so.2...done.
| 
| Breakpoint 1, main () at forkcmd.c:11
| 11              printf("%% ");  /* print prompt (printf requires %% to print %) */
| >c
| Continuing.
| % date
| [New process 11385]
| 
| Program received signal SIGINT, Interrupt.
| __kernel_vsyscall ()
| >c
| Continuing.
| c
| 
| Program received signal SIGINT, Interrupt.
| __kernel_vsyscall ()
| >info fork
| * 2 process 11385 at 0xffffe410, <__kernel_vsyscall>
`----

Am I misunderstandong something? Thanks for any help.




-- 


  parent reply	other threads:[~2006-08-08  8:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-07 20:21 Richard (sent by Nabble.com)
2006-08-07 21:07 ` Daniel Jacobowitz
2006-08-07 21:47   ` Richard
2006-08-08  0:04     ` Daniel Jacobowitz
2006-08-08  7:27       ` Richard
2006-08-08  8:49       ` Richard [this message]
2006-08-08 13:16         ` Daniel Jacobowitz
2006-08-10 21:06 ` Richard
2006-08-10 21:39   ` Daniel Jacobowitz
2006-08-10 22:06     ` Richard
2006-08-10 22:10       ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zmef393u.fsf@mail.com \
    --to=rgrdev@googlemail.com \
    --cc=gdb@sources.redhat.com \
    --cc=rgrdev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox