segmentation-fault

Segmentation fault when executing program compiled from x86 assembly?

我只是一个虾纸丫 提交于 2019-12-23 05:14:25
问题 I'm new to assembly language and I have to implement a function, in my case sin(x), that could be called from a C source file. I have to make 2 separate files: *.c and *.s When compiling through gcc on ubuntu all good, but when the program executes it gives me the error "Segmentation fault"... To compile I type: gcc -c -o sinc.o sinx.c -g3 gcc -c -o sins.o sinx.s -g3 gcc -o sinx sinc.o sins.o -g3 When I start the program: ./sinx It prints: .......insert x: I put x in and then: segmentation

C++ SDL segmentation fault

ぐ巨炮叔叔 提交于 2019-12-23 04:36:49
问题 I had my game working and then decided to try and implement a menu using the following tutorial. I did not use the tutorial to create the game that was in prior tutorials that he created. Whenever I compile and run the program it loads briefly, then closes and says Process terminated with status 3 (0 minutes, 1 seconds) in the build log of code::blocks . UPDATE: I have updated the code for the pastebin link to what I have now, the error I am now getting from the debugger is Program received

Minimal C/C++ program that segfaults? [duplicate]

安稳与你 提交于 2019-12-23 04:36:09
问题 This question already has answers here : What is the easiest way to make a C++ program crash? (29 answers) Closed 5 years ago . I'm trying to set up the way my server handles core dumps. In order to test it, I'd need a program that always segfaults. Is there a simple example program that always segfaults? 回答1: main; is portable, and segfault in 5chars. 回答2: main() { *(int *)0xdeadbeef = 37; } should do it. 回答3: try this: long* ptr = 0x0; //-- you can also use other random values and likely

Qt segmentation fault unless I rebuild

折月煮酒 提交于 2019-12-23 03:52:09
问题 I'm working on a Qt project and often when I make a bunch of changes and build, when I run the program I get a random segmentation fault somewhere in the Qt framework. To fix it I have to rebuild and then it goes away. I found another person who had this issue and they received this answer: from: Segmentation fault in Qt application framework This makes it sound as though your build system isn't recognizing a dependency and that a change to that class definition isn't triggering a rebuild of

Qt segmentation fault unless I rebuild

浪尽此生 提交于 2019-12-23 03:51:53
问题 I'm working on a Qt project and often when I make a bunch of changes and build, when I run the program I get a random segmentation fault somewhere in the Qt framework. To fix it I have to rebuild and then it goes away. I found another person who had this issue and they received this answer: from: Segmentation fault in Qt application framework This makes it sound as though your build system isn't recognizing a dependency and that a change to that class definition isn't triggering a rebuild of

Swig error with Nested enums in C++

会有一股神秘感。 提交于 2019-12-23 03:37:13
问题 I have a class similar to the following. It has a nested enum OptionTag. class MediaPacket { public: struct RtcpAppName { char mName[RTCP_APPNAME_LENGTH]; }; enum OptionTag { RESERVED = 0, PROFILE = 1, LATENCY = 2, PKTLOSS = 3, JITTER = 4, LEGACYMIX = 5, LASTTAG = 255 }; .... .... list<OptionTag> GetOptions(unsigned int ssrc) const; }; For this I created a swig interface as follows %module mediaopts_packet %include "stdint.i" //Redefining nested structure in swig struct RtcpAppName { char

Multidimensional array on the heap - C

馋奶兔 提交于 2019-12-23 02:37:05
问题 I am learning C and trying to make a function that would create an array of arrays of strings. #include <stdio.h> #include <stdlib.h> #include <string.h> void parse(char ***aoa) { char *string = calloc(9, sizeof(char)); //create a string of size 8+1 strcpy(string, "hi world"); // put text in that array char **array = calloc(10, sizeof(char *)); //create an array of strings aoa = calloc(10, sizeof(char *)); //create and array of arrays aoa[0] = array; //assign string array to the 0th elements

C++ STL stack pop operation giving segmentation fault

一曲冷凌霜 提交于 2019-12-23 01:50:05
问题 I implemented a programming question from this link in C++ but I am getting a segmentation fault in the pop() operation with my code. I am fairly new to C++ and can not seem to find the error myself. #include<iostream> #include<stack> using namespace std; void printNge(int *arr); int main() { int arr[] = {1,4,2,6,3,8,7,2,6}; printNge(arr); return 0; } void printNge(int *arr) { stack<int> st; st.push(arr[0]); for(int i=1; i<9;i++) { while((st.top() < arr[i]) && (!st.empty())) { cout <<

Segfault from adding a variable

旧巷老猫 提交于 2019-12-22 18:28:10
问题 I'm admittedly a straight-C newbie, but this has got me stumped. I'm working on a linked list implementation for practice, and I'm getting a segfault by simply adding a variable to the split_node function: #include <stdio.h> #include <string.h> #include <stdlib.h> struct Node { struct Node *child; char *content; }; void print_list(struct Node node); void split_node(struct Node *node, int position); int main() { struct Node head, second, third; head.content = "first"; second.content = "second"

Tkinter causes SIGSEGV and system crash - how to fix?

烈酒焚心 提交于 2019-12-22 18:10:16
问题 I'm developing a Tkinter GUI for a python project. Everything was fine yesterday, but today my mac immediately crashes (back to log-in screen) when I run the mainloop() command. I've tried to isolate the issue by cutting back GUI features, but nothing helped. The problem even occurs with the simplest of GUIs. I'm using this demo code: from tkinter import Tk, Label, Button class MyFirstGUI: def __init__(self, master): self.master = master master.title("A simple GUI") root = Tk() my_gui =