Re: problem about SIGSEGV and backtrace



I was always annoyed by these functions because the information they
spit out is damn near meaningless without using c++filt and addr2line.
(Assuming you're using it for C++ code obviously).

I once looked at the binutils package to try and see if I couldn't
link against something to do this automagically or just plain rip out
the functionality and put it in my own library. That code was scary.

But yeah, the ability to have decent automagical backtraces like other
languages would be awesome. Running in a debugger is nice, but if
you're not expecting the bug, you have to trigger it twice which takes
at least time, and other times luck. (Nasty memory bugs that don't get
triggered while in a debugger are a bitch to catch) As well as someone
pointed out about daemon processes where the bug doesn't happen till
day 14 or some such.

Anyway, if anyone were to libify such functions I'd certainly use them...

</rant>

(Other) Paul Davis

On 8/14/07, Paul Davis <paul linuxaudiosystems com> wrote:
> On Tue, 2007-08-14 at 15:25 +0100, Pádraig Brady wrote:
> > dashikugua 126 com wrote:
> > > Hi all:
> > >
> > >     I want to use SIGSEGV and backtrace  to debug my programme. But I do
> > > not know how to use them. I'm running GTK 2.6.4 and Glib 2.6.4 on a
> > > Debian woody.
> > >
> > >     Could you please guide me and tell where to find what I am looking for?
> > >
> > >     Any help will be most appreciated. Thanks a lot.
> >
> > Try linking to the following (with the -rdynamic linker option),
> > and just call the install_back_trace() function somewhere at startup:
> >
> > http://www.pixelbeat.org/libs/trace.h
> > http://www.pixelbeat.org/libs/trace.c
>
> if you are using glibc, then the functions
>
>         backtrace
>         backtrace_symbols
>
> are builtin. google for them.
>
> of course, most people use a debugger to backtrace after a segfault,
> because its frequently more useful & powerful.
>
> --p
>
>
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>



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