segmentation-fault

Need help debugging further into a SEGV issue - Android NDK

自作多情 提交于 2019-12-11 03:33:18
问题 I am building a library with a large body of source code for Android. The library works fine if compiled for Linux x86. I am building it with the stand alone tool chain. I have had success with this previously with other libraries, so I feel like my setup is good. Anyway, compiling and linking are all good, but when I load the resultant shared library I get a SEGV. This is the trace that I get: 03-23 23:37:14.213: I/DEBUG(28): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 03

Qt - Mysterious segfaults on worker thread

痞子三分冷 提交于 2019-12-11 03:19:53
问题 I'm instantiating QSystemDeviceInfo on a worker thread, but it causes a segfault. int BatteryInfo::getLevel() { QSystemDeviceInfo sysDevInfo; //segfault happens when I step on to this line return sysDevInfo.batteryLevel(); } Is the class thread-safe, or does the problem lie elsewhere? EDIT: With further debugging I also noticed that native Symbian calls segfault as well. Best regards 回答1: Me and my friend found this issue as well on Symbian Qt Mobilty 1.0. He reported an issue QtMobility

Flipping the order of subrules inside a rule in a boost::spirit grammar results in segfault

冷暖自知 提交于 2019-12-11 02:58:17
问题 Warning; while I tried to shorten the code down, to a minimum. I still had to include quite a bit, to ensure that the required information was present. This code, compiles files, and runs resulting in a syntax error; name = simple_name [ qi::_val = qi::_1 ] | qualified_name [ qi::_val = qi::_1 ] ; While this; name = qualified_name [ qi::_val = qi::_1 ] | simple_name [ qi::_val = qi::_1 ] ; Results in a SIGSEGV , Segmentation fault; boost::detail::function::function_obj_invoker4<boost::spirit:

Segfault when calling virtual function of derived class

拟墨画扇 提交于 2019-12-11 02:45:45
问题 I've been having a problem with segfaults when I call virtual function of a derived class. However, these segfaults do not occur if I change the name of the function to be different from the name of the virtual function in the base class. Here's some code: //in main //initialize scene objects //camera if((camera = (Camera*)malloc(sizeof(Camera))) == NULL){ cout << "Could not allocate memory for camera" << endl; } //...code in middle //inside file parsing... //infile is an ifstream /

Help understanding segfault with std::map/boost::unordered_map

对着背影说爱祢 提交于 2019-12-11 02:33:30
问题 I have some code to handle resource (images, fonts, mesh data, etc.) management using a template'd static class, allowing client code to do something like: ResourceManager<Texture>::init("data/textures"); ResourceManager<Font>::init("data/fonts"); // later ... boost::shared_ptr<const Texture> tex = ResourceManager<Texture>::getResource("wall.png"); boost::shared_ptr<const Font> font = ResourceManager<Font>::getResource("Arial.ttf"); // later ... ResourceManager<Texture>::release(); The

Why does this C++ code-snippet segmentation fault?

半城伤御伤魂 提交于 2019-12-11 02:21:39
问题 #include <iostream> using namespace std; int recur(int x) { 1 and recur(--x); cout << x; return x; } int main() { recur(10); return 0; } 回答1: 1 and recur(--x); is equivalent to recur(--x); Clearly you are making infinite recursive calls which leads to stack overflow followed by segmentation fault. I guess you meant x and recur(--x); which makes the recursive call only when x is non-zero. 回答2: Thats an infinite recursion. So it will seg fault when it runs out of stack space. 回答3: It doesn't

AddressSanitizer Crash on GCC 4.8

China☆狼群 提交于 2019-12-11 02:15:32
问题 I've just tried out GCC 4.8's new exciting feature AddressSanitizer. The program #include <iostream> int main(int argc, const char * argv[], const char * envp[]) { int *x = nullptr; int y = *x; std::cout << y << std::endl; return 0; } compile find using g++-4.8 -std=gnu++0x -g -fsanitize=address -fno-omit-frame-pointer -Wall ~/h.cpp -o h but when I run the program I get ASAN:SIGSEGV ================================================================= ==7531== ERROR: AddressSanitizer crashed on

SIGSEGV error in some lua/c++ code

混江龙づ霸主 提交于 2019-12-11 01:51:08
问题 The following code end in a SIGSEGV error: extern "C" { #include "lua/lua.h" #include "lua/lualib.h" #include "lua/lauxlib.h" } int main( int argc, char *argv[] ) { lua_State *L; luaL_openlibs(L); lua_close(L); return 0; } Gdb gives me the following: (gdb) run Starting program: d:\Dropbox\cpp\engine\bin\main.exe [New Thread 7008.0x1df8] Program received signal SIGSEGV, Segmentation fault. 0x6d781f30 in lua_pushcclosure () from d:\Dropbox\cpp\engine\bin\lua52.dll (gdb) where #0 0x6d781f30 in

segfault when using boost::signal with -D_GLIBCXX_DEBUG compiler flag

心不动则不痛 提交于 2019-12-11 01:49:44
问题 I'm building with g++, and yesterday a helpful person on SO told me to compile with the -D_GLIBCXX_DEBUG and -D_GLIBCXX_DEBUG_PEDANTIC flags. I did so, and I spent most of yesterday tweaking my code to conform to these flags. Now it's complaining about my use of boost::signal , and I'm not sure where the problem is. I have a class Yarl that has a function refresh() that I want to bind to a signal sigRefresh in another class EventHandler : class Yarl { private: void refresh(); (...) }; class

Getting segmentation fault while using malloc

两盒软妹~` 提交于 2019-12-11 01:37:41
问题 I asked my problem here The largest size of 2-D array in C and what I got answer there before declaration as duplicate by some people, I modified my code like this: #include<stdio.h> #include<stdlib.h> int main() { int i,j,n,m,p = 0 ; int sum[100000] = {0}; scanf("%d%d%d",&n,&m,&p); /*for ( i = 0 ; i < n ; i++ ) { for( j = 0 ; j < m ; j++ ) { a[i][j] = j + 1 ; } }*/ int **a = (int **) malloc(sizeof(int)*n); for(i=0; i<n; i++) { a[i] = (int *) malloc(sizeof(int)*m); for(i=0; i<n; i++){ for(j=0