segmentation-fault

collect2: error: ld terminated with signal 11 [Segmentation fault], core dumped

不打扰是莪最后的温柔 提交于 2020-07-29 12:12:04
问题 I was learning OpenGL using GLFW, and didn't have a great understanding of makefiles at the time. I had OpenGL working, but I decided to learn makefiles more. I came up with this after a lot of websites, hours, and trial and error: EXENAME = "OpenGL Demo" CC = gcc SRCS = ../src/OpenGLDemo.c OBJS = $(SRCS: .c = .o) CFLAGS = -Wall -g -c LIBS = -L./libs -lglfw3 C:/Windows/SysWOW64/opengl32.dll C:/Windows/SysWOW64/glu32.dll all: opengldemo exe exe: $(OBJS) $(CC) $(OBJS) -o $(EXENAME) $(LIBS)

sort function C++ segmentation fault

假如想象 提交于 2020-07-04 07:49:02
问题 In this code, for vector size, n >=32767, it gives segmentation fault, but upto 32766, it runs fine. What could be the error? This is full code. #include<cstdio> #include<cstring> #include<cmath> #include<queue> #include<utility> #include<algorithm> #include<sys/time.h> using namespace std; #define MAX 100000 bool compare(pair<int,int> p1,pair<int,int> p2) { if(p1.second < p2.second) return 1; else if(p1.second > p2.second) return 0; if(p1.first <= p2.first) return 1; else return 0; } int

sort function C++ segmentation fault

被刻印的时光 ゝ 提交于 2020-07-04 07:48:40
问题 In this code, for vector size, n >=32767, it gives segmentation fault, but upto 32766, it runs fine. What could be the error? This is full code. #include<cstdio> #include<cstring> #include<cmath> #include<queue> #include<utility> #include<algorithm> #include<sys/time.h> using namespace std; #define MAX 100000 bool compare(pair<int,int> p1,pair<int,int> p2) { if(p1.second < p2.second) return 1; else if(p1.second > p2.second) return 0; if(p1.first <= p2.first) return 1; else return 0; } int

Segfault in python using PyQt [closed]

谁说胖子不能爱 提交于 2020-07-03 13:28:22
问题 Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 days ago . Improve this question I am new in PyQt in python and I have been working on a GUI lately. One of the parts of the GUI is a button which is supposed to get rid of all lines currently in the GUI. Because I am using threads, the way I implemented this feature is to have a GUI attribute, self.clear, which

Segfault when loading function parameter into a register

拜拜、爱过 提交于 2020-06-28 05:04:21
问题 I'm quite new to x86 assembly, and I'm trying to build off a hello world program. I'm trying to make a subroutine, that writes a single byte to stdout, but i've hit a problem. The line mov ebx, [esp+1] (to load the byte passed, when I call the subroutine) causes a segfault. I've tried xoring the ebx register with itself, to make sure that it is empty, to make sure, that it doesn't mess with the syscall _start: push 32h call _writeByte ; This just jumps to an exit routine jmp _exit _writeByte:

Why does not XORing %eax causes segfault? [duplicate]

别等时光非礼了梦想. 提交于 2020-06-17 13:21:25
问题 This question already has answers here : Segmentation fault on printf - NASM 64bit Linux (1 answer) Calling printf in x86_64 using GNU assembler (2 answers) main and stack alignment (1 answer) Why does System V / AMD64 ABI mandate a 16 byte stack alignment? (1 answer) Closed 12 days ago . .text having this: str: .string "string" .globl main main: xor %eax, %eax #is commented causes segfault leaq str(%rip), %rdi call printf xorq %rdi, %rdi call exit Does printf uses %rax ? or is the segfault

Can i execute code that resides in data segment (ELF binary)?

百般思念 提交于 2020-05-25 08:28:28
问题 In the way to understanding binaries (Virtual memory layout, execution...etc), I've written a C code that declares a global string which contains bytes of an executable code, then i overwrote the return address from the main() function to that executable code using a simple trick by declaring a pointer ( PTR ) in main() which is a local area of memory reserved on the stack 2 WORDS far away from the return address from the main() , so all i do is assigning the address of the return address to

Can i execute code that resides in data segment (ELF binary)?

耗尽温柔 提交于 2020-05-25 08:27:09
问题 In the way to understanding binaries (Virtual memory layout, execution...etc), I've written a C code that declares a global string which contains bytes of an executable code, then i overwrote the return address from the main() function to that executable code using a simple trick by declaring a pointer ( PTR ) in main() which is a local area of memory reserved on the stack 2 WORDS far away from the return address from the main() , so all i do is assigning the address of the return address to

how to handle occaisional segmentation fault in f2py module

白昼怎懂夜的黑 提交于 2020-05-17 07:45:08
问题 I have an f2py module that I am using. The core of the code I did not write myself, just the f2py wrapper to use it. Because of time constraints, and the knowledge that his code is short term need only, meaning I want to throw it away, not fix it, what I want to do is just catch the behavior when a segfault occurs and try again. The below code is an example: sums.f90 subroutine bad(a, b, c) real, intent(in) :: a, b real, intent(out) :: c real, allocatable :: d(:) real :: r call random_number

PSET 4 Recover SEGMENTATION FAULT CS50

大憨熊 提交于 2020-05-14 07:12:51
问题 I'm struggling a bit with reading files and writing into files. I've been working on this problem for a few days and I just can't seem to get it. The program is supposed to recover some jpeg files from a memory card. With the following code I keep getting a segmentation fault. Can you guys see where I went wrong? Here is my code below: Hope you guys can help! #include <stdio.h> #include <stdlib.h> #include <cs50.h> int main(int argc, char *argv[]) { //Ensure only one command line argument//