segmentation-fault

Embedding Python in C - Segfault

吃可爱长大的小学妹 提交于 2019-12-25 09:11:12
问题 From reading another post, I am trying to embbed some some Python code into C: main.c #include <Python.h> int callModuleFunc(int array[], size_t size) { PyObject *mymodule = PyImport_ImportModule("py_function"); PyObject *myfunc = PyObject_GetAttrString(mymodule, "printlist"); PyObject *mylist = PyList_New(size); for (size_t i = 0; i != size; ++i) { PyList_SET_ITEM(mylist, i, PyInt_FromLong(array[i])); } PyObject *arglist = Py_BuildValue("(o)", mylist); PyObject *result = PyObject_CallObject

How to run GUI via remort server

余生长醉 提交于 2019-12-25 08:57:10
问题 I'm using Qtcreator to make GUI. Ideally, I build the project in my local pc (CentOS virtual terminal), and move it to remort server(CentOS). Finally, I want to run it in windows system via X server(VcXsrv i use). As operation verification, I create a new file and build as it is. At first, it generates many errors in remort server, such as " ./test: /lib64/libc.so.6: version GLIBC_2.14 not found (required by /users/my/Qt/5.9.1/gcc_64/lib/libQt5Gui.so.5) ". I don't have root permission and can

How to correct segmentation fault in my C program

江枫思渺然 提交于 2019-12-25 08:47:34
问题 I am having hard-time in debugging the following program written for knapSack #include <stdio.h> #include <stdlib.h> #include "timer.h" #define MAX(x,y) ((x)>(y) ? (x) : (y)) #define table(i,j) table[(i)*(C+1)+(j)] int main(int argc, char **argv) { FILE *fp; long N, C, opt; // # of objects, capacity int *weights, *profits, *table, *solution; // weights and profits int verbose; // Temp variables long i, j, count, size, size1, ii, jj; // Time double time; // Read input file: // first line: # of

Segmentation fault for array larger than 1022x1022

戏子无情 提交于 2019-12-25 08:26:18
问题 I don't know Rust but I wanted to investigate the performance in scientific computing to compare it to Julia and Fortran. I managed to write the following program but the problem is that I get a runtime segmentation fault when MAX is larger than 1022. Any advice? fn main() { const MAX: usize = 1023; let mut arr2: [[f64; MAX]; MAX] = [[0.0; MAX]; MAX]; let pi: f64 = 3.1415926535; // compute something useless and put in matrix for ii in 0.. MAX { for jj in 0.. MAX { let i = ii as f64; let j =

Ganglia - gmetad - process is getting terminated by SIGSEGV

我们两清 提交于 2019-12-25 08:14:35
问题 I have started seeing this issue in the last couple of days. Ganglia gemtad process gets terminated within 5 min of its start with SIGSEGV (segfault) This was stable since last few months..so not sure what changed. Version - gmetad 3.7.1 I don't see any core dump or anything specific to gmetad in /var/log/messages or /var/log/secure either . System snap (from top) at the time of this event load average: 1.97, 0.99, 0.42 Memory also looks fairly Ok free -m total used free shared buffers cached

2D array pointer access segmentation fault in C

拜拜、爱过 提交于 2019-12-25 07:55:31
问题 I'm trying to write a code for a Conway's Game of Life in C. I have some problems with 2D array which contain my universe. I will show you a parts of code that cause me a problems. Actually there a two problems that I can't handle. #include <stdio.h> #include <stdlib.h> #include "file2ppm.h" typedef enum { false, true } bool; void *allocateMemoryFor2DArray(int x, int y); //allocate memory for 2D array void initializeUniverseFromFile(char* path, int x, int y, int array[x][y]); //set values of

Program received signal SIGSEGV, Segmentation fault error

你离开我真会死。 提交于 2019-12-25 07:28:54
问题 Program received signal SIGSEGV, Segmentation fault on LINE : if (argv[1][0] == '-'). I was trying to make it do something when sees '-c' flag in unix shell int main(int argc, char **argv) { int target_column=1; int column_flag=0; int descending_flag=0; /* command-line argument control */ printf("Argument(s) detected(%d)\n", argc); /* default mode */ if (argc = 3) { if (argv[1][0] == '-') { /* column flag */ if (argv[1][1] == 'c') { column_flag=1; printf("column flag found, "); } /* error

EXC_BAD_ACCESS (SIGSEGV) On OSX 10.9.2 With Qt Application

痴心易碎 提交于 2019-12-25 07:24:35
问题 I build OSX wallets for various cryptocurrencies and use QT 4.8.5 to build them. One of the users of my .app files recently sent me these error logs which appear when he tries to open any of the apps I built on his system. He did appear to be a one off case so I assumed something was wrong with his system but someone else posted another log citing the same issue. I cannot seem to pinpoint the issue. Any ideas on what's wrong? Process: FairCoin-Qt [42516] Path: /Users/USER/Downloads/FairCoin

Assembly Return int to C function segfaults

橙三吉。 提交于 2019-12-25 07:23:37
问题 I am finishing up an assembly program that replaces characters in a string with a given replacement character. The assembly code calls C functions and the assembly program itself is called from main in my .c file. However, when trying to finish and return a final int value FROM the assembly program TO C, I get segfaults. My .asm file is as follows: ; File: strrepl.asm ; Implements a C function with the prototype: ; ; int strrepl(char *str, int c, int (* isinsubset) (int c) ) ; ; ; ; Result:

How to detect if variable uninitialized/catch segfault in C

社会主义新天地 提交于 2019-12-25 07:09:10
问题 I currently have a program where I need to test if a variable passed in as a parameter is uninitialized. So far it seems like this is pretty hard to do in C, so my next idea was to invoke a signal handler to catch the segfault. However, my code isn't calling upon the signal handler when it tries to access the uninitialized variable, like so: void segfault_sigaction(int signal, siginfo_t *si, void *arg) { printf("Caught segfault at address %p\n", si->si_addr); exit(0); } void myfree(void*p,