segfault

SegFaults in my Assembler? But that's impossible! :O

Okay, so I understand all of us C/C++ programmers have at one time met our untimely nemesis, the diabolical signal SIGSEGV, the Segmentation Fault. Now, I understood (emphasis on the past tense) this to be some form of fail safe / checking system within some portion of the machine code spat out by the magical GCC (or g++) compiler, or wh...

Cocktail Sort code segfaults - not sure why.

Hi there. I wrote a Cocktail Sort algorithm, and am testing it by generating random vectors of size 500 up to 10,000 - running it 10 times per vector. After about the 2000-3000 length vector mark, the code segfaults. I expect it isn't the test code as the same test is used for multiple sorting algorithms and it runs fine for every other ...

Ubuntu just-in-time debugging

Good Morning everyone I'm currently facing a segfault at random on a little piece of software, however, It appears only when not started with an attached debugger (due to a possible memory error, where values are initialized in a safe interval when started with a debugger). Is it possible to attach an debugger only in case of an segfau...

Segfault in map

Hello, I can't understand why does this code fail with segfault: #include <cstdlib> #include <iostream> #include <map> #include <string> using namespace std; int main(int argc, char** argv) { map <string, string> temp; map <string, string>::iterator it; S string text = ""; string thatChange = ""; str...

Segmentation fault in std::map::insert(...)

hello, i've used search but i didn't find answer satisfying me... so.. this is chunk of code: //VoteContainer.h typedef uint32_t order_id_t; typedef int driver_id_t; class Vote { public: enum DriverVoteResponse {YES, NO, TIMEOUT}; struct DriverResponse { driver_id_t dri...

Why does the following code raise a SegFault. c(Linux)

This a code that would reverse the data of a document and save it in the same document itself. However I am getting a Segmentation Fault.Please Help,I don't know why it gives a SegFault. #include <stdio.h> #include <stdlib.h> #include <termios.h> #include <fcntl.h> #include <string.h> #include <unistd.h> int main (int argc,char* argv[...

Segfaulting polymorphism (Suspected stack corruption - Code on github)

It's a little difficult to explain the offending piece of code, as there seems to be some degree of stack corruption, and all the code's pretty linked together (it's a game). If you're looking for a headache and some debugging, please check out the segfault branch on git://github.com/RobotGymnast/Gingerbread.git and see if you can find ...

Self restart program on segfault under Linux

Under Linux what would be the best way for a program to restart itself on a crash by catching the exception in a crashhandler (for example on a segfault)? ...

Segfault: don't know where to start.

Hi, I'm trying to compile this program under Windows (it's a program which turns bootable code in floppies. I got the source from here: http://www.acm.uiuc.edu/sigops/roll_your_own/1.bootstrap.html). First I got the problem that it didn't read the INI file. That is solved now. Now I get a segfault on the following rule: while(data < e...

What is a canonical way to produce a segmentation fault in C#?

I am interested in the shortest, neatest piece of C# code around that will reliably produce a segfault - ideally without directly calling any unmanaged code. ...

Failure to build NDK cygwin Windows 7 x64

I currently have a JNI application on the market and was looking to use the neon instructions to further improve performance. I am able to compile and build the neon sample and some basic changes but whenever I choose to do something more complex the assembler crashes with the following output (i've stripped the file names): .0/ProjectT...

sdl app segfaults on sdl_gl_setattribute

Hi, I'm trying to compile this example and play around with it a bit. I've already corrected the main error the people were having with this example where they would call sdl_gl_setattribute before SDL_Init was called but I'm still getting a segfault right after the first SDL_GL_SetAttribute call. I've ran sdl with opengl apps before on ...

On Windows(7) my application keeps restarting on segfault

Hello, I would like to know how to prevent my application from being restarted when it crashes (an intentionnal segfault in an assertion) Is it related to debugging environment? (I have VS 2008 installed) is there a registry key or something to NOT reload apps after a crash? Thanks in advance EDIT: While searching for an answer I ca...

When is the segfault thrown?

Suppose I have a class like class A { int x; int y; public: getSum1() const { return getx() + y; } getSum2() const { return y + getx(); } getx() const { return x; } } And then I have int main(int argc, char **argv) { A *a = 0; switch(argc) { case 0: a->gets...

GDB Quirks with Thread Process

I am debugging a process with multiple threads in GDB. I compiled the sole source file with the -g flag. However, while running in GDB, the following scenario occurs: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb7fe2b70 (LWP 2604)] 0x00000011 in ?? () Prior to the switch, the particular thread executes...

A C program compiled under 32-bit Debian Squeeze causes a segfault on my friend's 64-bit one

Not so long ago I've installed Debian and configured it with my friend's help. Yesterday I have downloaded GCC 4.4 and I created a simple program to test it out. This is the code: #include <stdio.h> int main () { int result; printf ("Hello Wor... Linux! This is my %dst program compiled in Debian.\nHow many is 2+2?\n", 1); s...

Why is this giving me a segfault?

This: bool grid[1280][1024]; for (int x = 0; x<1280; x++) { for (int y = 0; y<1024; y++) { grid[x][y] = false; } } works fine, but bool grid[1280][1024]; bool grid2[1280][1024]; for (int x = 0; x<1280; x++) { for (int y = 0; y<1024; y++) { grid[x][y] = false; grid2[x][y] = false; } } ...

c++ class pointer deletion segfaulting

I've got a simple class called object that I'm having a problem with. Theres one method which causes a segfault if I call it. I don't understand why. typedef class object { private: short id; std::string name; SDL_Rect offset; public: object(); object(short i, std::string n); ~object(); o...

Linux C and C++: what else should I be logging when handling signals like SIGSEGV?

Working on some linux (Ubuntu) systems, running some in-house C and C++ apps (gcc). There is a long list of signals which are handled, such as SIGSEGV and SIGINT. On signal, the callstack is obtained using backtrace(3) and backgrace_symbols(3). For C++ the function names are even demangled with abi::__cxa_demangle(). My question is: ...