简体   繁体   English

使用Gdb调试器,我应该如何找出“程序终止于信号11,分段错误”的原因。

[英]Using Gdb debugger, how should I proceed to find out the cause of “Program terminated with signal 11, Segmentation fault.”

Here is the backtrace of gdb, 这是gdb的回溯,

Program terminated with signal 11, Segmentation fault.
#0  0xb7e78830 in Gtk::Widget::get_width () from /usr/lib/libgtkmm-2.4.so.1
(gdb) bt
#0  0xb7e78830 in Gtk::Widget::get_width () from /usr/lib/libgtkmm-2.4.so.1
#1  0x08221d5d in sigc::bound_mem_functor0<bool, videoScreen>::operator() (this=0xb1c04714)
    at /usr/include/sigc++-2.0/sigc++/functors/mem_fun.h:1787`enter code here`
#2  0x08221d76 in sigc::adaptor_functor<sigc::bound_mem_functor0<bool, videoScreen> >::operator() (this=0xb1c04710)
    at /usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:251
#3  0x08221d96 in sigc::internal::slot_call0<sigc::bound_mem_functor0<bool, videoScreen>, bool>::call_it (rep=0xb1c046f8)
    at /usr/include/sigc++-2.0/sigc++/functors/slot.h:103
#4  0xb7b1ed35 in ?? () from /usr/lib/libglibmm-2.4.so.1
#5  0xb73c6bb6 in ?? () from /usr/lib/libglib-2.0.so.0
#6  0xb28ff1f8 in ?? ()
#7  0xb647479c in __pthread_mutex_unlock_usercnt () from /lib/libpthread.so.0
#8  0xb73c6446 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#9  0xb73c97e2 in ?? () from /usr/lib/libglib-2.0.so.0
#10 0xb3d11af8 in ?? ()
#11 0x00000000 in ?? ()

I figured out the line of crash,here is the code around that line. 我想出了崩溃的行,这是该行的代码。

1:currPicLoaded = 1;
2:int status = -1;
3:zoomedPicWidth = drawVideo1->get_width();    

I figured out that above line is 3 is the cause of crash, but this line execute 5 times before crash.So I do not know why it does crash at 6th time. 我发现上面的3行是导致崩溃的原因,但是此行在崩溃之前执行了5次,所以我不知道为什么它在第6次崩溃。 PS : Above line of code is with in a thread which run continuously. PS:上面的代码行带有一个连续运行的线程。

Any help is more than welcome :) 任何帮助都超过了欢迎:)

how should I proceed 我应该如何进行

Your very first step should be to find out which instruction caused the SIGSEGV . 您的第一步应该是找出导致SIGSEGV指令。 Do this: 做这个:

 (gdb) x/i $pc

The most likely cause is that your drawVideo1 object is either dangling (has been deleted), or is corrupt in some other way. 最可能的原因是您的drawVideo1对象悬空(已删除)或以其他方式损坏。

Since you are apparently on Linux (you didn't say, but you should always say), the first tool to reach for for debugging "strange" problems like this is Valgrind . 由于您显然在Linux上(您没有说,但您应该始终说),因此用于调试此类“奇怪”问题的第一个工具是Valgrind

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 程序收到信号 SIGSEGV,分段错误。 C++ - Program received signal SIGSEGV, Segmentation fault. C++ 分段错误错误(信号名称:SIGSEGV)的原因是什么,如何找到/修复它? - What is the cause of a segmentation fault error (signal name: SIGSEGV), and how would I find/fix it? 使用 Cygwin 时出错:“collect2:致命错误:ld 以信号 11 [分段错误] 终止” - Error using Cygwin: “collect2: fatal error: ld terminated with signal 11 [Segmentation fault]” “程序接收信号SIGSEGV,分段故障。在??? ()()“在Code :: Blocks中调试我的C ++项目时 - “Program received signal SIGSEGV, Segmentation fault. In ?? () ()” when debugging my C++ project in Code::Blocks 信号:使用 Openmpi 时出现分段错误 (11) - Signal: Segmentation fault (11) when using Openmpi strcpy 原因程序收到信号SIGSEGV,分段错误 - strcpy cause Program received signal SIGSEGV, Segmentation fault 程序收到信号SIGSEGV,分段故障。 在al_draw_tinted_bitmap中(位图= 0x0,色调= ...,dx = 0,dy = 0,标志= 0) - Program received signal SIGSEGV, Segmentation fault. in al_draw_tinted_bitmap (bitmap=0x0, tint=…, dx=0, dy=0, flags=0) 我正在使用gdb调试程序,但出现分段错误 - I am debugging a program using gdb and I'm getting a segmentation fault 滥用指针会产生分段错误。 我仍然不确定如何纠正它 - Misuse of a pointer is producing a segmentation fault. I'm still not sure how to correct it though 接收到的信号:使用 Rocksdb 时出现分段错误 (11) - Received signal: Segmentation fault (11) while using Rocksdb
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM