This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: SegFault
Thanks for that information Tom, but what is the effect of -g3 option in
gcc. Is it to get the line number where the error occcured when gdb was
debugging ?
Regards
cnu
On Thu, 2009-01-08 at 10:07 -0500, Tom St Denis wrote:
> Kolpur Srinivasa Chary wrote:
> > Hi Tom,
> > I didn't get you ... can you please elaborate it.. please .. I am new to gdb ..
> >
>
> When you compile your source, add -g3, e.g.
>
> gcc -g3 myfile.c -o myprog
> gdb myprog
>
> Tom
>
>
>
> > Regards
> > cnu
> >
> > On Thu, Jan 8, 2009 at 8:31 PM, Tom St Denis <tstdenis@ellipticsemi.com> wrote:
> >
> > > Kolpur Srinivasa Chary wrote:
> > >
> > > > Hi,
> > > >
> > > > I got segmentation fault when I compiled a program with gcc, so I have
> > > > run the executable file to gdb.
> > > > When I tried running the program through gdb, it displayed the following
> > > > message
> > > >
> > > > Program received signal SIGSEGV, Segmentation fault.
> > > > 0x08048ccb in main ()
> > > >
> > > > But why is it not telling me the line number at which segfault
> > > > occured? Please help me regarding this issue.
> > > >
> > > >
> > > You have to compile with debug information turned on, try adding "-g3" to
> > > your build, also avoid adding strip or "-s" to your build.
> > >
> > > Tom
> > >
> > >
> >
> >
>