计数器退出代码139运行时,但gdb使它通过 [英] Counter exit code 139 when running, but gdb make it through

查看:576
本文介绍了计数器退出代码139运行时,但gdb使它通过的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题听起来具体,但我怀疑仍然可能是一个C ++调试问题。



我使用omnet ++,它是模拟无线网络。



当我运行我的程序(在Ubuntu 12.04中使用omnet ++ 4.2.2修改了inet框架)时遇到了一个奇怪的现象:程序退出退出代码139(人们说这意味着内存碎片)当触摸某些部分的代码,当我尝试调试,gdb没有报告任何错误的有问题的代码,模拟退出以前,实际上,调试去通过这部分代码并输出预期结果。



gdb版本信息:GNU gdb(Ubuntu / Linaro 7.4-2012.04-0ubuntu2.1)7.4-2012.04



任何人都能告诉我为什么运行失败,但调试不行?



非常感谢!

解决方案


退出代码139(人们说这意味着内存碎片)


否,这意味着您的程序在信号 11 SIGSEGV 和大多数其他UNIX),也称为分段错误



您的程序显示未定义的行为,可以执行任何 >



您的第一个步骤应该在Valgrind下运行此程序,并修复其报告的所有错误。



如果执行上述操作后,程序仍然崩溃,那么应该让它转储核心( ulimit -c unlimited; ./a.out ),然后使用GDB分析该核心转储: gdb ./a.out core ;然后使用其中命令。


My question sounds specific, but I doubt it still can be of a C++ debug issue.

I am using omnet++ which is to simulate wireless network. omnet++ itself is a c++ program.

I encountered a queer phenomena when I run my program (modified inet framework with omnet++ 4.2.2 in Ubuntu 12.04): the program exit with exit code 139 (people say this means memory fragmentation) when touching a certain part of the codes, when I try to debug, gdb doesn't report anything wrong with the 'problematic' codes where the simulation exits previously, actually, the debug goes through this part of codes and output expected results.

gdb version info: GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04

Could anybody tell me why the run fails but debug doesn't?

Many thanks!

解决方案

exit code 139 (people say this means memory fragmentation)

No, it means that your program died with signal 11 (SIGSEGV on Linux and most other UNIXes), also known as segmentation fault.

Could anybody tell me why the run fails but debug doesn't?

Your program exhibits undefined behavior, and can do anything (that includes appearing to work correctly sometimes).

Your first step should be running this program under Valgrind, and fixing all errors it reports.

If after doing the above, the program still crashes, then you should let it dump core (ulimit -c unlimited; ./a.out) and then analyze that core dump with GDB: gdb ./a.out core; then use where command.

这篇关于计数器退出代码139运行时,但gdb使它通过的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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