2

I have a (complex) multithread-application that produces a crash with some specific data. The crash happens at random positions and it is obvious the position where the crash happens is not the reason.

So at the moment I assume an illegal memory access where data are overwritten by one thread or something like that.

Unfortunately it happens with some larger dataset only, so there is no way to strip down the whole thing to something simple. So to find the root cause of the problem I tried the Intel Inspector 2019 - but it is unusable slow. While the application typically shows the issue after about 15 minutes of intensive calculation with these specific data, with that inspector running I would need to wait more than one day - and it is unsure if the crash happens because the Inspector changes the whole timing dramatically.

So my question: does anybody have a better idea/a better tool to track down the reason for such illegal memory accesses?

Andy idea is welcome!

Elmi
  • 5,899
  • 15
  • 72
  • 143
  • Well, use all other tools available, like valgrind, cppcheck or other static code analysis tools. Fix all problems that they report, because sometimes they are right... – U. W. Nov 26 '19 at 08:28
  • Have you tried to [debug your crash dump](https://github.com/microsoft/WinObjC/wiki/Debugging-Stack-Traces-from-Crash-Dumps)? – Maxime B. Nov 26 '19 at 08:37
  • Tool recommendations are off-topic. However, from what you describe it sounds very much like a race condition bug. These tend to be infrequent and intermittent. Look at all data shared between threads. Very high probability that the bug is located in access to that data. Decent tool chains will let you see the state of each thread upon crashing, what line they were executing etc, with call stack. – Lundin Nov 26 '19 at 08:38
  • 1
    This might help https://code.visualstudio.com/docs/cpp/cpp-debug – Paul Nov 26 '19 at 08:43
  • 1
    Instead of run-time analysis you could try with [static code analysis](https://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis) – Dialecticus Nov 26 '19 at 09:11

1 Answers1

0

You can use Application Verifier. select Heaps(with Full) under Basics option and run your program under WinDbg. You can find the exact position where the crash happens. Notice: it will be slow but it will help.