我有下面的简单程序。
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#define CHILD 0
int main()
{
pid_t pid;
printf(" My pid = %d \n", getpid());
getchar();
pid = fork();
if( pid == CHILD){
printf(" child: My pid = %d \n", getpid());
while(1);
}
else{
printf(" My pid = %d \n", getpid());
printf(" Newly created child pid = %d \n", pid);
while(1);
}
}
我正在尝试使用gdb对其进行调试。我想调试父进程和子进程。我使用了以下命令
Reading symbols from ./1...done.
(gdb) b 12
Breakpoint 1 at 0x73f: file 1.c, line 12.
(gdb) set detach-on-fork off
(gdb) r
Starting program: ./1
My pid = 121710
Breakpoint 1, main () at 1.c:12
12 pid = fork();
(gdb) n
[New process 121715]
Reading symbols from ./1...done.
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x73f
(gdb) info inferior
Num Description Executable
* 1 process 121710 ./1
2 process 121715 ./1
(gdb) bt
#0 0x00007ffff7ac8b1c in __libc_fork () at ../sysdeps/nptl/fork.c:135
#1 0x0000555555554744 in main () at 1.c:12
(gdb) n
[New process 121715]
Reading symbols from ./1...done.
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x73f
Cannot insert breakpoint 1.
Cannot access memory at address 0x73f
你们能帮我解决我在上述gdb命令中犯的错误吗?
答案 0 :(得分:0)
counts.loc[counts['count']==1, 'name'].to_list()
您应该在当前下级停止在此断点之后删除所有断点,然后当前下级可以继续成功运行,而不会出现诸如“无法插入断点……”之类的错误提示。