How to make gdb follow execv? Not working despite “follow-exec-mode”

和自甴很熟 提交于 2019-11-29 10:10:31

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

I've been doing something very similar to what you are doing for one of my classes. It is a bit hackish and if you're trying to get things like register values it may mess things up. According to GDB's documentation you can change the symbol file while maintaining the execution file. To do this, simply use the command symbol-file file2. Note that this must be a binary file compiled with the GDB flag (-g in GCC). After you've loaded this symbol file, you will not be able to break or see any of the lines for the original execution file. However, you may set break points for the new symbol file i.e. break file2.c:40 and then step through execution just as before. It is a bit hackish and may not work perfectly because you are essentially catching the execution of a new process and mapping it to the symbol table of it's binary file, without using that binary file to run it directly. I haven't had stellar results but you can see the intermediate values this way. Another thing, in order to return to debugging the original file you will have to do symbol-file file to reload it's symbol table.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!