程序收到信号SIGSEGV,分段故障 [英] program received signal SIGSEGV, segmentation fault

查看:560
本文介绍了程序收到信号SIGSEGV,分段故障的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在多线程环境中运行程序,该程序有时会失败.当我用gdb尝试它时,它会出现以下错误.

I am running a program in multi threaded environment it fails at some point. when i tried it with gdb than it is shoing the following error.

程序收到信号SIGSEGV,分段错误.

program received signal SIGSEGV, segmentation fault.

[切换到线程0x7fff677b700(LWP 2777)] in 0x00007ffff7aa42b9 in process_incomplete_rows(resultset = 0x507950)在c/mgmt.c:479 479 c/mgmt.c:没有这样的文件或目录.

[switching to thread 0x7fff677b700 (LWP 2777)] 0x00007ffff7aa42b9 in process_incomplete_rows (resultset=0x507950) at c/mgmt.c:479 479 c/mgmt.c: No such file or directory.

mgmt.c文件在那里,对于某些选项,此代码可以正常工作,但有2或3个选项会导致此错误.可能是此错误的原因.它在交战中还是在错误中是错误的?还是访问某些数据时出错?

mgmt.c file is there and this code is working fine for some options but 2 or three options its giving this error. What could be the cause of this error. Its error in comiplation or in coe? or its error while accessing some data?

推荐答案

分段错误是运行时错误,通常是由于引用无效的指针引起的.通常,无效指针从未被初始化过,但是有时它会重用旧指针或在已分配内存块的末尾(例如,在字符串末尾)进行写入.

A segmentation fault is a runtime error that is usually due to referencing an invalid pointer. Usually that invalid pointer has never been initialized, but sometimes it is reusing an old pointer or writing past the end of an allocated memory chunk (such as past the end of a string).

这篇关于程序收到信号SIGSEGV,分段故障的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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