This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: problem: "segmentation fault"


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@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of rinku rathore
Sent: Tuesday, August 10, 2004 2:56 AM
To: gcc-help@gcc.gnu.org
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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]