나는 아래, ubuntu16.04에서, GDB의 캐치 옵션의 작은 실험을했다 :gdb를 사용하여 'catch'및 'syscall'을 추적하지 못했습니다. 'brk'을 찾지 못했다고보고합니까?
$ cat e.cpp
#include<stdlib.h>
#include<exception>
int main()
{
try{
throw 1;
}catch(std::exception e)
{
}
exit(0);
}
$ gcc가 e.cpp -g -lstdC++ $ gdb를
...
Reading symbols from a.out...done.
(gdb) catch throw
Catchpoint 1 (throw)
(gdb) catch syscall
Catchpoint 2 (any syscall)
(gdb) r
Starting program: /home/a/cpp/a.out
Catchpoint 2 (call to syscall brk), 0x00007ffff7df12e9 in __brk ([email protected]=0x0) at ../sysdeps/unix/sysv/linux/x86_64/brk.c:31
31 ../sysdeps/unix/sysv/linux/x86_64/brk.c: No such file or directory.
의 a.out 무엇 이 오류가 나타 납니까? 'r'명령을 다시 사용하면 프로그램이 종료됩니다.
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n)
너무 이상합니다. 어떻게 그리고 왜이 brk 오류가 발생합니까?