简体   繁体   中英

Debugging Coroutines in C++20

With the upcoming C++20 standard we will have coroutines at our disposal. What is the best way to debug code based on coroutines? What could be done to trace the call flow?

Coroutines are not magic. They just have a different function flow that's based on hidden code. Gdb and others can already debug them.

I'm not sure you understand how debuggers work, but it's simply that in every assembly code line, there's a line in your C++ source code associated with it. These links are called "debug symbols". The only question you need to ask is: Are there lines of code associated with your coroutines and their call flow? The answer is yes.

In conclusion: there's no reason for a standard debugger to not work with them. I don't even believe there's much to add to debuggers to make them support coroutines.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99215 gcc/gdb have issues supporting coroutine debugging.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM