public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "hewei4321017 at 163 dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug c++/30384] gdbserver get an error when father process exit
Date: Mon, 24 Apr 2023 11:49:07 +0000	[thread overview]
Message-ID: <bug-30384-4717-6dRbLN9Tij@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30384-4717@http.sourceware.org/bugzilla/>

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

--- Comment #3 from 贺伟 <hewei4321017 at 163 dot com> ---
Comment on attachment 14845
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14845
test code

#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <ostream>
#include <unistd.h>
#include <string.h>
#include<algorithm>
#include <assert.h>
#include <sys/types.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <pthread.h>
#include <map>
#include <vector>
#include <sys/ptrace.h>
#include <sys/prctl.h>
#include <sys/user.h>
#include <sys/syscall.h>


using namespace std;
int main(int args, char* argv[], char* envp[])
{

    int g = 1;
    pid_t pid = fork();
    if (pid < 0) {
        return -1;
    } else if (pid == 0) {
        int i = 0;
        while (1) {
            int a = 3;
            i++;
            cout << "child:" << getpid() << endl;
            sleep(2);
        }

    } else if (pid > 0) {
        // cout << "father pid:"<<  getpid() << endl;

        int i = 0;
        while (i<5) {
            cout << "father:" << getpid() << endl;
            i++;
            sleep(2);
        }
        exit(0);

    }

    return 0;

}

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

  parent reply	other threads:[~2023-04-24 11:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-24 11:13 [Bug c++/30384] New: " hewei4321017 at 163 dot com
2023-04-24 11:16 ` [Bug c++/30384] " hewei4321017 at 163 dot com
2023-04-24 11:41 ` hewei4321017 at 163 dot com
2023-04-24 11:49 ` hewei4321017 at 163 dot com [this message]
2023-04-24 11:51 ` hewei4321017 at 163 dot com
2023-04-24 11:52 ` hewei4321017 at 163 dot com
2023-11-23 15:13 ` [Bug server/30384] " tromey at sourceware dot org

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=bug-30384-4717-6dRbLN9Tij@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).