Pause and inspect a failing execution
#Build with debug information and use the platform-supported GDB or LLDB. Optimized code can reorder/eliminate variables.
Typical compiler flags: -g -O0. Debug the test binary with its focused test filter.
Reference
Choose TypeScript, Go, Rust or C++ and find syntax, everyday APIs, standard libraries and tools in one place.
TypeScript/Node, Go 1.23+, Rust 2024 and C++23: from a first CLI to files, JSON, HTTP, concurrency and testing. Complete programs are labeled; other examples identify their surrounding code/imports. Optional libraries and version requirements are named in each entry.
Build with debug information and use the platform-supported GDB or LLDB. Optimized code can reorder/eliminate variables.
Typical compiler flags: -g -O0. Debug the test binary with its focused test filter.
ThreadSanitizer needs a supported compiler/runtime and instrumented build. It detects executed data races, not all concurrency bugs.
Typical supported Clang setup: -g -fsanitize=thread for compilation and linking. Run separately from AddressSanitizer.
AddressSanitizer and UndefinedBehaviorSanitizer catch supported executed memory/UB errors in an instrumented build.
Typical supported Clang flags for compile/link: -g -fsanitize=address,undefined -fno-omit-frame-pointer.
clang-format formats source; clang-tidy performs configured static checks using an appropriate compile database. Tool installation and configuration are separate from GoogleTest.
Shell with tools/configuration: clang-format --dry-run --Werror example.cpp; clang-tidy -p build example.cpp. Generate compile_commands.json with a supported build generator.
Record exact input, expected/observed behavior, version/configuration and a focused command. Reduce unrelated code while preserving the failure. Keep the result as a regression test once the cause is fixed.
Fragment