使用 exec 函数时如何使用 gdb 进行调试

How to debug with gdb when using exec functions

使用exec函数时如何调试?比如我在这一行设置断点execl("/home/hel/a.out", "a.out", arg1, arg2, NULL);如何调试a.out?

在单独的调试会话中,如下所示:

$ gdb /home/hel/a.out
(gdb) run arg1 arg2

这不是很明显吗?