RE: problem: "segmentation fault"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rinku,

First you need to figure out where it happened.  When you build your
program, add -g to the compiler options if it's not already there.  That
causes it to generate debugging information.  When your program crashes
it should create a core file.  That file should either be named "core",
or "core.nnnn", where "nnnn" is replaced with the process ID of the
program that crashed, for example, "core.1234".  You can use the GNU
debugger "gdb" to examine the stack and see what line of code your
program crashed on.  For example, if your program is named my_prog, and
your core file is just "core", you can open the core file in gdb like
this:

gdb my_prog core

Then, you can look at the stack trace by typing "where" at the prompt.
Look at the first line of the output and see if it tells you what line
of your source code the error occurred on, and go back and see if you
can see anything wrong with that line of code.

Good luck!

Cheers,
Lyle


-----Original Message-----
From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On
Behalf Of rinku rathore
Sent: Tuesday, August 10, 2004 2:56 AM
To: gcc-help@xxxxxxxxxxx
Subject: problem: "segmentation fault"

hello,
I had made a program to read a file and storing its
contents in two dimensional array of 256*256,and a
error "segmentation fault" occured how can I remove it
plz tell.
Rinku Rathore


	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux