segmentation-fault

Segmentation fault with opencv, in python on Raspberry

倖福魔咒の 提交于 2019-12-22 05:37:07
问题 I'm making a really simple program which capture a video from a Raspberry pi camera, using opencv in python. I'm using Raspbian as OS. I've already made a few programs with the version 2.4.5 of opencv and now i've installed opencv 2.4.9. All the programs that i used to run on the previous version of opencv are not working now, and i think i found the point in which the programs gives me errors. Just trying to launch the following code: import cv2 import numpy as np cap = cv2.VideoCapture(0)

How to fix segmentation fault 11 error? [duplicate]

回眸只為那壹抹淺笑 提交于 2019-12-22 01:09:15
问题 This question already has an answer here : Definitive List of Common Reasons for Segmentation Faults (1 answer) Closed 2 years ago . I want the main returns the position of the occurrences of "mdl" in "dati". I set up the "schema" function to find the starting point of each occurrence, but when i run the program from the command line, it returns: Segmentation fault: 11 I don't know how to fix the problem. Here's the code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include

C++ Access to vector from multiple threads

情到浓时终转凉″ 提交于 2019-12-21 17:43:41
问题 In my program I've some threads running. Each thread gets a pointer to some object (in my program - vector). And each thread modifies the vector. And sometimes my program fails with a segm-fault. I thought it occurred because thread A begins doing something with the vector while thread B hasn't finished operating with it? Can it bee true? How am I supposed to fix it? Thread synchronization? Or maybe make a flag VectorIsInUse and set this flag to true while operating with it? 回答1: vector ,

C++ Segmentation when using erase on std::list

有些话、适合烂在心里 提交于 2019-12-21 12:13:04
问题 I'm trying to remove items from a C++ linked list using erase and a list iterator: #include <iostream> #include <string> #include <list> class Item { public: Item() {} ~Item() {} }; typedef std::list<Item> list_item_t; int main(int argc, const char *argv[]) { // create a list and add items list_item_t newlist; for ( int i = 0 ; i < 10 ; ++i ) { Item temp; newlist.push_back(temp); std::cout << "added item #" << i << std::endl; } // delete some items int count = 0; list_item_t::iterator it; for

Using perlbrew to build a perl with debugging symbols

我是研究僧i 提交于 2019-12-21 09:09:33
问题 I'm trying to track down a segmentation fault that I've been able to isolate to just a few lines of code on different versions of Perl. I use perlbrew to manage my various versions for development and testing, but it doesn't build perl with debugging symbols, so using gdb to analyse the core dump file is pretty useless. So what's the best way to have perlbrew build with debugging symbols enabled. And if possible I'd like to be able to have it be a separate perl that I could switch to instead

Android Fatal Signal 7 (SIGBUS)

寵の児 提交于 2019-12-21 07:58:14
问题 I'm getting a few SIGBUS (7) and SIGSEGV (11) crashes that I am having difficult tracking down. The thread that appears to be causing the crash is primarily used for loading images to be displayed which makes sense since the logs indicate something failing with the SkJPEGImageDecoder. I re-use memory for Bitmaps in accordance with this guide Could it have something to do with that? LogCat output: 05-20 13:46:09.775: A/libc(419): Fatal signal 7 (SIGBUS) at 0x0000001e (code=1), thread 520

What exactly happens inside the OS to cause the segmentation fault

折月煮酒 提交于 2019-12-21 06:25:49
问题 I have read a lot about the virtual address and paging. Let me first tell you people what i understood. When a process wants to execute something it tries to load the data from the hard disk to memory. To do this it uses a virtual address. So our MMU validates the virtual address looks into the TLB to find the corresponding physical page, if it doesn't find there it looks into Inverted Page Table and at the end it looks into Page table if it doesn't find an entry over there it generates a

Segmentation fault in fgets() - C language

谁都会走 提交于 2019-12-21 05:56:40
问题 I am getting a segmentation fault exactly at this line: while (fgets(line, MAX_LEN + 1, stream) != NULL) { .... } where MAX_LEN is 500, line is reading the current line, and stream is open through fopen(filename, "r"); I am reading lines from a file with a specific format and I get a segmentation fault (Core dumps) exactly at this line according to the debugger. I made my code so that it ignores lines that do not match the scanf format. Here is what I am implementing. Something close to it at

How do I find segmentation fault from multiple files using GDB

笑着哭i 提交于 2019-12-21 05:11:09
问题 I have been asked in an interview how can you debug segmentation fault in C program using GDB . I told them we can compile our program with -g option so as it add debugging information to binary file and can read core dump file but then interviewer told me if he we have 3 to 4 files compiled together but one of them causing segmentation fault then how do we debug in GDB? 回答1: $ gcc -ggdb s1.c s2.c s3.c -o myprog $ gdb myprog (gdb) run --arg1 --arg2 GDB will run the program as normal, when the

I get a segmentation fault instead of an exception

两盒软妹~` 提交于 2019-12-21 04:51:14
问题 In the following code, at the first iteration I get an exception, and at the second one I get a segmentation fault with no error message printed. It seems the exception is not caught: int i = 0; while(i++ < 10) { try { cout << "Iteration: " << i << endl; // Code... cout << "OK" << endl; } catch(...) { cerr << "Error message" << endl; continue; } } Output: Iteration 1 Error message Iteration 2 Segmentation fault Is it normal, or there is something really wrong going on? In case it should be