Re: Program crashes - debugging suggestions?

From: boa (root_at_localhost.com)
Date: 06/29/04


Date: Tue, 29 Jun 2004 06:18:27 GMT

Mark wrote:

> Hi, I was hoping to get some suggestions on debugging a multi-threaded Linux
> program that crashes about every 10-12 hours. The program coordinates the
> behaviour between several (about 4)attached devices (serial and ethernet).
> There is generally one thread for each attached device. Unfortunately when
> it crashes the threads stop responding one-by-one, no seg fault or other
> obvious error occurs, making it very hard to pin down. What I suspect is
> happening is one thread is gradually overwriting memory and it crashes as
> soon as the memory being overwritten is in use by another thread. It
> currently has a 4k guard between threads.
>
> Does anyone have any suggestions for how to figure out which code is the
> source of the problem? I've inspected the most likely areas but haven't
> been successful in fixing it. Any techniques using gdb/ddd, or other tools?
> If it generated a seg fault it would be easy......
>
> Thanks in advance for any help, this is really driving me nuts!
>
> Mark
>
>

Have you tried valgrind?

 From its homepage at http://valgrind.kde.org/
Valgrind is a GPL'd system for debugging and profiling x86-Linux
programs. With the tools that come with Valgrind, you can automatically
detect many memory management and threading bugs, avoiding hours of
frustrating bug-hunting, making your programs more stable. You can also
perform detailed profiling, to speed up and reduce memory use of your
programs.

The Valgrind distribution includes five tools: two memory error
detectors, a thread error detector, a cache profiler and a heap
profiler. Several other tools have been built with Valgrind.

HTH
boa@home



Relevant Pages

  • Re: Program crashes - debugging suggestions?
    ... > program that crashes about every 10-12 hours. ... > soon as the memory being overwritten is in use by another thread. ... Valgrind is a GPL'd system for debugging and profiling x86-Linux ...
    (comp.os.linux.development.apps)
  • Re: Program crashes - debugging suggestions?
    ... > program that crashes about every 10-12 hours. ... > soon as the memory being overwritten is in use by another thread. ... Valgrind is a GPL'd system for debugging and profiling x86-Linux ...
    (comp.os.linux.embedded)
  • Re: What are the Recomended Tools
    ... Valgrind is a GPL'd system for debugging and profiling x86-Linux programs. ... to speed up and reduce memory use of your programs. ... The Valgrind distribution includes five tools: two memory error detectors, ...
    (alt.comp.lang.learn.c-cpp)
  • Re: strange crashes, maybe related to memory problems, always occur in STL
    ... > The piece of code in question always crashes in an STL operation ... > change how various parts are handled in memory, i.e., make some things ... Could you not write a command line program that 'hosts' this piece of code? ... Then you can use valgrind. ...
    (comp.lang.cpp)
  • Re: What are the Recomended Tools
    ... memory leaks are a concern for the C language. ... > Valgrind is a GPL'd system for debugging and profiling x86-Linux programs. ...
    (alt.comp.lang.learn.c-cpp)