Temporary catchpoint 1 (forked process 30230), 0x00007ffff7ac67cc in __libc_fork () at ../sysdeps/nptl/fork.c:135 135 ../sysdeps/nptl/fork.c: No such file or directory. (gdb) c Continuing. hello world [Inferior 1 (process 30226) exited normally]
(gdb) start Temporary breakpoint 1 at 0x68e: file main_01.cpp, line 5. Starting program: /data/code/cpp/test/gdb_test/main
Temporary breakpoint 1, main () at main_01.cpp:5 5 if (ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) { (gdb) n 6 printf("Gdb is debugging me, exit.\n"); (gdb) n Gdb is debugging me, exit. 7 return 1;
Catchpoint 1 (call to syscall ptrace), 0x00007ffff7af961f in ptrace (request=PTRACE_TRACEME) at ../sysdeps/unix/sysv/linux/ptrace.c:45 45 ../sysdeps/unix/sysv/linux/ptrace.c: No such file or directory. (gdb) c Continuing.
Catchpoint 1 (returned from syscall ptrace), 0x00007ffff7af961f in ptrace (request=PTRACE_TRACEME) at ../sysdeps/unix/sysv/linux/ptrace.c:45 45 in ../sysdeps/unix/sysv/linux/ptrace.c (gdb) return 0 Make ptrace return now? (y or n) y #0 0x00005555555546ac in main () at main_01.cpp:5 5 if (ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) { (gdb) n 9 printf("No debugger, continuing\n");