如何使gdb跟随execv?不执行“跟随执行模式” [英] How to make gdb follow execv? Not working despite "follow-exec-mode"

查看:322
本文介绍了如何使gdb跟随execv?不执行“跟随执行模式”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了两个简单的程序:

i've written two simple programs:

int main(int ac, char **argv ) {
    execv( "/home/me/Desktop/execvtest2", argv );
}

int main(int ac, char **argv ) {
    execv( "/home/me/Desktop/execvtest1", argv );
}

我已经将
gcc -g编译到相应的输出文件。
我运行Ubuntu 10.10使用gcc(Ubuntu / Linaro 4.4.4-14ubuntu5.1)4.4.5。

I've compiled them with gcc -g to the according outputfiles. I'm running Ubuntu 10.10 using gcc (Ubuntu/Linaro 4.4.4-14ubuntu5.1) 4.4.5.

当我调试第一个程序与GNU gdb(GDB)7.2-ubuntu,我可以直到第一个execv语句,但是这两个文件只是继续运行。即使我将follow-exec模式设置为new,我也不能进入第二个程序。
当我设置catch exec时,gdb停止在每次调用execv(一些如何没有链接的源为第二个程序,我不能退出gdb,因为它的挂起!?),但我' m无法将调用转入新(作为exec替换进程)劣质程序。

When I'm debuging the first program with GNU gdb (GDB) 7.2-ubuntu, I can step until the first execv statement, but then the two files just keep running. Even if I set the follow-exec-mode to new, I can't step into the second program. When I set catch exec, gdb stops at each call to execv (some how without linked source for the second program, and I'm not able to quit gdb, as it kind of hangs!?), but I'm not able to step over the call into the "new" (as exec replaces the process) inferior program.

那么这怎么可以完成?必须有办法进入新进程吗?我做错了吗?

So how can this be done? There must be a way to step into the new process right? Am I doing something wrong?

干杯

推荐答案

你可以使用抓命令。
这将给你机会在你执行

you can use "catch" command. this will give you chance to put some break points after you exec

这篇关于如何使gdb跟随execv?不执行“跟随执行模式”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆