Debugging multithreaded C++ application in CLion
Asked Answered
E

1

8

I am able to run my multithreaded C++ application in CLion debug. However, it is virtually useless with the call stack jumping between threads each time I step to the next instruction. After about 3 jumps I lose track of what thread is where. And having to select the thread from a pull down is too awkward.

It seems like there should be a way to monitor each thread separately. There is a feature in other JetBrains products called "Parallel Stacks" that seems to address that. But I don't see it in CLion (2018.2.5).

Ideally, one could force the IDE to stay on (and step through) one thread while the others are running in the background. If a breakpoint is hit in another thread, a separate call stack should appear indicating it stopped, but the source code display would stay at the thread being monitored.

Is there some way to achieve something like this, or another scheme to allow debugging a multithreaded app efficiently and effectively?

Eumenides answered 6/12, 2018 at 14:53 Comment(0)
M
3

I encountered the same issue when debugging application built with MSVC using lldb in CLion. I found a partial solution by using lldb command in the debug console (for instance thread step-over). I guess you could apply the same logic if you are using gdb.

Messner answered 9/3, 2020 at 17:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.