在gdb sciprt中设置断点的问题 [英] Problems with setting breakpoints in a gdb sciprt

查看:177
本文介绍了在gdb sciprt中设置断点的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用带有5个断点的gdb脚本:

 设置分页关
分页rewriter_def.h:679
break asserted_formulas.cpp:149
break Z3Solver.cpp:221
break api_solver.cpp:247
break smt_context.cpp:2950
run

当gdb运行时,停止在第三个断点

 断点1,klee :: Z3SolverImpl :: internalRunSolver(...)at 
Z3Solver.cpp:221
221 int dave = 0;

我确定其他断点没有真正设置
通过尝试从gdb控制台手动清除它们:

$ $ p $ (gdb)clear api_solver.cpp:247
api_solver.cpp没有断点:247。

如果手动将脚本文件中的其他break命令
复制并粘贴到gdb控制台,
一切工作正常

 (gdb)break api_solver.cpp:247 
0x7ffff5afbb31处的断点2:文件../src/api/api_solver.cpp,行
247.
(gdb)cont
继续。

断点2,Z3_solver_assert(...)at ../src/api/api_solver.cpp:247
247 to_solver_ref(s) - > assert_expr(to_expr(a));

由脚本设置的断点来自一个源树(KLEE)的
, ,
和另外四个未设置的断点从另一个源树(Z3)发起

这可能是某种PATH问题吗?
任何帮助非常感谢,谢谢!

解决方案


如果我手动复制并将其他break命令从脚本文件粘贴到gdb控制台,一切正常:

最可能的原因:其他断点属于一个尚未加载的共享库。

尝试在将二进制文件加载到GDB中后剪切/粘贴相同的命令,但是在运行之前它。很有可能,GDB会这样说:

 没有名为rewriter_def.h的源文件。 

您可以通过添加 start 在设置断点之前将脚本添加到脚本中:如果所讨论的共享库直接链接,那么当程序到达 main 时(这就是 start 命令)。


I am using this gdb script with 5 breakpoints:

set pagination off
break rewriter_def.h:679
break asserted_formulas.cpp:149
break Z3Solver.cpp:221
break api_solver.cpp:247
break smt_context.cpp:2950
run

When gdb runs, it stops in the third breakpoint, but not in the other breakpoints:

Breakpoint 1, klee::Z3SolverImpl::internalRunSolver ( ... ) at 
Z3Solver.cpp:221
221    int dave=0;

I make sure the other breakpoints weren't really set, by trying to manually clear them from the gdb console:

(gdb) clear api_solver.cpp:247
No breakpoint at api_solver.cpp:247.

If I manually copy and paste the other break commands from the script file to the gdb console, everything works fine:

(gdb) break api_solver.cpp:247
Breakpoint 2 at 0x7ffff5afbb31: file ../src/api/api_solver.cpp, line 
247.
(gdb) cont
Continuing.

Breakpoint 2, Z3_solver_assert ( ... ) at ../src/api/api_solver.cpp:247
247    to_solver_ref(s)->assert_expr(to_expr(a));

The breakpoint that is being set by the script originates from one source tree (KLEE), and the other four breakpoints that are not being set originate from another source tree (Z3). Could this be some kind of a PATH problem?? Any help is very much appreciated, thanks!

解决方案

If I manually copy and paste the other break commands from the script file to the gdb console, everything works fine:

The most probable cause: the other breakpoints "belong" to a shared library which has not been loaded yet.

Try cut/pasting the same commands after you load the binary into GDB, but beofre you run it. Chances are, GDB will say something like

No source file named rewriter_def.h.

You can work around this by adding start to your script before setting breakpoints: if the shared library in question is directly linked, it will be loaded by the time your program reaches main (which is what start command does).

这篇关于在gdb sciprt中设置断点的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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