Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6628445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:07:55+00:00 2026-05-25T22:07:55+00:00

I am unable to debug a child process of a remote debugging session. I

  • 0

I am unable to debug a child process of a remote debugging session. I found a similar question How to debug the entry-point of fork-exec process in GDB?

I am following the same procedure, although for a remote target. Is follow-fork-mode child supported for remote targets ?

Following is my sample code..

      1 #include <stdio.h>
      2 #include <stdlib.h>
      3 #include <sys/types.h>
      4 #include <unistd.h>
      5
      6 int spawn (void)
      7 {
      8         pid_t child_pid;
      9         /* Duplicate this process. */
     10         child_pid = fork ();
     11         if (child_pid != 0)
     12                 /* This is the parent process. */
     13                 return child_pid;
     14         else {
     15                 /* Now execute PROGRAM, searching for it in the path. */
     16                 while(1)
     17                 {
     18                         static int i = 0;
     19                         if(i==0)         /* break here for child */
     20                         {
     21                                 printf("I am child\n");
     22                         }
     23                         else if(i==3)
     24                         {
     25                                 return 1;
     26                         }
     27                         else
     28                         {
     29                                 i = 0/0;
     30                         }
     31                         i++;
     32                 }
     33         }
     34         return 0;
     35 }
     36 int main ()
     37 {
     38         /* Spawn a child process running the .ls. command. Ignore the
     39            returned child process ID. */
     40         printf("Hello World..!!\n");
     41         spawn ();
     42         printf ("Bbye World..!!\n");
     43         return 0;
     44 }

Running it with gdb, I can set set break point in child.. all fine here.!!

sh-3.2# gdb fork
(gdb) set follow-fork-mode child
(gdb) set detach-on-fork off
(gdb) b 19
Breakpoint 1 at 0x80483d0: file fork-exec.c, line 19.
(gdb) c
The program is not being run.
(gdb) start
Breakpoint 2 at 0x8048437: file fork-exec.c, line 40.
Starting program: fork
main () at fork-exec.c:40
40              printf("Hello World..!!\n");
(gdb) c
Continuing.
Hello World..!!
[Switching to process 10649]

Breakpoint 1, spawn () at fork-exec.c:19
19                              if(i==0)         /* break here for child */
(gdb)

However if I try to catch child via gdbserver break point is lost..

sh-3.2# gdbserver :1234 fork &
[5] 10686
sh-3.2# Process fork created; pid = 10689
Listening on port 1234

Run as target remote

sh-3.2# gdb fork
(gdb) target remote localhost:1234
Remote debugging using localhost:1234
Remote debugging from host 127.0.0.1
[New Thread 10689]
0x00bd2810 in _start () from /lib/ld-linux.so.2
(gdb) break 19
Breakpoint 1 at 0x80483d0: file fork-exec.c, line 19.
(gdb) c
Continuing.
Hello World..!!
Bbye World..!!

Child exited with retcode = 0

Program exited normally.

Child exited with status 0
GDBserver exiting

What is the procedure to debug child process in embedded world. I know I can do a process attach, but I want to debug from the very beginning of the child process..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:07:55+00:00Added an answer on May 25, 2026 at 10:07 pm

    It is called follow-fork. No, it is not supported in gdbserver.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am unable to run my code in debug using gdb because of the
When trying to debug my web application, I'm getting an unable to start debugging
HI all, Firebug is not displaying Complete js file to debug. I m unable
I'm unable to debug a WinForms C# application using the released version of Visual
I'm currently working on some geolocation javascripts, but am unable to test and debug
I am getting a novel error message, which I am unable to debug. I
i am unable to write log any info, error, debug using log4net, i tried
error_log shows the following line on startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so' -
Can anyone suggest how to debug stored procedure from a remote sql server using
I am using Visual Studio 2010 with IIS 5.1 but unable to debug my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.