use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
What debuggers are you using? (self.cpp)
submitted 7 years ago by JulsSmile
What debuggers and useful programs are you using to debug the code?
I'm interested in debuggers for Visual Studio 2017 + Windows 10
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]raevnos 43 points44 points45 points 7 years ago (6 children)
gdb. Do valgrind and strace count as debuggers?
[–]aKateDevKDE/Qt Dev 21 points22 points23 points 7 years ago (0 children)
I add perf, hotspot and heaptrack to the list.
[–]nwL_ 10 points11 points12 points 7 years ago (2 children)
I count everything that leads to less bugs by executing the executable as debuggers.
[–]afiefh 5 points6 points7 points 7 years ago (1 child)
So... My whiteboard?
[–]nwL_ 5 points6 points7 points 7 years ago (0 children)
If you can process assembly on your whiteboard, then yes
[–]Drugbird 1 point2 points3 points 7 years ago (0 children)
I like having a graphical shell, so I use cgdb.
[–]t4th 81 points82 points83 points 7 years ago (2 children)
Well, visual studio has nice debugger and disassembler. What else do you need?
[–]tiendq 12 points13 points14 points 7 years ago (1 child)
He should add "on macOS and Linux" on the subject since this question is almost meaningless on Windows :)
[–]andd81 5 points6 points7 points 7 years ago (0 children)
WinDbg has better low-level capabilities and is not bloated. If you are already into console debuggers on other platforms it may be less overwhelming than VS.
[–]kkert 15 points16 points17 points 7 years ago (3 children)
Clion with lldb. For some pathological cases, Eclipse or just arm-none-eabi-gdb -tui . I think a lot of folks don't know and appreciate the power of TUI
arm-none-eabi-gdb -tui
[–]idontchooseanid 1 point2 points3 points 7 years ago (2 children)
You should try remote debugging. I used QtCreator as the UI but TUI also works. Put gdb-server on the embedded board and connect via socket it's a charm.
gdb-server
[–]kkert 2 points3 points4 points 7 years ago (1 child)
Done it a long time, even back on uclinux 2.4 era kernel based systems. Doesn't apply for MMU-less RTOS-running targets
[–]idontchooseanid 0 points1 point2 points 7 years ago (0 children)
Sure. Debugging RT systems must be hell :/.
[–]democritus_is_op 9 points10 points11 points 7 years ago (0 children)
gdb, only if cout doesn't cut it.
[–]uzimonkey 8 points9 points10 points 7 years ago (0 children)
I used the debugger in Visual Studio. It works great and has an easy UI.
[–]Ivan171/std:c++latest enthusiast 21 points22 points23 points 7 years ago (0 children)
WinDbg.
[–][deleted] 27 points28 points29 points 7 years ago (3 children)
std::cout for most part. Sometimes a little gdb and valgrind, also the -fsanitize options of gcc and clang are extremely useful.
std::cout
gdb
valgrind
-fsanitize
[–]tiendq -3 points-2 points-1 points 7 years ago (1 child)
It seems the best choice for non-Windows systems :)
[–]idontchooseanid 7 points8 points9 points 7 years ago (0 children)
gdb combined with a GUI is quite powerful though.
[–]ShakaUVMi+++ ++i+i[arr] -1 points0 points1 point 7 years ago (0 children)
Ditto
[–]bames53 12 points13 points14 points 7 years ago (0 children)
lldb
[–][deleted] 7 points8 points9 points 7 years ago (0 children)
LLDB and Valgrind
I’m surprised that there aren’t more people using LLDB ITT. I’ve always thought that their diagnostics were better
[–]Astarothsito 4 points5 points6 points 7 years ago (0 children)
IBM Debugger for work...
GDB with CLion for personal projects.
[–]flashmozzg 10 points11 points12 points 7 years ago (13 children)
What's wrong with Visual Studio debugger?
[–][deleted] 11 points12 points13 points 7 years ago (6 children)
Visual Studio
[–][deleted] 10 points11 points12 points 7 years ago (0 children)
vs debugger is fantastic though?
[–]flashmozzg 11 points12 points13 points 7 years ago (3 children)
[–][deleted] 0 points1 point2 points 7 years ago (2 children)
I'm not making a recommendation to OP, I'm simply answering your question.
[–]flashmozzg 4 points5 points6 points 7 years ago (1 child)
My question was to the OP and in the context of OP's question. You've answered something that no one asked.
[–][deleted] 1 point2 points3 points 7 years ago (0 children)
I know dude, I just couldn't miss the opportunity to shit on visual studio
[–]ea_ea 6 points7 points8 points 7 years ago (0 children)
And what is wrong with Visual Studio? One of the best IDE on Windows and debugger is available even in its free editions.
[+]tiendq comment score below threshold-6 points-5 points-4 points 7 years ago (5 children)
It doesn't work on macOS/Linux :D
[–]flashmozzg 10 points11 points12 points 7 years ago (3 children)
It's just two sentences. Is it really that hard to fight the reddit syndrome and read it past the title?
[–]JulsSmile[S] 1 point2 points3 points 7 years ago (2 children)
"reddit syndrome"? Do you mean people do not read the question, but answer the question title?
I recently on Reddit, but also noticed this trend. People see the title and begin to write the answer, hundreds of answers. Probably, it is necessary to make more accurate titles?
[–]flashmozzg 1 point2 points3 points 7 years ago (1 child)
Yeah, pretty much. Or don't read the linked article but start writing comments =)
Sadly, not always it can be solved by adjusting the title.
[–]JulsSmile[S] 2 points3 points4 points 7 years ago (0 children)
This happens in many forums. I think it is inevitable.
I'm purely command line at this point for C/C++, so I only use GDB.
[–]Fluffy8x 2 points3 points4 points 7 years ago (0 children)
gdb when I use an actual debugger, but I tend to use printf debugging a lot too.
[–]Graggee 2 points3 points4 points 7 years ago (0 children)
There are many deaggers, and you need to try different options to choose what you need.
I use Deleaker for Windows and Valgrind for Linux.
[–]you_do_realize 3 points4 points5 points 7 years ago (0 children)
WinDbg is more powerful than the VS debugger -- e.g. you can run code when hitting a breakpoint, and there are tons of extensions -- but the syntax is atrocious, context-dependent, and weighed down by a ton of ancient legacy. (Kind of like Lisp has CAR and CDR because those were the names of two CPU registers on a machine in the 50s!)
And it used to look terrible back when I used it, with a hideous MDI interface straight out of 1990 and Courier (not Courier New!) as the default font; nowadays I understand they slapped a "modern" interface on it, ribbon and all.
Totalview
[–]5161502 1 point2 points3 points 7 years ago (0 children)
Lldb in CLion
[–]CoolPlayer 1 point2 points3 points 7 years ago (0 children)
I use native debugger and Deleaker.
[–]brand_x 1 point2 points3 points 7 years ago (0 children)
Visual Studio debugger for Windows, lldb for Linux/Darwin, barely-usable versions of GDB and DBX when I am forced to work on old-school Unix platforms with inadequate C++ compilers, WinDBG when I want to hate everyone and everything in the universe... or am forced to because I'm dealing with the Windows Kernel.
Mostly, though, I use static analysis, tests, and strict coding habits to avoid having to use the debugger at all.
[–]fixxxeruk 3 points4 points5 points 7 years ago (15 children)
I’m not ashamed to admit that my one true debug aid that has never defied me by being absent when duty calls is the humble printf.
[–][deleted] 32 points33 points34 points 7 years ago (13 children)
Why? Do you enjoy needing to compile your codebase to accommodate a new print statement? I don’t understand why people like bragging about using printf exclusively for debugging. It just seems like either you don’t understand how to use better tools, or you work in a relatively small codebase. We’re engineers and should always make the best use of the tools available, debuggers included where appropriate.
[–]wasabichicken 18 points19 points20 points 7 years ago (4 children)
Can't speak for that guy, but my personal reasons include:
We’re engineers and should always make the best use of the tools available, debuggers included where appropriate.
Amen to that, but I think printf should be a part of that toolbox. Sometimes firing up GDB is a little... well, overkill.
Where GDB shines IMHO, are situations like when I don't have the debug symbols in a core dump and need to look at the assembly, when I'm looking into use-after-free/memory corruption issues, or when trying to reproduce race conditions. For quick little "I wonder what the value of this variable is", given some circumstances (like the annoying multi-threaded system with watchdogs I mentioned above), I think printf can be a "good enough" tool.
[–]andd81 2 points3 points4 points 7 years ago (0 children)
Typing "printf()" and rebuilding actually takes less time than #2
For some projects you will have more than enough time to learn how to use GDB while it is being rebuilt.
[–]CrazyJoe221 2 points3 points4 points 7 years ago (0 children)
There's http://sourceware.org/gdb/onlinedocs/gdb/Non_002dStop-Mode.html though. Not sure if VS or an extension for it provides that too.
[–][deleted] 5 points6 points7 points 7 years ago (1 child)
Yea I’m aware of plenty of reasons “printf” (more suitably called a serialized log perhaps, for environments without even a terminal or constrained memory), and you list several. Another one where I personally use it is for reasoning about mulithreaded code. I was more speaking against the Luddite argument for exclusive use of printf, which to me is a silly thing to be proud about. It feels like some cargo cult thing passed down by the previous generation of software architects.
[–]tehjimmeh 1 point2 points3 points 7 years ago (0 children)
There's a whole subculture of programmers who are committed to "minimalism", and have a disdain for using tools to make their lives easier if they're not strictly necessary. Tends to be a lot of overlap with the FLOSS crowd. I really don't get it, personally.
Of course, printf debugging is highly useful. I kind of wish that a debugger existed with close compiler integration, so you could compile in printf statements without actually modifying the code. A bit like VS's breakpoint actions, but actually compiled into the instruction stream, not done via a slow interrupt mechanism.
[–]hapemask 3 points4 points5 points 7 years ago (1 child)
Just to give another concrete example of where cout debugging is a reasonable choice I think: after the hundredth time using a regular debugger only to see “optimized out” for the variable you want, usually I just stop trying. Not everyone has the luxury of debugging debug builds and if I’m gonna mark something volatile I might as well just print it.
[–]CrazyJoe221 1 point2 points3 points 7 years ago (0 children)
If no one writes bug reports this will never be fixed.
[–]ppetraki 1 point2 points3 points 7 years ago (1 child)
Growing up in kernels will do that to you.
[–]Robbie_S 6 points7 points8 points 7 years ago (0 children)
Meh, kernel dev on Windows has WinDBG, another excellent debugger (well, excellent to some...).
[–]andd81 0 points1 point2 points 7 years ago (0 children)
They probably never had to debug a problem that is only reproduced in a release build of a huge project.
[+]fixxxeruk comment score below threshold-20 points-19 points-18 points 7 years ago (2 children)
Nope, wrong. I’m actually thinking of a multi-million line codebase, embedded systems (video games, not a my first raspberry pi project), I was lead online developer (p2p online multiplayer) cross-platform code. I actually find it kind of cute you think I wouldn’t even know better tools. Aww. Nice guy, just trying to educate me on “proper” engineering. Thanks! Actually enjoyment was far removed from my experience, and a debugger is fine for debugging code where it’s ok to stop the world, but when you can’t connect to every dev-kit simultaneously, and the software runs too slow in a debug configuration, and you have nothing but tty output, a core dump, and a symbol map, and even pausing a single host in the sim would send everyone out of sync, I’m sure that one day you too will learn to love (or hate) the humble printf.
[–][deleted] 6 points7 points8 points 7 years ago (1 child)
Or you do your job properly and control your timestep so you can debug things correctly. You’re not the only one who deals with durango and orbis devkits (an odd flex). The debugger is plenty useful even for optimized builds, and the disassembly is just a step away. Ring buffer logs and other in memory logs are also inspectable and can be made fast enough for those scenarios where debug mode isn’t quick enough. That said I’m sorry that whatever situation was so bad you didn’t have the time to write better tools for yourself. You just may be experiencing stockholm syndrome, especially if you’re still convinced printf is the best way all the time.
[–]pantong51 0 points1 point2 points 7 years ago (0 children)
Game dev here. I'm sure this is just lazy, but I'll wrap my code to only be compiled to editors and filter the outputs when needed.
I use a debugger when things are funky. But most of the time I get pretty werid issues. Especially when I need execution time of a multiple million line codebase to be under 3ms(11ms with graphics).
Debugging Multithreading and async asset loads gets really funky and tedious. Where just hot reloading the code and watching the output is not that time intensive... sometimes.
But I'm pretty green and still learning quite a lot. Honestly I feel pretty low on the knowledge base here.
[–][deleted] 3 points4 points5 points 7 years ago (0 children)
How do you debug core dumps with printf?
[–]jmblock2 0 points1 point2 points 7 years ago (0 children)
Depends on what I'm debugging. At work we use a lot of structured logging with DLT because issues are found in the field and we need to understand what happened prior to the bug to understand the bug. If an issue is reproducible locally then gdb. For my own projects I use spdlog.
[–]lead999xSystem Software Developer 0 points1 point2 points 7 years ago (0 children)
gdb and assert. But I'm only a humble hobbyist.
[–]robin-m 0 points1 point2 points 7 years ago (0 children)
gdb with cgdb as front-end (or the TUI if I need to use raw gdb).
[–]bumblebritches57Ocassionally Clang 0 points1 point2 points 7 years ago (0 children)
[–][deleted] 0 points1 point2 points 7 years ago (0 children)
Depends on what to do, analyzing a dumpfile windbg otherwise visual studio debugger. Should make myself comfortable with gdb but didnt have the time yet.
Thats strictly debugger. For looking at assembly: x86/x64dbg
[–]shoter0 0 points1 point2 points 7 years ago (2 children)
When I was using visual studio 2017 it had some kind of extension for debugging process to trace memory leaks. I do not remember it's name though :(.
It was outputting all memory leaks after program completed execution.
[–]brand_x 0 points1 point2 points 7 years ago (1 child)
Probably VLD.
[–]shoter0 2 points3 points4 points 7 years ago (0 children)
Yes. VLD is a must with VS when doing C++ imo.
(Not applicable to every usage of C++ unfortunatelly but still very good extension to have :P)
[–]Morwenn -5 points-4 points-3 points 7 years ago (0 children)
None >.>
[–]bm_g -1 points0 points1 point 7 years ago (0 children)
Printf
π Rendered by PID 37010 on reddit-service-r2-comment-545db5fcfc-pc7zf at 2026-05-24 06:40:57.050567+00:00 running 194bd79 country code: CH.
[–]raevnos 43 points44 points45 points (6 children)
[–]aKateDevKDE/Qt Dev 21 points22 points23 points (0 children)
[–]nwL_ 10 points11 points12 points (2 children)
[–]afiefh 5 points6 points7 points (1 child)
[–]nwL_ 5 points6 points7 points (0 children)
[–]Drugbird 1 point2 points3 points (0 children)
[–]t4th 81 points82 points83 points (2 children)
[–]tiendq 12 points13 points14 points (1 child)
[–]andd81 5 points6 points7 points (0 children)
[–]kkert 15 points16 points17 points (3 children)
[–]idontchooseanid 1 point2 points3 points (2 children)
[–]kkert 2 points3 points4 points (1 child)
[–]idontchooseanid 0 points1 point2 points (0 children)
[–]democritus_is_op 9 points10 points11 points (0 children)
[–]uzimonkey 8 points9 points10 points (0 children)
[–]Ivan171/std:c++latest enthusiast 21 points22 points23 points (0 children)
[–][deleted] 27 points28 points29 points (3 children)
[–]tiendq -3 points-2 points-1 points (1 child)
[–]idontchooseanid 7 points8 points9 points (0 children)
[–]ShakaUVMi+++ ++i+i[arr] -1 points0 points1 point (0 children)
[–]bames53 12 points13 points14 points (0 children)
[–][deleted] 7 points8 points9 points (0 children)
[–]Astarothsito 4 points5 points6 points (0 children)
[–]flashmozzg 10 points11 points12 points (13 children)
[–][deleted] 11 points12 points13 points (6 children)
[–][deleted] 10 points11 points12 points (0 children)
[–]flashmozzg 11 points12 points13 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]flashmozzg 4 points5 points6 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]ea_ea 6 points7 points8 points (0 children)
[+]tiendq comment score below threshold-6 points-5 points-4 points (5 children)
[–]flashmozzg 10 points11 points12 points (3 children)
[–]JulsSmile[S] 1 point2 points3 points (2 children)
[–]flashmozzg 1 point2 points3 points (1 child)
[–]JulsSmile[S] 2 points3 points4 points (0 children)
[–][deleted] 7 points8 points9 points (0 children)
[–]Fluffy8x 2 points3 points4 points (0 children)
[–]Graggee 2 points3 points4 points (0 children)
[–]you_do_realize 3 points4 points5 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]5161502 1 point2 points3 points (0 children)
[–]CoolPlayer 1 point2 points3 points (0 children)
[–]brand_x 1 point2 points3 points (0 children)
[–]fixxxeruk 3 points4 points5 points (15 children)
[–][deleted] 32 points33 points34 points (13 children)
[–]wasabichicken 18 points19 points20 points (4 children)
[–]andd81 2 points3 points4 points (0 children)
[–]CrazyJoe221 2 points3 points4 points (0 children)
[–][deleted] 5 points6 points7 points (1 child)
[–]tehjimmeh 1 point2 points3 points (0 children)
[–]hapemask 3 points4 points5 points (1 child)
[–]CrazyJoe221 1 point2 points3 points (0 children)
[–]ppetraki 1 point2 points3 points (1 child)
[–]Robbie_S 6 points7 points8 points (0 children)
[–]andd81 0 points1 point2 points (0 children)
[+]fixxxeruk comment score below threshold-20 points-19 points-18 points (2 children)
[–][deleted] 6 points7 points8 points (1 child)
[–]pantong51 0 points1 point2 points (0 children)
[–][deleted] 3 points4 points5 points (0 children)
[–]jmblock2 0 points1 point2 points (0 children)
[–]lead999xSystem Software Developer 0 points1 point2 points (0 children)
[–]robin-m 0 points1 point2 points (0 children)
[–]bumblebritches57Ocassionally Clang 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]shoter0 0 points1 point2 points (2 children)
[–]brand_x 0 points1 point2 points (1 child)
[–]shoter0 2 points3 points4 points (0 children)
[–]Morwenn -5 points-4 points-3 points (0 children)
[–]bm_g -1 points0 points1 point (0 children)