[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: identifying cause of segfault with gdb?
From: |
Vijay Patil |
Subject: |
Re: identifying cause of segfault with gdb? |
Date: |
Wed, 14 Jul 2004 02:00:50 -0700 (PDT) |
Hi all,
Is there any way to find memory leaks using GDB?
Regards,
Vijay
--- Guy Harrison <swamp-DEL-dog@ntlworld.com> wrote:
> Amit Bhatia wrote:
>
> > Hello.
> > Is it possible to identify the source of a
> segmentation fault(which is
> > most
> > probably being caused due to memory access of
> place which I am not allowed
> > to) using gdb?
> > I wish to know the name of the erring call or
> line no in the method where
> > this could be happening.
> > I am using g++ 3.2 on redhat 9.0, and do compile
> with -c -pg flag.(and
> > finally make libmyown.a and then link it to the
> compiled test program).
>
> Pass "-g" flag to compilations then run program
> under 'gdb'. If it crashes
> then use "bt' (backtrace) command to unwind it. For
> trivial problems the
> fault may become apparent just from that.
> Alternatively recompile with "-g
> -O0" (no optimisation), keep fingers crossed it
> still crashes, then start
> stepping through it. Optimised code sometimes has
> the debugger jumping
> about all over the place - trouble is, in some
> situations (because the
> code's changed) the fault can move around, or even
> "vanish" (it hasn't)
> entirely. A useful gui for gdb is 'ddd' as it allows
> you to type gdb
> commands as well as point 'n' click (and
> vice-versa).
>
> _______________________________________________
> Help-gplusplus mailing list
> Help-gplusplus@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gplusplus
>
=====
Thanks and Regards
Vijay
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail