dbg-macro
brew install dbg-macro
v0.5.1
MIT
Dbg(…) macro for C++
1
30-day installs · #17707
2
90-day · #18320
9
365-day · #18081
3.2k
★ GitHub stars · updated 6mo ago
Build dependencies
GitHub topics
cpp
debugging
macro
pretty-printing
Links
- https://github.com/sharkdp/dbg-macro
- GitHub: sharkdp/dbg-macro
- Brew formula source: Formula/d/dbg-macro.rb
Raw metadata
{
"aliases": [],
"alternatives": [],
"build_dependencies": [
"cmake"
],
"categories": [],
"caveats": null,
"conflicts_with": [],
"dependencies": [],
"deprecated": 0,
"deprecation_reason": null,
"desc": "Dbg(\u2026) macro for C++",
"disable_reason": null,
"disabled": 0,
"enrichment_fetched_at": "2026-06-20T23:36:51+00:00",
"first_seen": "2026-06-20T23:34:18+00:00",
"full_name": "dbg-macro",
"github_default_branch": "master",
"github_last_commit_at": "2026-02-14T12:28:16Z",
"github_readme_excerpt": "# `dbg(\u2026)`\n\n[](https://github.com/sharkdp/dbg-macro/actions) [](https://godbolt.org/z/Yj13Kaxfh) [](dbg.h)\n\n*A macro for `printf`-style debugging fans.*\n\nDebuggers are great. But sometimes you just don\u0027t have the time or patience to set\nup everything correctly and just want a quick way to inspect some values at runtime.\n\nThis projects provides a [single header file](dbg.h) with a `dbg(\u2026)`\nmacro that can be used in all circumstances where you would typically write\n`printf(\"\u2026\", \u2026)` or `std::cout \u003c\u003c \u2026`. But it comes with a few extras.\n\n## Examples\n\n``` c++\n#include \u003cdbg.h\u003e\n#include \u003ccstdint\u003e\n#include \u003cvector\u003e\n\n// You can use \"dbg(..)\" in expressions:\nint32_t factorial(int32_t n) {\n if (dbg(n \u003c= 1)) {\n return dbg(1);\n } else {\n return dbg(n * factorial(n - 1));\n }\n}\n\nint32_t main() {\n std::string message = \"hello\";\n dbg(message); // [example.cpp:15 (main)] message = \"hello\" (std::string)\n\n const int32_t a = 2;\n const int32_t b = dbg(3 * a) + 1; // [example.cpp:18 (main)] 3 * a = 6 (int32_t)\n\n std::vector\u003cint32_t\u003e numbers{b, 13, 42};\n dbg(numbers); // [example.cpp:21 (main)] numbers = {7, 13, 42} (std::vector\u003cint32_t\u003e)\n\n dbg(\"this line is executed\"); // [example.cpp:23 (main)] this line is executed\n\n factorial(4);\n\n return 0;\n}\n```\n\nThe code above produces this output ([try it yourself](https://repl.it/@sharkdp/dbg-macro-demo)):\n\n\n\n## Features\n\n * Easy to read, colorized output (colors auto-disable when the output is not an interactive terminal)\n * Prints file name, line number, function name and the original expression\n * Adds type information for the printed-out value\n * Specialized pretty-printers for containers, pointers, string literals, enums, `std::optional`, etc.\n * Can be used ins",
"github_repo": "sharkdp/dbg-macro",
"github_stars": 3231,
"github_topics": [
"cpp",
"debugging",
"macro",
"pretty-printing"
],
"homepage": "https://github.com/sharkdp/dbg-macro",
"homepage_og_description": null,
"homepage_og_image": null,
"homepage_title": null,
"installs_30d": 1,
"installs_365d": 9,
"installs_90d": 2,
"keg_only": 0,
"keg_only_reason": null,
"last_seen": "2026-06-20T23:34:18+00:00",
"license": "MIT",
"llm_generated_at": null,
"llm_model": null,
"name": "dbg-macro",
"oldnames": [],
"one_liner": null,
"optional_dependencies": [],
"rank_30d": 17707,
"rank_365d": 18081,
"rank_90d": 18320,
"raw_hash": "bb1b70db69028801",
"recommended_dependencies": [],
"revision": 0,
"ruby_source_path": "Formula/d/dbg-macro.rb",
"tap": "homebrew/core",
"test_dependencies": [],
"uses_from_macos": [],
"version_head": "HEAD",
"version_stable": "0.5.1",
"versioned_formulae": [],
"why_use_this": null
}