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: Segmentation Fault Debug with GDB, GCC compiled with --enable-checking?!


"Gregor Velz" <g.velz@gmx.net> writes:

> Hi! 
> I'm a newbie concerning Linux, but I have to write a C multithread
> application. Unfortunately I have a Segmention Fault and I can't find
> the error. I tried with GDB to debug it, but I get always "Couldn't get
> registers: No such process" or "Cannot fetch general-purpose registers
> for thread 1074119840: generic error" if I try to use "backtrace" or
> "print".

Is this a segfault in your program, or a segfault in GCC?

If it is a segfault in your program, simply add -g (and remove any -O
    flags) to your compile options.

If it is a segfault in GCC, please report a bug, following the
    instructions at gcc.gnu.org/bugs.html

If you could provide a more detailed explanation of what you are
    trying to do and what is going wrong, it would be easier for
    people to help you, and you might get more help. A minimal but
    complete code example which sufficient to reproduce the problem
    would be particularly helpful.

> I've read that gcc has to be compiled with an option --enable-checking
> to could use GDB and per default it isn't in distributions (I'm using
> Red Hat 9, gcc -v is confirming this [--disable-checking]). 
> How can I recompile gcc or downloading an rpm where --enable-checking is
> activated?

If you are trying to debug your own program, and *not* trying to debug
    gcc, you have no need for --enable-checking.

--enable-checking can greatly lengthen compile times, and is only
    useful to people trying to debug/fix/modify gcc itself, so I do not
    think you will find rpms for gcc built with --enable-checking. If
    you don't understand enough to build gcc from source, you probably
    don't (yet) know enough to use --enable-checking. I can't help but
    think you are in fact just confused and have no need to use
    --enable-checking. 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]