public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30384] New: gdbserver get an error when father process exit
@ 2023-04-24 11:13 hewei4321017 at 163 dot com
2023-04-24 11:16 ` [Bug c++/30384] " hewei4321017 at 163 dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: hewei4321017 at 163 dot com @ 2023-04-24 11:13 UTC (permalink / raw)
To: gdb-prs
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/30384] gdbserver get an error when father process exit
2023-04-24 11:13 [Bug c++/30384] New: gdbserver get an error when father process exit hewei4321017 at 163 dot com
@ 2023-04-24 11:16 ` hewei4321017 at 163 dot com
2023-04-24 11:41 ` hewei4321017 at 163 dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: hewei4321017 at 163 dot com @ 2023-04-24 11:16 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30384
--- Comment #1 from 贺伟 <hewei4321017 at 163 dot com> ---
sorry,
>>>After parent exit, I can continue to debug the child.
This is the Expected Results, not Actual Results
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/30384] gdbserver get an error when father process exit
2023-04-24 11:13 [Bug c++/30384] New: gdbserver get an error when father process exit 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
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: hewei4321017 at 163 dot com @ 2023-04-24 11:41 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30384
--- Comment #2 from 贺伟 <hewei4321017 at 163 dot com> ---
Created attachment 14845
--> https://sourceware.org/bugzilla/attachment.cgi?id=14845&action=edit
test code
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/30384] gdbserver get an error when father process exit
2023-04-24 11:13 [Bug c++/30384] New: gdbserver get an error when father process exit 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
2023-04-24 11:51 ` hewei4321017 at 163 dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: hewei4321017 at 163 dot com @ 2023-04-24 11:49 UTC (permalink / raw)
To: gdb-prs
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/30384] gdbserver get an error when father process exit
2023-04-24 11:13 [Bug c++/30384] New: gdbserver get an error when father process exit hewei4321017 at 163 dot com
` (2 preceding siblings ...)
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
5 siblings, 0 replies; 7+ messages in thread
From: hewei4321017 at 163 dot com @ 2023-04-24 11:51 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30384
贺伟 <hewei4321017 at 163 dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #14845|0 |1
is obsolete| |
--- Comment #4 from 贺伟 <hewei4321017 at 163 dot com> ---
Created attachment 14846
--> https://sourceware.org/bugzilla/attachment.cgi?id=14846&action=edit
test code
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/30384] gdbserver get an error when father process exit
2023-04-24 11:13 [Bug c++/30384] New: gdbserver get an error when father process exit hewei4321017 at 163 dot com
` (3 preceding siblings ...)
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
5 siblings, 0 replies; 7+ messages in thread
From: hewei4321017 at 163 dot com @ 2023-04-24 11:52 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30384
贺伟 <hewei4321017 at 163 dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #14846|0 |1
is obsolete| |
--- Comment #5 from 贺伟 <hewei4321017 at 163 dot com> ---
Created attachment 14847
--> https://sourceware.org/bugzilla/attachment.cgi?id=14847&action=edit
test code
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug server/30384] gdbserver get an error when father process exit
2023-04-24 11:13 [Bug c++/30384] New: gdbserver get an error when father process exit hewei4321017 at 163 dot com
` (4 preceding siblings ...)
2023-04-24 11:52 ` hewei4321017 at 163 dot com
@ 2023-11-23 15:13 ` tromey at sourceware dot org
5 siblings, 0 replies; 7+ messages in thread
From: tromey at sourceware dot org @ 2023-11-23 15:13 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30384
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |server
CC| |tromey at sourceware dot org
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-11-23 15:13 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-24 11:13 [Bug c++/30384] New: gdbserver get an error when father process exit 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
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
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).