This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug remote/13584] fork support in the remote protocol


https://sourceware.org/bugzilla/show_bug.cgi?id=13584

martin <ranjan.amit8 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ranjan.amit8 at gmail dot com

--- Comment #5 from martin <ranjan.amit8 at gmail dot com> ---
Created attachment 8782
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8782&action=edit
Testcase

Still I am not able to follow the fork and debug the child
process with gdbserver, while without using gdbserver(running gdb alone) i am
easily able to debug the Child Process. 

Steps to reproduce:

$ ./gdbserver :12345 final-fork &
Process final-fork created; pid = 13460
Listening on port 12345

$ ./gdb final-fork

GNU gdb (GDB) 7.10.50.20151115-cvs
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This GDB was configured as "x86_64-pc-linux-gnu".
Reading symbols from final-fork...done.
[?1034h(gdb) target remote :12345
Remote debugging using :12345
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
Reading symbols from target:/lib64/ld-linux-x86-64.so.2...Reading
/lib64/ld-2.18.so.debug from remote target...
Reading /lib64/.debug/ld-2.18.so.debug from remote target...
(no debugging symbols found)...done.
0x0000003b1f6011f0 in _start () from target:/lib64/ld-linux-x86-64.so.2
(gdb) b main
Breakpoint 1 at 0x4006a8: file final-fork.c, line 13.
(gdb) c
Continuing.
Reading /lib64/libc.so.6 from remote target...
Reading /lib64/libc-2.18.so.debug from remote target...
Reading /lib64/.debug/libc-2.18.so.debug from remote target...

Breakpoint 1, main () at final-fork.c:13
13           pid = fork();
(gdb) set follow-fork-mode child
(gdb) b ChildProcess
Breakpoint 2 at 0x40072c: file final-fork.c, line 35.
(gdb) c
Continuing.
pid of process :13468
pid of process :0
Parent Process invoking
Invoking Child Process
This line is from parent, value = 1
This line is from parent, value = 2
This line is from parent, value = 3
This line is from parent, value = 4
This line is from parent, value = 5
This line is from parent, value = 6
This line is from parent, value = 7
This line is from parent, value = 8
This line is from parent, value = 9
This line is from parent, value = 10
This line is from parent, value = 11
This line is from parent, value = 12
This line is from parent, value = 13
This line is from parent, value = 14
This line is from parent, value = 15
This line is from parent, value = 16
This line is from parent, value = 17
This line is from parent, value = 18
This line is from parent, value = 19
This line is from parent, value = 20
*** Parent is done ***

Child exited with status 23
GDBserver exiting
[Inferior 1 (process 13460) exited with code 027]

[8]+  Stopped                 ./gdb final-fork 

NOTE:- Here I am not able to debug Child Process. Update me if I am doing
anything wrong. Also Find the attached test-case.

However When I run gdb alone I am getting the expected output as below:

$ ./gdb final-fork 
GNU gdb (GDB) 7.10.50.20151115-cvs
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This GDB was configured as "x86_64-pc-linux-gnu".
Reading symbols from final-fork...done.
[?1034h(gdb) b main
Breakpoint 1 at 0x4006a8: file final-fork.c, line 13.
(gdb) r
Starting program: /home/kpit/ran44/35-JIRA/gdb/i-gdb/bin/final-fork 

Breakpoint 1, main () at final-fork.c:13
13           pid = fork();
(gdb) set follow-fork-mode child
(gdb) b ChildProcess
Breakpoint 2 at 0x40072c: file final-fork.c, line 35.
(gdb) c
Continuing.
[New process 13519]
[Switching to process 13519]

Breakpoint 2, ChildProcess () at final-fork.c:35
35           asm("nop");
(gdb) c
Continuing.
pid of process :0
Invoking Child Process
   This line is from child, value = 1
   This line is from child, value = 2
   This line is from child, value = 3
   This line is from child, value = 4
   This line is from child, value = 5
   This line is from child, value = 6
   This line is from child, value = 7
   This line is from child, value = 8
   This line is from child, value = 9
   This line is from child, value = 10
   This line is from child, value = 11
   This line is from child, value = 12
   This line is from child, value = 13
   This line is from child, value = 14
   This line is from child, value = 15
   This line is from child, value = 16
   This line is from child, value = 17
   This line is from child, value = 18
   This line is from child, value = 19
   This line is from child, value = 20
   *** Child process is done ***
[Inferior 2 (process 13519) exited with code 041]
(gdb) pid of process :13519
Parent Process invoking
This line is from parent, value = 1
This line is from parent, value = 2
This line is from parent, value = 3
This line is from parent, value = 4
This line is from parent, value = 5
This line is from parent, value = 6
This line is from parent, value = 7
This line is from parent, value = 8
This line is from parent, value = 9
This line is from parent, value = 10
This line is from parent, value = 11
This line is from parent, value = 12
This line is from parent, value = 13
This line is from parent, value = 14
This line is from parent, value = 15
This line is from parent, value = 16
This line is from parent, value = 17
This line is from parent, value = 18
This line is from parent, value = 19
This line is from parent, value = 20
*** Parent is done ***

(gdb) q

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]