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] New: gdbserver get an error when father process exit
Date: Mon, 24 Apr 2023 11:13:02 +0000	[thread overview]
Message-ID: <bug-30384-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 30384
           Summary: gdbserver get an error when father process exit
           Product: gdb
           Version: 13.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: hewei4321017 at 163 dot com
  Target Milestone: ---

Overview:
  when debugging multi-process with gdb and gdbserver on ubuntu 22.04,
gdbserver get 
an error "Cannot get thread handle for LWP 556726: generic error" when parent
exit

Steps to Reproduce:
1、compile excutable
g++ main.cpp -g -o test

2、run gdbserver with command 
hewei@hewei-VirtualBox:~/project/gdb-13.1$ ./gdbserver/gdbserver  0.0.0.0:5012
/home/hewei/project/testipc/src/main/test
Process /home/hewei/project/testipc/src/main/test created; pid = 557078
Listening on port 5012

3、run gdb and input the following command
set mi-async on
set detach-on-fork off
set follow-fork-mode parent
set schedule-multiple on
target remote 10.27.8.145:5012
continue

4、when father process exit,gdbserver will get an error. 
Child exited with status 0
gdbserver: Cannot get thread handle for LWP 557093: generic error

5、After that,it won't be able to debug the child process any more. When I try
to switch to the child and press "ctrl + c" to interrupt the child in gdb, it
will output the following msg:

Reading
/usr/local/lib/debug/.build-id/02/17e95cdd5172617b053d3772efce4317a55898.debug
from remote target...
[Inferior 1 (process 557078) exited normally]
(gdb) info inferior
  Num  Description       Connection                  Executable
* 1    <null>            1 (remote 10.27.8.145:5012)
target:/home/hewei/project/testipc/src/main/test
  2    process 557093    1 (remote 10.27.8.145:5012)
target:/home/hewei/project/testipc/src/main/test
(gdb) inferior 2
[Switching to inferior 2 [process 557093]
(target:/home/hewei/project/testipc/src/main/test)]
[Switching to thread 2.1 (Thread 557093.557093)]
^C
^CThe target is not responding to GDB commands.
Stop debugging it? (y or n)

Actual Results:
  unable to continue debugging child process

Actual Results:
  After parent exit, I can continue to debug the child.

Additional Builds and Platforms
   gdb and gdbserver are built on ubuntu 22.04 with gcc 7.55

hewei@hewei-VirtualBox:~/project/testipc/src/main$ gcc --version
gcc (Ubuntu 7.5.0-6ubuntu2) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

build command:
./configure --enable-targets=aarch64-linux-gnu,x86_64-linux-gnu 
CFLAGS="-lpthread -g" CXXFLAGS="-lpthread -g" LIBS="-lpthread -g" && make

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

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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-24 11:13 hewei4321017 at 163 dot com [this message]
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
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@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).