在c中调试?
我在我的应用程序上发现了一些错误并显示了一些相关信息:
(trunk:29564): Gtk-CRITICAL **: IA__gtk_tree_store_clear: assertion `GTK_IS_TREE_STORE (tree_store)' failed
我的问题是:
- 29564 是什么?是应用程序代码段中堆栈的偏移量,还是内存堆栈中的堆栈偏移量?或者它到底在哪里?
- 我该如何调试它?它(调试)将使用哪种语言(C 或 asm)?
i found some error on my app and show some regarded information :
(trunk:29564): Gtk-CRITICAL **: IA__gtk_tree_store_clear: assertion `GTK_IS_TREE_STORE (tree_store)' failed
my question is :
- what is 29564 ?, is that offset of stack in code segment in the application, or in stack of memory ? or where is it exactly ?
- how could i debug it ? on which language it(debugging) would be ( C or asm ) ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用gdb。
在 gtk+ 应用程序中出现此错误。
您必须传递函数参数,而不是
foo(tree_store, ... )
,而必须作为foo(GTK_IS_TREE_STORE(tree_store), ...)
Use gdb.
This errors in gtk+ application.
You must pass function parameters not
foo(tree_store, ... )
you must asfoo(GTK_IS_TREE_STORE(tree_store), ...)
正如安塞德所说,我们需要更多信息。完全盲目但有时有效的方法是在源代码树上尝试 grep -r 来查找错误消息中的各种字符串。也许您正在寻找一个名为 IA__gtk_tree_store_clear 的函数,但是您需要找出谁使用非树存储的东西调用它...
如果您确实想调试可执行文件,请弄清楚如何在构建中启用调试信息(例如,获取传递给 gcc 的 -g 标志),然后运行 use gdb progname argument 来启动程序。当失败时,使用诸如反向跟踪命令(ct)之类的东西来查看调用堆栈并找出导致失败的事件链。
编辑:看起来您需要放置一个断点以防止程序实际中止,否则您将没有调用堆栈可供检查。因此,您需要找到检查断言的代码行。您可以在断点中使用条件表达式,使 gdb 仅在断言失败时停止程序。
As Ancide said we need more information. The completely blind, but sometimes effective, approach is to try grep -r on your source tree for various strings in the error message. Probably you are looking for a function called IA__gtk_tree_store_clear, but then you need to find out who is calling it with something that's not a tree store...
If you actually want to debug the exectuable, figure out how to enable debug info in the build (get a -g flag passed to gcc for example) and then run use gdb progname arguments to launch the program. When it fails, use things like the back trace command (ct) to look at the call stack and figure out the chain of events that lead up to the failure.
EDIT: looks like you'll need to put a breakpoint in to keep the program from actually aborting, otherwise you won't have a call stack to examine. So you'll need to find the line of code on which the assert is checked. You can use a conditional expression in the breakpoint to make gdb only stop the program when the assertion would fail.