segmentation-fault

Why can't I cause a seg fault?

OK for whatever reason I'm having trouble causing a seg fault. I want to produce one so that I can use gdb to see how to debug one. I have tried both examples from the Wikipedia article yet neither work. The first one: char *s = "Hello World!"; *s = 'H'; And the second example: int main(void) { main(); } EDIT: I'm using Ubutn...

SWFTools Segmentation Fault

I am getting a Segmentation fault (core dumped) error when converting a PDF to SWF using the pdf2swf from swftools. Has anyone come across this or knows what could be wrong. The notices I get before the error are: NOTICE File contains jpeg pictures NOTICE file contains soft masks NOTICE file contains forms NOTICE file contains transpar...

Segmentation fault in Qt Designer 4.6 with custom widget

Hi, I had a segmentation fault when using my new Qt Widget with Qt Designer 4.6. The problem arise when trying to preview the new widget. when using gdb I found that the problem is in qdesigner_internal::WidgetFactory::applyStyleToTopLevel: Program received signal SIGSEGV, Segmentation fault. qdesigner_internal::WidgetFactory::apply...

need help solving a segmentation fault with file i/o in C

I read the input file , which has 911 lines , and want to copy these 911 lines into the output file , after making a few changes to each line.. I am getting segmentation fault when i run this.. I dont know why.. can anyone please help.. #include<stdio.h> void main() { int i; FILE *fin,*fop;char* str; fin=fopen("atk561011.tx...

Segmentation fault when different input is given

hi all, I do some image processing work in C++. For this i use CImg.h library which i feel is good for my work. Here is small piece of code written by me which just reads an image and displays it. #include "../CImg.h" #include "iostream" using namespace std; using namespace cimg_library; int main(int argc,char**argv) { CImg<uns...

Redhat AS 4 seg fault calling magic_buffer using Java 1.6

I have a java class that calls a C++ class via a JNI C++ class to access the 'file' command functionality provided by libmagic.so. The C++ class compiles and run fine as a C++ main() -It works fine on RHEL 5 running java 1.5 and 1.6; -it works fine on RHEL 4 running java 1.5 -it throws a seg fault 26234 on the RHEL 4 with java 1.6 ...

Segmantation fault when adding elements to a structure

Why do I get segmentation fault in this function: #include <stdio.h> #include <stdlib.h> #include "math.h" vec_t mtrx_multiple (sparse_mat_t a, vec_t c) { vec_t result; int i; result.n = a.n; printf("result.n: %d\n", result.n); result.vec = malloc(a.n * sizeof *result.vec); for(i=0; i<a.n; i++) resu...

Why is Ruby throwing a Segmentation fault on only my system, and only in this Rails application?

I'm not exactly sure how to properly debug this but have tried a few different approaches that have chewed up time, but not solved the problem. At least 4 other people in my office can execute this code on identical machines with the same version of ruby and rubygems installed with no error. Here is the code that I'm executing: status ...

segmentation fault when calling a function

Segmentation fault when calling the Update_Multiplier and gdb debugger shows these: Program received signal SIGSEGV, Segmentation fault. 0x080b74e8 in Update_Multiplier() () double upperbound = 116325; double objective = 1.1707e+07; int main() { Update_Multiplier(); } void Update_Multiplier() { cout << "function 0" << end...

What does this stack trace possibly mean?

Hi, I'm having segfault problem in my application written using C++ and compiled using GCC 4.3.2. It is running under Debian 5 x64. The process crashed on the following line of code: #0 0x00000000007c720f in Action::LoadInfoFromDB (this=0x7fae10d38d90) at ../../../src/server/Action.cpp:1233 1233 m_tmap[tId]->slist[sId]...

Debugging segmentation fault in a multi-threaded (using clone) program

I wrote a code to create some threads and whenever one of the threads finish a new thread is created to replace it. As I was not able to create very large number of threads (>450) using pthreads, I used clone system call instead. (Please note that I am aware of the implication of having such a huge number of threads, but this program is ...

Segmentation fault

Hi, This is probably a silly question, but I can't see what I am doing wrong here. I have the class: #include <sys/time.h> #include <gsl/gsl_cdf.h> #include <gsl/gsl_randist.h> #include <cmath> #include "randomnumbergenerator.h" class RandomNumberGenerator { gsl_rng * rn; public: RandomNumberGenerator(); ~RandomNumberGener...

how to parse URLs in c using sscanf() ?

Hi, this is my c code that reads a list of URLs from a file , and tries to separate the various parts of the URL.. This is just rough parsing , i'm not bothered about special cases.. I guess there is some fault with the sscanf() statement , when i run this , i get " segmentation FAULT" .. and moreover , the full url is being assigned t...

Why am I getting a segmentation fault?

I am trying to compile a simple hello world function in c++. After I compile it, I run it and get "Segmentation fault". Can someone shed some light on this? I am compiling this from a Linux command line using the following command: g++ hello.cpp #include <iostream> using namespace std; int main() { cout << "Hello World!" << ...

C - Program segfaulting when scanf() is called

I'm learning C right now, and I copied this little snippet straight from the book I'm using. It segfaults when I run it and I can't figure out why, I ran it through gdb and it stops at line 9 scanf("%s", aName);, but printing the values of the variables brings up nothing suspicious looking. What's wrong with this thing? #include <stdio....

Segmentation fault depending on string length?

I am writing a program that will read lines from an infile using getline into strings, convert the strings to c-strings containing the first m nonwhitespace characters of the string, then concatenate the c-strings into a single char array. A sample file might look something like this: 5 //number of rows and columns in a grid 2 //...

Having issues with counting the number of bytes in use by files in a folder. Getting a segfault error.

I am currently trying to count the number of bytes consumed by files in a certain directory. It recursively goes through all the folders on the current directory and counts the bytes of the files. When I recursively call the function rec_bytes, I print off "Go in"... but when it returns the value... It segfaults. I labeled the problema...

Core dump analysis using gdb

I have a couple of questions regarding core dumps. I have gdb on Windows, using Cygwin. What is the location of core dump file? Is it a.exe.stackdump file? (This is the only file that generated after crash) I read on other forums that the core dump file is named "core". But I don't see any file with name "core". What is the command for...

How do you read a segfault kernel log message.

This can be a very simple question, I'm am attempting to debug an application which generates the following segfault error in the kern.log kernel: myapp[15514]: segfault at 794ef0 ip 080513b sp 794ef0 error 6 in myapp[8048000+24000] Here are my questions: Is there any documentation as to what are the diff error numbers on segfault, ...

C++ Seg fault on reference to stored base class pointer

Hi all. I'm getting some nasty segmentation faults through the g++ compiler on the following code. Any ideas on why this would happen and how to fix it would be great. #include <iostream> using namespace std; class Base { public: Base() {} virtual ~Base() {}; virtual int getNum(int) = 0; }; class Derived: public Base { public: ...